NevadaUO
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UO Pilot Program help

Go down

UO Pilot Program help Empty UO Pilot Program help

Post  Lancelot Sun Dec 12, 2010 8:27 am

* 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
Lancelot
Lancelot

Posts : 52
Join date : 2010-10-17
Age : 48
Location : New York City

Back to top Go down

UO Pilot Program help Empty Re: UO Pilot Program help

Post  Lancelot Sun Dec 12, 2010 8:27 am

There are 3 types of clauses:
1. The check of var e.g.
if hits < 45

2. The check of last server message e.g.
if lastmsg too heavy

3. The check of colour in mentioned coordinates e.g.
if <coordinates> <colour> [colour2]
Means if colour in <coordinates> is equal to <colour>
Note. If [colour2] is given the point colour in <coordinates> is checked in range from <colour> to [colour2]. Keep in mind that colour check works correctly only if UO winow is on top.

Operator WHILE
Syntax
While <clause>
...
end_while

or

While_not <clause>
...
end_while

There are 3 types of clauses:
1. The check of var e.g.
while hits < 45

2. The check of last server message e.g.
while lastmsg too heavy

3. The check of colour in mentioned coordinates e.g.
while <coordinates> <colour> [colour2]
Means if colour in <coordinates> is equal to <colour>
Note. If [colour2] is given the point colour in <coordinates> is checked in range from <colour> to [colour2]. Keep in mind that colour check works correctly only if UO window is on top. e.g
while 320 240 1489121

Operator FOR
Syntax
For #<name> <start value> <end value> [step]
...
End_for
If #<name> is existed it changes else adds. After complteting the cycle it's equal to <end value> If [step] isn't mentioned it is equal to 1.
e.g.
For #i 0 10 2
...
end_for
Note. Keep in mind that <start value> <end value> [step] are read only once. These values couldn't be changed inside the cycle.

Operator REPEAT
Repeats action mentioned times.
Syntax
Repeat <number of times>
...
End_Repeat

Operator GOTO
Moves to the marker
Syntax
Goto <marker>

Marker should be mentiond in script in following way:
:<marker>
e.g.
...
goto end
...
:end

Fetching subprogrammes
Syntax
gosub <marker>

The subprogramme starts with
:<marker>
and ends with
return
It's strongly recommended to place subprogrammes at the end of the script after end_script.

Calling procedures
Syntax
call <name>
The procedure firstly is searched in current script and if it's absent in script #99. Procedure can be placed everywhere in script.
Procedures syntax
proc <name>
...
end_proc
e.g.
proc saying_message
say test passed
end_proc
call saying_message
end_script

Script control
Script is iterated step by step, exept if clauses, subprogrammes, goto markers etc.
To brake script use
End_Script
or
stop_script

Pauses
WaitForTarget [max wait time] - stops the script untill the view of cursor is sight or the [max wait time] run out

pause_script - pauses current script (you can start it from another script by using resume_script command, see also next chapter)

Others scripts control

You can operate scripts in the same UOpilote in different windows. <number> means number of window.

start_script <number>
If the script #<number> is existed it starts.

stop_script [number | all]
If the script #<number> is existed it stops.

pause_script [number | all]
If the script #<number> is existed it pauses.

resume_script <number | all>
If the script #<number> is existed it continues.

Interface commands and external programmes calling

Alarm [name.wav]
Plays sound [name.wav]. If there is an error or name.wav isn't exist than plays sound msg.wav. If file isn't obtained it's ignored.
e.g.
alarm welcome.wav
Lancelot
Lancelot

Posts : 52
Join date : 2010-10-17
Age : 48
Location : New York City

Back to top Go down

UO Pilot Program help Empty Re: UO Pilot Program help

Post  Lancelot Sun Dec 12, 2010 8:28 am

Msg [text]
the message window with [text] displays and script will be paused untill it's closed. The message window goes on top.

Flash
Flashes in taskbar. If you want UO window linked to UOpliot to flash use command Flash + smth else
e.g
flash smth_else

Exec <command> [parameters]
Execs applications with given parameters. If you want to use vars as parameters point them with #
e.g.
exec c:\test.exe #name #lastmsg

Terminate <window name>
Closes pointed application. Use with CARE!

macro_load <file name>
Loads written macro. If the path isn't given the macro will be searched in UO folder.

macro_play [number]
Execs the macro [number] times, and waits its end. If [number]=0 - execs endlessly once by default. One can start/stop macros by using hotkeys.

Mouse operate
All commands with mouse demand cordinates. There are 2 types of cordinates relative (from left top point to right bottom piont or UO window) and absolute (from left top point to right bottom piont or screen). You can set cordinates in following way:
1. Make the UOPilot window active (on top) in a way not to hide UO window.
2. Aim the mouse cursor on the point in UO screen you want (DO NOT CLICK!!!)
3. Push ctrl+A buttons -> you got cordinates.

If you want to place coordinates automatically check the check-box near coordinates.
If you wanna use absolute cordinates (can't be used with command drag) plase 'abs' after them.
e.g.
double_left 218, 242 abs
During executing mouse commands mouse is busy.

Move <coord>
Moves the cursor on <coord>. Attention it's strongly recommended to use this command before following commands.

Left <coord>
Clicks left mouse button on <coord>.

Right <coord>
Clicks right mouse button on <coord>.

Double_left <coord>
Doubel clicks left mouse button on <coord>.

Double_right <coord>
Doubel clicks right mouse button on <coord>.

left_down <coord>
Holds left mouse button on <coord>

right_down <coord>
Holds right mouse button on <coord>

Left_up
Sets left mouse button free on <coord>

Right_up
Sets right mouse button free on <coord>

Others commands
Send <button [pause]> | <text>
Push the <button> and wait [pause] mseconds. If <button> isn't recognized as a control button it sends like a text (as say command) with Enter in the end.
e.g.
send a // a is macros in UO that casts the heal spell last target

Sendex
*Doesn't work, no need to describe*

Drag <from> <to> [amount]
Moves from point with coordinates <from> to <to> an [amount] of items. Coordinates can be only relative. If [amont] isn't pointed only 1 iten will be moved, if [amount]= all - all item will be moved.
e.g.
Drag 220, 400 500, 780 12

Say [text]
Send text message and pushes enter
e.g.
say my x: coordx y: coordy and armor: ar
Lancelot
Lancelot

Posts : 52
Join date : 2010-10-17
Age : 48
Location : New York City

Back to top Go down

UO Pilot Program help Empty Re: UO Pilot Program help

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum