UOGamers Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • To obtain new Razor updates, please reinstall Razor from our new website.

I need script help

Xeasin

Sorceror
I'm looking uosteam screen hopelessly. Some smart people says "everybody can learn scripting" at this point i am complately dissagree with that idea. I read that documant come with instalation look at the other scripts but no i cant achive any tiny complicated stuff.

I'm trying to restock money from bank and buy and axe from vendors. I try to record it dosent work i try to create buying agent nope still aint work i am extreamy clues right now. Could somebody helpe me. Where i need to look at how can i manage this
 

c0d3r

Traveler
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
 
Last edited:

Xeasin

Sorceror
Some people says "EVERYBODY CAN LEARN SCRIPTING" in my point i gues there is no such a thing. One moment i think i get it then i fail. Now i'm just trying to create vendor push list and buy axe but i cant take any reaction even i cant see any eror message just nothing happened
 
Top