Тема: Newbie Guide
Показать сообщение отдельно
Re: Newbie Guide
Старый 22.02.2010, 00:47   #7
Avalon
Newbie
 
Аватар для Avalon
 
Регистрация: 22.08.2009
Возраст: 35
Сообщений: 62
Репутация: 2 [+/-]
имеет нулевую репутацию
Avalon имеет нулевую репутацию
Чар: Avalon
По умолчанию Re: Newbie Guide

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
Avalon вне форума   Ответить с цитированием