I set my price range 1 - 3000, set the slot and search.
I then open things up and look at what the tribute value is, decide if the price is right for the item, then buy if its good.
??
BUT THEN I THORT SUM THORTS !!!
I thought, "Hold on.. Im using MQ to just open up item views to see the tribute on an item to see if is worth buying for tribute
Then I thought, "Crap!! I could automate this whole thing!!!
Then I hacked, slept, wasn't quite pleased, and hacked again...
INTRODUCING TRIBUTE.MAC v0.2
This macro will open the bazaar search window, set the max price, loop the slots, press the search button, look at the items, then alert you when it finds an item with good tribute value, according to a ratio YOU set...
OMG, it even presses the "FIND TRADER" button!
Im working on some sort of "follow the magic gold path" thing, but I believe it may not be in the MQ stuff yet... May look into finding it and implimenting some sort of "follow the magic gold path" type thing... hmm..
So... All you do is goto the bazaar Trader side bank (not barter..), and type:
Code: Select all
/mac tribute 10 3000Here it is:
Code: Select all
| tribute.mac v0.2
|
| Author: I made it myself =P (zoobish)
| =======
|
| Function: Searches bazaar for tribute items worth buying.
| ========= You set the RATIO you like, i.e. 10 means 100pp
| for 1000 tribute. You may set the RATIO via the
| first argument when calling this.
| e.g. /mac tribute 15
| You can also set the MaxPrice with the second
| argument if you wish.
| e.g. /mac tribute 15 3000
| I find 3000 to be ample.
| It will alert you when it finds something.
|
#turbo
| This is the trigger for restarting the search after yah buy the current item.
| You can change it to whatever you want I suppose...
#event gogogo "#*#i need more TRIB now#*#"
#event notForSale "#*#That item is no longer for sale in the bazaar#*#"
Sub Main
| SET THESE IF YOU WISH, overridden by calling arguments.
/declare RATIO int outer 10
/declare MaxPrice int local 3000
/declare reStartFlag bool outer
/declare I int local
/declare J int local
/declare cPrice int local
/declare cTrib int local
/declare forSale bool outer
/declare aSlotNum[15] int local
/varset aSlotNum[1] 3
/varset aSlotNum[2] 4
/varset aSlotNum[3] 6
/varset aSlotNum[4] 7
/varset aSlotNum[5] 8
/varset aSlotNum[6] 9
/varset aSlotNum[7] 10
/varset aSlotNum[8] 11
/varset aSlotNum[9] 12
/varset aSlotNum[10] 13
/varset aSlotNum[11] 14
/varset aSlotNum[12] 16
/varset aSlotNum[13] 18
/varset aSlotNum[14] 19
/varset aSlotNum[15] 20
/echo Starting Bazaar Tribute Search...
| Check if a ratio and price were entered when called...
/if (${Defined[Param0]}) {
/echo RATIO set to ${Param0}
/varset RATIO ${Param0}
}
/if (${Defined[Param1]}) {
/echo MaxPrice set to ${Param1}
/varset MaxPrice ${Param1}
}
| *** Open the Bazaar window.
/baz
/delay 10s (${Window[BazaarSearchWnd].Open})
/if ( !${Window[BazaarSearchWnd].Open} ) {
/echo FATAL ERROR: Bazaar window could not be found or opened.
/echo ABORTING...
/endm
}
| *** Reset the Bazaar Search form.
/notify BazaarSearchWnd BZR_Default leftmouseup
| *** Key in monetary values
/call SetTextBox BazaarSearchWnd BZR_MaxPriceInput ${MaxPrice}
| *** Loop using Search by Slot.
/for I 1 to 15
/call selectSlotAndSearch ${aSlotNum[${I}]}
| *** Fix for activating "Inspect Item" button.
/notify BazaarSearchWnd BZR_ItemList leftmouseup
| *** Open each item and check stats
/for J 1 to 200
/varset cPrice NULL
/varset cTrib NULL
| *** Get the price of the item
/call getPriceAndSelect ${J}
/varset cPrice ${Macro.Return}
| *** If end of list, get next slot.
/if ( ${cPrice} == NULL ) /next I
| *** Get the tribute value, if any...
/call getSelectedTributeValue
/varset cTrib ${Macro.Return}
| *** If no tribute value, get next item via looking ahead.
/if ( ${cTrib} == NULL ) {
/call lookAhead ${J}
/varset J ${Macro.Return}
/next J
}
| *** Check ahead for the same item, and compare, alert if good.
/call checkAheadCompareAlert ${J} ${cPrice} ${cTrib}
| *** Set J to the position of the last item of the "copies"
/varset J ${Macro.Return}
/if ( ${Window[ItemDisplayWindow].Open} ) /keypress esc
/next J
| *** End item loop
/next I
| *** End Slot loop
/echo DONE.
/return
|==============================================================================
| Returns the position of the last occurrance of the item.
Sub lookAhead(int itemNum)
/declare lastOccur int local ${itemNum}
/declare iName string local
/declare K int local
/call getItemName ${itemNum}
/varset iName ${Macro.Return}
/for K 1 to 2
/varcalc lastOccur ${lastOccur} + 1
| Check if named the same...
/if ( ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${lastOccur},1].Find[${iName}]} ) {
/varset K 1
} else {
/varset K 2
}
/next K
/varcalc lastOccur ${lastOccur} - 1
/return ${lastOccur}
|==============================================================================
| Returns the name of the item, without the (number) bit...
Sub getItemName(int itemNum)
/declare iName string local NULL
/declare len int local
/varset iName ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${itemNum},1]}
/varset len ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${itemNum},1].Find[(]}
/varcalc len ${len} - 1
/return ${iName.Mid[1,${len}]}
|==============================================================================
| I suppose v0.1 of this was crap, it opened every item to find tribute value.
| This was slow, especially when there is usually a few of the same item for
| sale. This just looks at the first occurrence of an item for the tribute,
| then looks ahead at the prices to find the cheapest, without re-opening an
| item window(cause of much time waste). Returns the position of the last
| occurrence.
Sub checkAheadCompareAlert(int itemNum, int tPrice, int tTrib)
/declare lastOccur int local ${itemNum}
/declare lowPos int local ${itemNum}
/declare lowPrice int local ${tPrice}
/declare iName string local
/declare K int local
/call getItemName ${itemNum}
/varset iName ${Macro.Return}
/for K 1 to 2
/varcalc lastOccur ${lastOccur} + 1
| Check if named the same...
/if ( ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${lastOccur},1].Find[${iName}]} ) {
/varset K 1
| Get the price...
/call getPriceAndSelect ${lastOccur}
/if ( ${Macro.Return} < ${lowPrice} ) {
/varset lowPrice ${Macro.Return}
/varset lowPos ${lastOccur}
}
} else {
/varset K 2
}
/next K
/varcalc lastOccur ${lastOccur} - 1
| Check if item meets value requirements. If good, alert and wait.
/varcalc lowPrice ${lowPrice} * ${RATIO}
/if ( ${lowPrice} < ${tTrib} ) {
/call getPriceAndSelect ${lowPos}
/call alertAndWait "${iName}"
}
/return ${lastOccur}
|==============================================================================
| Alerts, beeps, and waits for continue text...
Sub alertAndWait(string itemName)
/declare K int local
/if ( ${Window[ActionsWindow].Child[AMP_EndFindButton].Open} ) {
| end find...
/notify ActionsWindow AMP_FindButton leftmouseup
/delay 1
}
/popup GOOD ITEM FOUND: >>> ${itemName} <<<
/notify BazaarSearchWnd BZR_FindTraderButton leftmouseup
/for K 1 to 5
/beep
/delay 2
/next K
/popup GOOD ITEM FOUND: >>> ${itemName} <<<
/call waitForGo
/return
|==============================================================================
| Returns the tribute value of an item. Does this by opening its item view and
| extracting the text.
Sub getSelectedTributeValue
/declare K int local
/declare tTrib int local NULL
/declare tInfo string local
/declare tPos int local NULL
/if ( ${Window[ItemDisplayWindow].Open} ) /keypress esc
| Open the item window
/notify BazaarSearchWnd BZR_RequestItemButton leftmouseup
/delay 6s (${Window[ItemDisplayWindow].Open})
/if (!${Window[ItemDisplayWindow].Open}) {
/varset forSale TRUE
/doevents
/if ( ${forSale} ) {
/echo BAD ITEM...
/return ${tTrib}
}
}
| Get the text, check for tribute...
/varset tInfo ${Window[ItemDisplayWindow].Child[IDW_ItemDescription].Text}
/varset tPos ${tInfo.Find[<BR>Tribute Value:]}
/if ( ${tPos} == NULL ) {
/return ${tTrib}
}
| Parse the tribute value
/varcalc tPos ${tPos} + 19
/varset tTrib 0
/for K ${tPos} to 10000
/if ( ${tInfo.Mid[${K},1].Compare[<]} != 0 ) {
/varcalc tTrib ${tTrib} * 10
/varcalc tTrib ${tTrib} + ${tInfo.Mid[${K},1]}
} else {
/varset K 10000
}
/next K
/return ${tTrib}
|==============================================================================
| Gets the price of an item in the bazaar search list, also selects it in list.
Sub getPriceAndSelect(int itemNum)
/declare tPrice int local NULL
/notify BazaarSearchWnd BZR_ItemList listselect ${itemNum}
/delay 1
/varset tPrice ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${itemNum},2]}
/return ${tPrice}
|==============================================================================
| Selects the Item Slot and does search. Waits Max 10s for results.
Sub selectSlotAndSearch(int slotNum)
/declare gotText string local
/declare count int local 0
/declare tt int local NULL
/notify BazaarSearchWnd BZR_ItemSlotCombobox listselect ${slotNum}
/notify BazaarSearchWnd BZR_QueryButton leftmouseup
:WAIT_RESULT
/delay 5
/varset gotText ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[1,1]}
/varset tt ${gotText.Find[(]}
/if ( ${tt} != NULL ) /goto :WAIT_END
/varcalc count ${count} + 1
/if ( ${count} > 20 ) {
/echo ALERT: There doesn't seem to be anything to look at from the search...
/return
}
/goto :WAIT_RESULT
:WAIT_END
/delay 5
/return
|==============================================================================
| This waits for the user to buy the found item, user then keys a phrase,
| and search restarts.
Sub waitForGo
/varset reStartFlag FALSE
:WAIT
/doevents
/if ( ${reStartFlag} ) /return
/delay 1s
/goto :WAIT
/return
|==============================================================================
|This is the event handler for when the user has keyed the restart phrase
Sub Event_gogogo
/varset reStartFlag TRUE
/return
|==============================================================================
|This is the event handler for when the item is no longer for sale
Sub Event_notForSale
/varset forSale FALSE
/return
|==============================================================================
| This sets the text in a text box control. Does not affect sliders. There is
| different code for that.
Sub SetTextBox(string Wnd, string Ctrl, string Inp)
/declare I int local
| Clear the text box
/notify ${Wnd} ${Ctrl} leftmouseup
/for I 1 to 2
/notify ${Wnd} ${Ctrl} leftmouseup
/if ( ${Window[${Wnd}].Child[${Ctrl}].Text.Length} > 0 ) {
/keypress backspace chat
/varset I 1
} else {
/varset I 2
}
/next I
| Fill the box...
/for I 1 to ${Inp.Length}
/keypress ${Inp.Mid[${I},1]} chat
/next I
/return
|===========================================================================end


