Buyer and Trader Macro's

Discussion in 'General MQ2' started by acatu, Dec 8, 2019.

  1. acatu

    acatu A Griffin

    Messages:
    235
    To use these I was using a startup script to launch my traders and editing whatever Creamo uses to trigger e3 on zone to use the start trader / buyer macro's. I run traders on one PC/VM and Buyers on a separate so I can use 2 separate MQ builds for starting the processes. Credit to Popper for developing these originally.


    Trader
    Code:
    #turbo 20
    
    Sub Main
        /trader
        /delay 100
    
    
        /if (${Window[BazaarWnd].Open}) {
            /notify BazaarWnd BZW_Start_Button leftmouseup
            /delay 10
        }
    /return
    Buyer
    Code:
    #turbo 20
    
    Sub Main()
        /declare channel string
           /declare result int outer
           /declare active bool outer
           /declare items string outer
           /declare mainchar string
        /declare campdesk bool
        /declare stopbarter bool
        /declare notifymain bool
        /declare delaytime string
    
    |------------------------------------------------------------
    |    Select your chat channel to spam
    |------------------------------------------------------------
        |/varset channel /ooc
        /varset channel /auction
        |/varset channel /shout
        |/varset channel /guild
        |/varset channel /tell smashngrab
    
    |------------------------------------------------------------
    |    Select your spam delay
    |------------------------------------------------------------
        |1 hour
        |/varset delaytime 3600s
    
        |4 hours
        /varset delaytime 14400s
    
    |------------------------------------------------------------
    |    Determine what to do when buyer is done.
    |    Set these values to ${Bool[TRUE]} or ${Bool[FALSE]}
    |------------------------------------------------------------
        /varset campdesk ${Bool[FALSE]}
        /varset stopbarter ${Bool[TRUE]}
        /varset notifymain ${Bool[TRUE]}
    
    |------------------------------------------------------------
    |   Change this to your main characters name to be notified
    |   when there are no active buy lines (notifymain must be
    |   set to TRUE).  ie) /varset toonname Popper
    |------------------------------------------------------------
        /varset mainchar Smashngrab
    |------------------------------------------------------------
    
        /buyer
        /delay 100
    
        /if (${Window[BarterWnd].Open}) {
            /if (!${Me.Buyer}) {
                /notify BarterWnd BTR_StartStopButton leftmouseup
            }
    
            /call check_BuyLines
            /if (${active}) {
                /docommand ${channel} New Buyer UP!
                /delay 20
            }
        } else {
            /return
        }
    
       :Loop
        /if (${Me.Buyer}) {
            /call check_BuyLines
            /if (${active}) {
                /call check_ItemNames
                /docommand ${channel} WTB: ${items}.  Come find me in the bazaar. Now RoF2 Enabled!
            } else {
                /if (${notifymain}) /tell ${mainchar} I have no active buy lines.
                /if (${stopbarter}) /notify BarterWnd BTR_StartStopButton leftmouseup
                /if (${campdesk}) /camp desk
                /return
            }
        } else {
            /return
        }
    
        /delay ${delaytime}
        /goto :Loop
    /return
    
    SUB check_BuyLines
        /varset active ${Bool[FALSE]}
        /for result 1 to 100
            /if (!${active}) {
                /varset active ${Window[BarterWnd].Child[BTR_BuyLineList].List[${result},1].Equal[X]}
            }
            
            /if (${active}) {
                /varset result 100
            }
        /next result
    /RETURN
    
    SUB check_ItemNames
        /varset items
        /for result 1 to 100
            /if (${Window[BarterWnd].Child[BTR_BuyLineList].List[${result},1].Equal[X]}) {
                /if (${items.Length}==0) {
                    /varset items ${Window[BarterWnd].Child[BTR_BuyLineList].List[${result},3]} (${Window[BarterWnd].Child[BTR_BuyLineList].List[${result},5].Left[-1]})
                } else {
                    /varset items ${items}, ${Window[BarterWnd].Child[BTR_BuyLineList].List[${result},3]} (${Window[BarterWnd].Child[BTR_BuyLineList].List[${result},5].Left[-1]})
                }
            }
        /next result
    /RETURN
     
    • Like Like x 1