Re: Newbie Guide
* For help using UO Pilot scripting *
Here is the quick reference for uopilot in english
Notation conventions (legend):
<> - compulsory parameter
[] - optional parameter
Words are consisted in symbols 0-9 A-z ?-?
#, $, %, +, -, *, /, >, <, =, :, ., (, ), [, ] - special registered symbols
// - commented. e.g wait 500 //means wait 500ms ("means wait 500ms" won't be read by UOpilot)
wait - wait =))) in ms (1/1000 s) also wait 1s (second) 1m (minute) 1h (hour) avaible
Variables
$name - string variable
#name - numerical variable
e.g.
set $name oh-la-la
set #name 20
Before using variable you must set it up with command set e.g. set #i 1
The variable changes only by using commands set and for. Command repeat doesn't change variable. e.g.
set #i #i + 1
Arrays
% - array's ID
You can set up array's element with command set. Array's element can be string or numerical. Also you can use arrays from another script window by setting it name dot #script
e.g.
set %ar [4] test // one-dimensional array with 4 elements
set %ar.2 [5] 10 // one-dimensional array in parallel script #2 with 5 elements
set %arr [50 2] 544 // two-dimensional array with 50 times for 2 elements
Keep in mind that you CAN'T directly use elemets of array in if clause. e.g. if charposx <> %arr [50 1]
Command Set
set $<name> <value> or
set #<name> <value1> [<sign> <value2>]
set %<name> [element] <value>
There are signs +, -, *, / and () e.g
set #q ((5+4)/(3+-2)* #e )-(2-(-5+9))*3
Some operations with string variables are avaible:
set $s1 1
set $s2 2
set $s $s1 + $s2
The result is $s = '1 + 2'
but
set #n $s1 + $s2
the result is #n = 3
There is also random generator
set #a random 5 // returns a result from 0 to 4 (5-1)
If there are 2 or more scripts you can set up variable in parallel script by using command set . e.g.
set #i.3 5 // set variable #i in script number 3
Reserved variables
Note1: [W] - means that you can change the value of var by using command set, others variables are read-only.
Note 2: The status bar (Character Status) in UO window must be open for correct using character parameters by UOpilot.
hour - current time (hour)
min - current time (minute)
sec - current time(second)
e.g.
say current time is hour : min . sec
timer - counts mseconds from the beginning script and can be used in all of operators
set timer // sets the value timer in 0
name - name of UO character
str - strenth of UO character
int - int of UO character
dex - dex of UO character
hits - hits of UO character
mana - mana of UO character
stam - stamina of UO character
gold - the sum of money of UO character
wght - current weight of UO character
armor - armor class of UO character
charposx - horisontal position of UO character
charposy - vertical position of UO character
charposz - Z-coordinate (height position of UO character)
chardir - The direction of sight of UO character
0 - North direction , each 45 degrees clockwise +1 e.g. 3 is East; 7 is Nord-West
lastmsg - last server message (in journal)
lastobjectid - ID of last used item [W]
lastobjecttype - the type of last used item [W]
lasttargetid - the ID of last aim [W]
lasttargetx - coordinates of last aim [W]
lasttargety - - " - [W]
lasttargetz - - " - [W]
lasttargetkind - class of last aim (1 - item; 2 - ground; 3 - static or water) (e.g. if you want to click pickaxe on the ground use 3; to click by using the fishing pole on the water use 2). [W]
lastliftedid - ID of item that was the last 'in hand'. [W]
lastskill - number of last skill from Skills menu [W]
lastspell - number of last spell from Magic book [W]
laststatictype - The type of last static item (tree, etc) [W]
target - the type of cirsor (0 - hand; 1 - sight) [W]
You can use other characher variables, in other script windows (variable dot # of script) e.g.
set lasttargetid.1 7
say hits.1
If clauses
In 'if clauses' you can use the following operators >, <, =, <>, also logic ones (and, or, xor) There are no priority, operators execute in series.
e.g.
if hour = 23 and min = 45 or #count = 100
If you want change the priority use brackets. e.g.
while (#a > 1 and #a < 3) or ((#a = 1 and 130, 9 7295) or #a = 5)
You can use random operator e.g.
while #a = #b or random 5 > 3
For braking the action of operators while, for è repeat you can use command Break. syntax Break [level]
Command Continue moves up the cycle into the next step. It can be used in repeat, for, while
There is a syntax rule in using lastmsg var:
if lastmsg text of last server message
or
if lastmsg = $a [or lastmsg = $b ...]
That means you must use nothing else than a server message
Operator IF
Syntax
if <clause>
...
end_if
or
if <clause>
...
else
...
end_if
or
if_not <clause>
...
end_if
or
if_not <clause>
...
else
...
end_if
|