the documentation will show you the basic stuff and describe a sample of each command available in uos, the best way to learn is by reading others scripts and making your own stuff, you asked for help but havent provided a single piece of functional code or even a broken one.
1. define the runebooks used by that macro, I've chosen to use two runebooks, one for vendors locations and another for bank
Code:
// Ask for bank runebook, make the bank rune default
if not @findobject 'bank runebook'
promptalias 'bank runebook'
endif
// Ask for vendors runebook
if not @findobject 'vendors runebook'
promptalias 'vendors runebook'
endif
2. condition that will check if we have enough gold, if not it should keep trying to recall and restock gold
Code:
// Restock gold if necessary
if gold < MINIMUM_GOLD_AMOUNT
while x != BANK_X_POSITION and y != BANK_Y_POSITION
// If dead stop that macro
if dead
stop
endif
// Perform recall to bank runebook default rune
cast 'recall'
waitfortarget 5000
target! 'bank runebook'
// Wait a few seconds until recall is performed
pause 2500
endwhile
msg 'withdraw MINIMUM_GOLD_AMOUNT'
// Wait until we receive the gold, this can help in case there is a world save or massive lag
while gold < MINIMUM_GOLD_AMOUNT
endwhile
endif
3. once gold is restocked we should start buying, this part is a little bit harder because we will need a list of buttons to reply when using our vendors runebook, we will also need a list with vendors serial
Code:
// Create a list to hold recall rune buttons
if not @listexists 'runes'
createlist 'runes'
endif
// In case runes list is empty we should populate
if list 'runes' == 0
pushlist 'runes' 5
pushlist 'runes' 11
pushlist 'runes' 17
pushlist 'runes' 23
pushlist 'runes' 29
pushlist 'runes' 35
pushlist 'runes' 41
pushlist 'runes' 47
pushlist 'runes' 53
pushlist 'runes' 59
pushlist 'runes' 65
pushlist 'runes' 71
pushlist 'runes' 77
pushlist 'runes' 83
pushlist 'runes' 89
pushlist 'runes' 95
endif
// Create a fixed list to hold vendors serial, that way for each rune we can have one or more vendors, we are not going to remove elements so we can just populate upon creation
if not @listexists 'vendors'
createlist 'vendors'
pushlist 'vendors' VENDOR_SERIAL
pushlist 'vendors' VENDOR_SERIAL
pushlist 'vendors' VENDOR_SERIAL
endif
// Iterate runes list, meaning it will perform the action inside that block for each runes list entry unless there is a break/continue/stop/replay command
for 0 to 'runes'
// If dead stop that macro
if dead
stop
// If not enough gold we should replay this macro in order to restock
elseif gold < MINIMUM_GOLD_AMOUNT
replay
endif
// Recall to the first rune of our runes list
useobject! 'vendors runebook'
waitforgump 0x554b87f3 5000
replygump 0x554b87f3 'runes[0]'
// Wait a few seconds until recall is performed
pause 2500
// Search for vendors and attempt to buy
for 0 to 'vendors'
// If not enough gold we should replay this macro in order to restock
if gold < MINIMUM_GOLD_AMOUNT
replay
// Attempt to buy
elseif @contextmenu 'vendors[]' 2
pause 1500
endif
endfor
// Remove current first rune so we can recall to the next one or, in case it went for a restock, continue recalling and buying from where it stopped
poplist 'runes' 'front'
endfor
4. I've added some code you'll need to replace according to your needs:
- BANK_X_POSITION : the x position of your bank recall location, type -where or check uos About tab for that
- BANK_Y_POSITION : the y position of your bank recall location, type -where or check uos About tab for that
- MINIMUM_GOLD_AMOUNT : the minimum amount of gold you need to start buying
- VENDOR_SERIAL : type -info and click the npcs to get serials or use the Object Inspector button
5. finally:
- put all codes in sequence, you'll probably have your macro
- setup your buy agent
- mark Loop option
ps: I havent tested any of this so it may contain typos