The Actions (commands) in this section control the order in which commands are carried out.IF @n {act1} ELSE {act2}
If @n is true (non-0) then do action 1, otherwise do action 2 (the "else" clause is optional). Example:IF @error {
report "There has been an error!" }
else {
report "Everything is just fine." };
WHILE @n {act}
While @n is true (non-0) then do specified action(s). Example:REPORT "Counting to ten";
@i=1;
WHILE @i<10 {
REPORT $str[@i];
@i=@i+1 };
REPORT "Done counting.";
FOR $v @n1 @n2 @n3 { act }
Perform the specified action repeatedly, starting with the index variable $v set to @n1 and incrementing it by @n3 each loop, and stopping when the index reaches @n2. IMPORTANT: the first argument is the NAME of a numeric variable, and NOT the variable itself, thus it has no "@" prefix; but within the loop the value of the index can be accessed using the "@" prefix (see examples below). (You could theoretically use a non-standard variable name with quotes around it (e.g. "my variable name"), but it would be more difficult to get the value from it in that case.)REPORT "Counting to ten";
FOR i 1 10 1 {
REPORT $str[@i] };
REPORT "Done counting.";
output: 1 2 3 4 5 6 7 8 9 10REPORT "Counting down";
FOR i 10 1 -1 {
REPORT $str[@i] };
REPORT "Done counting.";
output: 10 9 8 7 6 5 4 3 2 1REPORT "Counting by twos";
FOR i 1 10 2 {
REPORT $str[@i] };
REPORT "Done counting.";
output: 1 3 5 7 9BREAK;
Break from current WHILE loop. Example:
@i=1;
WHILE @i<10000 {
if @error<>0 { break };
REPORT "No error yet...";
@i=@i+1;
};
BREAKALL
When a BREAKALL is performed, any WHILE loops executing anywhere in MB will end.QBREAK
Causes enqueued actions to come to a stop. Any remaining actions in that particular queued action sequence will be discarded.QFLUSH @queue_id
Empties the specified action queue.SWITCH @n {@n1: act1 }{@n2: act2}{@n3: act3} ... {: default_act };
Perform action according to value of @n. Example:
SWITCH @n
{1: report "N equals one."}
{2: report "N equals two."}
{: report "N equals something besides one or two."};
WAIT @msecs
Pause for specified number of milliseconds to receive messages from the world server, via the AW SDK function aw_wait. This is only necessary in synchronous mode (see SYNCH, SYNCHTIMER Actions below) since MB automatically polls the server for messages in the default, asynchronous mode. Also note that MB will not be able to respond to mouse clicks or keyboard input during the call the aw_wait, so you want to keep it short.MBWAIT @msecs
Pause for specified number of milliseconds. This Action uses MB's own internal routine and will not prevent MB from responding to mouse clicks or keyboard input. (MBWAIT is only for pausing, it does not poll the world server for messages like WAIT.)QWAIT @msecs
Pause for specified number of milliseconds, within an ENQUEUE'd action. Similar to MBWAIT, however QWAIT will cause only the particular action queue that it's in to pause, allowing other action queues and the main thread of program execution to continue. QWAIT has no effect outside of an ENQUEUE'd action.SYNCH @state
This turns "synchronous mode" on or off. When SYNCH 1 is called, then no further messages will be received from the world server except when a WAIT Action is called, until SYNCH 0 is called to end synchronous mode. In asynchronous mode (SYNCH 0), the world server will automatically be checked for messages according to the timing set by the SYNCHTIMER Action (see below). The default mode for MB is asynchronous. You would typically use SYNCH 1 in a Behavior Table Action where you wanted to make sure you didn't get any new messages until the Action finished, at the end of which you would call SYNCH 0.SYNCHTIMER @wait @interval
This sets the timing of automatic messages from the world server. In asynchronous mode (SYNCH 0), every @interval milliseconds, the world server is polled for messages for @wait milliseconds (via a call to the AW SDK function aw_wait). The default timing is 1 milliseconds wait, 500 milliseconds interval, which can be changed by setting the WAIT and INTERVAL values in the DEBUG section of the .ini file.FLOODPROOF @state
This turns on or off "floodproofing", which tries to prevent the bot from being flooded by too many HEAR, OBJECTCLICK or AVATARCLICK events. See FLOODLIMIT below. (Version 4.4.6.)FLOODLIMIT @ms
Set the minimum time for repeated HEAR, OBJECTCLICK or AVATARCLICK events. Any of these events from the same person that occur closer together than the specified time are discarded. As of version 7.0, the time is in milliseconds. (In previous versions, the time was in Delphi format, which means a floating point number that is a fraction of a day. For example, a tenth of a second would be 1/24/60/60/10 = .000001157.)CHECK @cond
If CHECK is set to 0 within a behavior table action, MB will ignore subsequent rows of the behavior table, except for the ANY event, until CHECK is set to 1.ENDCHECK
Tells MB not to check subsequent rows of the behavior table. Normally, MB will check every row of the Table for Events/Conditions, even after finding one that matches and executing the associated Action. If you put ENDCHECK anywhere in the Action for a row, then MB won't continue looking after it executes that Action.CONTCHECK
Tells MB to continue checking subsequent rows of the behavior table, even if ENDONREACT mode (see below) is on. If an ENDCHECK command is also present in the action, then CONTCHECK is overridden and checking will not continue in any case. Also note that the CONTCHECK is only in effect for the row it's in; that is, the CONTCHECK command overrides ENDONREACT only for the row that the CONTCHECK command is in, not subsequent rows. (Version 5.0 b2)ENDONREACT @cond
Normally, MB will check every row of the Table for Events/Conditions, even after finding one that matches and executing the associated Action, unless an ENDCHECK command (see above) cancels checking for the following rows. There are times however when it is advantageous to have the check automatically stop on the first row that triggers an action. For example, if you have a long list of rows with HEAR events, and you want checking to stop on the first row that matches. You could put ENDCHECK command in every action; but the ENDONREACT command allows you to implicitly add an ENDCHECK to every row of the same event type that follows it. ENDONREACT 1 turns on the automatic ENDCHECK mode for the rows that follow it, and ENDONREACT 0 turns it off for rows that follow. Note the ENDONREACT doesn't apply to the row containing the ENDONREACT command itself, since that row has already been triggered and ending the check there would be pointless. Also note that the ENDONREACT only applies to rows with the same event type (although you could use the ANY event to set ENDONREACT for all event types). (Version 5.0 b2).USEREVENT @userevent
Sends a USEREVENT to the behavior table, immediately (i.e. it isn't queued). The @userevent argument is an arbitrary number that can be accessed using the @userevent function within the context of the behavior table.
EVENT $eventname @eventdata
Simulates an event, sending it to the behavior table. Unlike USEREVENT, the event is queued. The optional @eventdata argument is an arbitrary number that you can use to send special data to the event, for example a vlist pointer. It can be accessed within the event (i.e., in the action column of the behavior table) using the @eventdata function. (If you do use this to pass a vlist pointer, make sure to free the vlist afterward.) You can use the AWINT_, AWFLOAT_ and AWSTR_ commands to set attributes to be sent to the behavior table with the event. Note the underscores to distinguish these commands from the AWINT, AWFLOAT and AWSTR commands that set actual SDK attributes; whereas AWINT_, AWFLOAT_ and AWSTR_ commands set event data sent to the behavior table instead. Within the behavior table, the @atr and $atr functions will return the values set by the AWINT_, AWFLOAT_ and AWSTR_ commands, if used. New in version 6.6.15.
Example: Simulate a HEAR event:
awstr_ chat_message="This will appear as the chat text."
awint_ chat_session=12345;
awstr_ avatar_name="Magine";
event HEAR;
ENQUEUE { action }
Places the specified action or action sequence into the Action Queue, to be executed in parallel with other actions in the queue. See here for further information.RESUME(new in 4.1 b25)
This command is used to circumvent the usual event queuing process within an enqueued action. Actions that are put into the action queue with the ENQUEUE command are taken from the action queue for execution one at a time (and from alternating action queues, if more than one action queue exists) within the same routine in Magsbot that processes behavior table events. Thus, although action queue actions appear to execute in parallel with behavior table actions, they are actually processed sequentially to prevent them from interrupting and interfering with each other. However, this can present a problem when executing very lengthly actions from the action queue, because processing of events in the behavior table will be suspended while the long-duration action queue action is being performed. If you're sure that an action that you're putting into the action queue with the ENQUEUE command won't interfere with behavior table actions, you can place the RESUME command at the beginning of the enqueued action sequence, to tell Magsbot to go ahead with processing of the behavior table immediately. Note that this may cause processing of behavior table events to temporarily interrupt the processing of the action in the action queue, so you should be certain that sure interruptions won't cause problems with the enqueued routine.QSTATE @cond
Suspends (@cond=0) or reactivates (@cond=1) the Action Queue. While suspended, no actions are taken from the queue. This allows you to issue multiple ENQUEUE commands to fill the queue, then later set QSTATE 1 to have all the actions in the queue executed in sequence.New in Magsbot 4.0:
FTN $button_name argumentsNew in Magsbot 6.0:
Similar to CLICKBTN, this command executes the code within the specified user-defined button. However, whereas CLICKBTN passes the entire local variable list into the button and back out, FTN only passes in the specified values. Within the action button, the values passed in are renamed as specified by the ARGS command. (If no ARGS command is given in the action button, then the values passed in are assigned to variables named @v_1, @v_2, $v_1, $v_2 etc.) For example:In the calling routine:Also see the @ftn and @ftn functions.
FTN "MyButton" 12 (2/6+8) @len["this is a test"] "foobar"Within the button:
ARGS @x @z @n $x;
REPORT $fmt["The arguments you passed are: %s %s %s %s",@x,@z,@n,$x];
Output: 12 11 14 foobarARGS arguments
See the FTN command, above.RETURNS variable_names
This command is used within an action button to return variables in the local variable list. Example: RETURNS @x $z would cause variables @x and $z that were created inside the button, to be available to the calling routine.RETURN $return_value
This command is used within an action button to return a string value to the $ftn function. See for @ftn and @ftn details.RETURN_ @return_value
This command is used within an action button to return a numeric value to the @ftn function. See for @ftn and @ftn details.
Creating a separate thread is similar to using the ENQUEUE command; the difference is that the action queue only simulates the use of a separate thread, whereas the THREAD command actually does create a new thread to run an action sequence in.Well...sort of. Threads (in Windows) have some serious limitations to them, the biggest one being that any GUI-related activity (like printing something in the log window) has to occur within the main thread of the program. Also, manipulating certain kinds of data (such as the lists that Magsbot makes extensive use of) also has to occur within the main thread. However a separate thread can still perform these activities by pausing briefly and letting the operations occur in the main thread before continuing on, and this is how Magsbot handles threads that are created by the THREAD command: all of the individual actions in the newly-created thread still occur in the main program thread intermittently, but the separate thread is used to "keep things going" and allow other actions to execute at the same time.
Those are the technical details, but you don't need to worry much about them...practically speaking, the actions you specify in the THREAD command will appear to take place simultaneously with other program activities. However there are a few limitations you should know about:
1. If you use the MBWAIT command within a thread, it will cause all threads to pause, which kind of defeats the purpose of multithreading. So if you need to pause within a thread, use a loop instead, like this:
@t=@ctime+10;The above code used inside a thread, will pause for ten seconds without causing other threads to hang up. (Also see THREADWAIT, below.)
while @ctime<@t {
};2. The WHILE, FOR, IF and DATASET commands will all work normally within a thread. However, be aware that other commands that have action clauses (such as the TRAP command) will act as a single action as far as the thread is concerned. That is, everything within the action clause will be executed before the thread proceeds with the next action in the sequence. Therefore, putting a command that has a lengthly action clause inside of a THREAD clause, will negate the usefulness of the thread.
THREAD { action }
Spawns a new thread to run the specified action(s) in. The thread handle will be in the variable @thread following the THREAD command. (Note: as of version 7.11.6, @thread is a function that can be called from within the thread itself, as well as from the code following the THREAD command.)THREADEND @thread
Terminates the specified thread.THREADSUSPEND @thread
Suspends the specified thread.THREADRESUME @thread
Resumes the action of the specified suspended thread.THREADWAIT @ms
Called within a thread, this command pauses execution of the thread for the specified number of milliseconds. (Less processor intensive than using a WHILE loop.) New in version 7.11.8.Also see thread-related functions, @thread_[@i] and @threadcount.
TRAP { act1 }{ act2 }
If an error occurs in action 1, then do action action 2. (Error messages are inhibited inside Action 1, but @error, @sdkerror and $error will be set according to the error that occurred.) The second action is optional; if it's absent, the TRAP command merely inhibits error messages. You can use TRAP to exit an action if an error occurs, like this:TRAP { REM some action that may cause an error } { BREAK };ERROR @code $messageREM actions here will not be executed if an error occurs above;
Simulate an error event.BEEP
Causes a beep on the computer that MB is running on.CLEARERROR
Sets @error and @sdkerror to 0See also @error, $error and @sdkerror functions.
(Note: use the @newinstance function to create a new instance.)SETINSTANCE @handle
Selects the current instance for purposes of getting or assigning AW Attributes, performing Actions, etc. Note that this DOES NOT change the Active Instance, i.e. the instance being displayed in the MB control panel.SETACTIVE @handle
Selects the Active Instance, i.e. the instance being displayed/controlled by MB's Location tab and log window. (Note: if the Options menu item "Display Messages for Active Instance Only" is unchecked, then events and chat from all instances will be displayed in the log window, although only the Active Instance will be displayed/controlled by the Location tab.)DELETEINSTANCE @handle
Destroys the specified bot instance.CONNECT
Creates a new instance which will immediately enter the world specified on the Location tab, regardless of the AutoEnter/AutoAppear settings.ENTERWORLD $world
Causes the current instance (note: not necessarily the Active Instance) to enter a world; either the optionally specified world, or the world specified on the Location tab. Does not set the instance at a particular location.ENTERGLOBAL $world
Causes the current instance (note: not necessarily the Active Instance) to enter a world in global mode; either the optionally specified world, or the world specified on the Location tab. Does not set the instance at a particular location.GLOBALMODE @cond
Changes the Options/Connection/Global Mode menu item.APPEAR
Causes the current instance (note: not necessarily the Active Instance) to appear at the coordinates specified on the Location tab. (To specify the coordinates, use MOVETO instead.)DISCONNECT
Causes the Active Instance to be destroyed.SETUNIVERSE $addr @port
Changes the default settings for new instances.INSTNOTE @instance $note
Sets the instance list note field of the specified instance.
SAY $text
Speaks text. (Note: if bot's owner has public speaker rights in the current world, then anything spoken will be in "broadcast" mode.)WHISPER $name $text
Whispers to a single individual, specified by name.WHISPER_ @session $text
Whispers to a single individual, specified by session. You could use this with @chatsession to reply to people in a HEAR event. (That is, instead of WHISPER $avname "blah..." you coud use WHISPER_ @chatsession "blah...".) The advantage would be that you could turn off the AVATARADD handler (if you didn't need it for some other purpose) since you wouldn't need the Nearby list to lookup the speaker's session from their name, as you do with WHISPER.ANNOUNCE $name $message @color @style
Send an announcement (console message) to a person by name. If multiple avatars have the same name, they will all receive the message. You can set the color using optional argument @color and the style (bold or italics) using the optional argument @style (style: 0=regular,no italics; 1=bold; 2=italics; 3=bold & italics). The @dec function can be used to specify the color in the same hexidecimal form that AW uses for model colors, for instance red text would be @dec["FF0000"]. You can alternatively use AW attributes CONSOLE_RED, CONSOLE_GREEN, CONSOLE_BLUE, CONSOLE_ITALICS, CONSOLE_BOLD beforehand (using the AWINT command) to control the text color and style.ANNOUNCE_ @session $message @color @style
Like ANNOUNCE except directed at a person by their session number instead of their name, similar to WHISPER_ (see above). If you use 0 for @session, then all users in the world with the bot will receive the message. see ANNOUNCE, above, for information about the optiona color and style arguments.BOTGRAM @citizenID $message
Send a bot telegram to all bots being run by the specified citizen. Received in the BOTGRAM event. Version 5.2 b2.SELECT $name
Select an avatar by name on the Nearby List, if present.SELECT_ @session
Select an avatar by session number on the Nearby List, if present.UNSELECT $name
Deselect an avatar by name on the Nearby List, if present.UNSELECT_ @session
Deselect an avatar by session number on the Nearby List, if present.SELECTALL
Select all names on the nearby list.SELECTNONE
Deselect all names on the nearby list.SENDCHAT $text
Speaks text in current mode (say or whisper) depending on selections in the Nearby List. NOTE: SENDCHAT will use whisper mode if names are selected in the nearby list, even if the list window is not visible, unlike manually entered chat, which is only in whisper mode when the nearby window is showing (or minimized).REPORT $text
Prints text in the log window.ASSERT $text
Prints text in the log window, when Actions/Advanced/Debug Msgs is checked. (New in version 4.3.4.)ASSERT_ @cond $text
Prints text in the log window, when the specified condtion is true. (New in version 7.1)POPUP $text
Displays text in popup dialog.INFO $title $text
Displays text in a large, scrollable popup dialog. The $title argument is optional.READFILE $filename @delay
Reads file $filename using SENDCHAT (i.e., spoken or whispered according to selections on the Nearby List), pausing @delay milliseconds between lines.ECHO @cond
This can be used to turn off event messages for the duration of a particular action sequence, e.g. an Action Button script. When @cond=0, no event messages are displayed.
AVTRACKING @cond
Sets the default avatar tracking state for newly created instances. See AVTRACKING_, below.AVTRACKING_ @cond
Turns avatar tracking on or off for the current instance. When off, the specified instance won't record the position of nearby avatars.AVCHANGEFILTER @state
This turns on or off filtering of AVATARCHANGE events to prevent lag that can occur due to processing of too many such events at once. See AVCHANGELIMIT below. Note that AVCHANGELIMIT will only affect whether or not an AVATARCHANGE event will be sent to the behavior table; avatar tracking data will be updated in any case, assuming that avatar tracking is turned on for that bot instance.AVCHANGELIMIT @ms
Set the minimum time for repeated AVATARCHANGE events. Any of these events from the same person that occur closer together than the specified time are discarded. Note that AVCHANGELIMIT will only affect whether or not an AVATARCHANGE event will be sent to the behavior table; avatar tracking data will be updated in any case, assuming that avatar tracking is turned on for that bot instance. As of version 7.0, the time is in milliseconds. (In previous versions, the time was in Delphi format, which means a floating point number that is a fraction of a day. For example, a tenth of a second would be 1/24/60/60/10 = .000001157.)AVDETECTRANGE @distance
Set the range for detecting avatar movements, for the current instance only. The distance is in SDK units. (Version 4.4.6.) Note: as of version 5.3 b19, avatar tracking data will be updated even if an avatar is outside of the detection range (but within the bot's natural ability to detect nearby avatars, of course), assuming that avatar tracking is turned on for that bot instance; the AVDETECTRANGE will only affect whether or not an AVATARCHANGE event will be sent to the behavior table.AVCHANGECOND @conditional_expression
Set the conditions that determine if an AVATARCHANGE event is sent to the behavior table. If no expression is given, then all AVATARCHANGE events are sent to the behavior table.AVCHANGE @ns @we @alt @yaw @avtype @gesture
Assign the specified position, avatar type and gesture to the bot.MOVETO @ns @we @alt @yaw
Move to the specified coordinates. The @yaw argument is optional.MOVE @ns @we @alt
Move in the specified direction.TURN @deg
Rotate the specified number of degrees. (Clockwise if @deg is negative, counterclockwise if positive.)FACE @yaw
Face in the specified direction.GESTURE @gesture
Perform the specified gesture. (Note: before performing each new gesture, you should reset the bot with GESTURE 0.)AVTYPE @avtype
Set the avatar type. The first name of the list of avatars for a given world is type "0". Special types available only to public speakers are negative, i.e. Special1 is –1, etc.TELEPORT $world
or
TELEPORT $world @ns @we @alt @yaw
Teleport to the specified world, optionally at the specified coordinates. If the coordinates are not given, then the bot will enter the world but not appear until a MOVETO or other location-setting command is given. This is to prevent the bot from accidentally teleporting to GZ of worlds where bots are forbidden, and getting ejected. (If you want a bot to appear at GZ, then simply specify the coordinates, e.g. TELEPORT myworld 0 0 0 0).Note that if you wish the bot to enter a world in global mode, you can't use the TELEPORT command to enter the world. To run an instance in global mode, first enter the world using the command ENTERGLOBAL $world, and then use TELEPORT or MOVETO to go to a specific location. Or, you can enter a world in global mode by creating a new instance there with the @newinstance function, and specifying global mode.
(Note that as of MB version 1.2, each bot instance has its own Nearby List. The TAG/UNTAG functions et al affect the list for the current instance only.)Do not confuse "tagging" with selecting for purposes of whispering; selected (highlighted) names in the Nearby List receive whispers, but tags (checkboxes) have no particular effect; tags are only a tool that you can use however you want when writing Magsbot programs, to keep track of names. Tags become visible on the Nearby List when you use the TAG, TAGALL or SHOWTAGS functions.
Nearby List with tag showing
TAG $name
TAG_ @session
UNTAG $name
UNTAG_ @session
TAGALL
TAGNONE
Tag names in the nearby list for whatever purpose.
SHOWTAGS
HIDETAGS
Show or hide tags (checkboxes) next to names in nearby listRESETNEARBY
Reset the index into the Nearby List to 0, for calls to $nearnext, $taggednext or $selnextFormerly called RESETLIST. The RESETLIST action now controls the index into variable lists instead.
EJECT $name @seconds
or
EJECT_ @session @seconds
Ejects the specified avatar for the specified number of seconds, assuming that the bot's owner has ejection rights.EJECTADD $ip @timelimit $comment ADDRESS
or
EJECTADD @comp @timelimit $comment COMPUTER
or
EJECTADD @id @timelimit $comment CITIZEN
Adds an IP, computer ID or citizen number to the Ejection List for a world. Time limit is the time+date in Unix format (see @ctime) when the individual will be allowed to reenter. The ADDRESS, COMPUTER or CITIZEN keyword at the end lets the EJECTADD command know which of the three kinds of specifiers you are using. If you are specifying IP address (the original form of the EJECTADD command), then the keyword is optional. The computer id or citizen number forms are new in version 3.0.EJECTDELETE $ip ADDRESS
or
EJECTDELETE @comp COMPUTER
or
EJECTDELETE @id CITIZEN
Removes an IP, computer ID or citizen number from the Ejection List for a world. The ADDRESS, COMPUTER or CITIZEN keyword at the end lets the EJECTDELETE command know which of the three kinds of specifiers you are using. If you are specifying IP address, then the keyword is optional. The computer id or citizen number forms are new in Magsbot version 3.0.EJECTLOOKUP $ip ADDRESS
or
EJECTLOOKUP @comp COMPUTER
or
EJECTLOOKUP @id CITIZEN
Requests ejection info for a particular ID. Call EJECTNEXT repeatedly to find all the names on the ejection list. The info will be returned in a EJECTINFO event. See EJECTADD, EJECTDELETE.EJECTNEXT $ip ADDRESS
or
EJECTNEXT @comp COMPUTER
or
EJECTNEXT @id CITIZEN
Requests ejection info for the next ID in an EJECTLOOKUP. The info will be returned in a EJECTINFO event.EJECTPREV $ip ADDRESS
or
EJECTPREV $ip COMPUTER
or
EJECTDELETE $ip CITIZEN
Requests ejection info for the previous ID in an EJECTLOOKUP. The info will be returned in a EJECTINFO event.
UNIVEJECTADD, UNIVEJECTDELETE, UNIVEJECTLOOKUP, UNIVEJECTNEXT, UNIVEJECTPREV
These commands world the same as the aforementioned EJECT* commands, except at the universe level. They can only be performed by an instance owned by citizen 1. NOTE: Since I don't have a universe, I haven't been able to test these. Use at your own risk!
AVTELEPORT $name $world
or
AVTELEPORT $name $world @ns @we @alt @yaw
or
AVTELEPORT_ @session $world
or
AVTELEPORT_ @session $world @ns @we @alt @yaw
Teleports the specified avatar to the specified world and optionally the specified coordinates.AVWARP $name @ns @we @alt @yaw
or
AVWARP_ @session @ns @we @alt @yaw
Warp the specified avatar to the specified coordinates.AVSET $name @type @gesture
or
AVSET_ @session @type @gesture
These commands, introducted in Magsbot version 3.1, are used to forceably change an avatar's properties. If you want to change type and gesture, you can specify these directly using the optional arguments. The optional arguments exist mainly for backward compatibility; as of version 7.3.17, you can instead use the various AVSET* functions, listed below, to change avatar properties individually.
AVSET and AVSET_ can also be used with no arguments to change any avatar properties selectively. Before calling AVSET with no arguments, set AVATAR_SET_FLAGS to any combination of: 1=position, 2=type, 4=gesture or 8=state. For example to change position and gesture but not type or state:
awint avatar_z=100;In version 7.3.17, an easier way to change just one avatar property is to use one of the following AVSET* commands:
awint avatar_x=50;
awint avatar_y=0;
awint avatar_yaw=1800;
awint avatar_gesture=3;
awint avatar_set_flags=1+4;
avset_ @avsession;
AVSETTYPE $name @type
Forceably set the specified avatar to the specified type.
AVSETTYPE_ @session @type
Forceably set the specified avatar to the specified type.
AVSETGESTURE $name @gesture
Forceably set the specified avatar to the specified gesture.
AVSETGESTURE_ @session @gesture
Forceably set the specified avatar to the specified gesture.
AVSETSTATE $name @state
Forceably set the specified avatar to the specified state.
AVSETSTATE_ @session @state
Forceably set the specified avatar to the specified state.
Avatar states:
0=WALKING
1=RUNNING
2=FLYING
3=SWIMMING
4=FALLING
5=JUMPING
6=WARPING
7=RIDING
8=SLIDING1
9=SLIDING2
10=SLIDING3
11=CLIMBING
AVSETPOSITION $name @z @x @y @yaw
Forceably set the specified avatar to the specified position.
AVSETPOSITION_ @session @z @x @y @yaw
Forceably set the specified avatar to the specified position.
AVCLICK $name
or
AVCLICK_ @session
Simulates someone clicking on the specified avatar.
(See here for general information about zones.)
ZONE $name @north @south @east @west @bottom @top(See also zone-related functions and events.)
Define a zone and make it active. Bottom and Top are optional. If Bottom is specified but not Top, then Top is assumed to be 10m above Bottom.ZONE_ $name @north @south @east @west @bottom @top
Define a zone but leave it inactive. Bottom and Top are optional. If Bottom is specified but not Top, then Top is assumed to be 10m above Bottom.UNZONE $name
Destroy a zone.ZONECHECKING @cond
Set default zone checking for new instances.ZONECHECKING_ @cond
Set zone checking for the current instance.ZONEACTIVE @cond
ZONEPRIORITY @priority
Set a zone to active (1) or inactive (0).
Set a zone's priority. When zones overlap, the zone with the higher priority setting will determine which zone takes precedence. (New in version 7.4.6)ZONEGROUP $zone $group
Give a group name to the zone. (This allows you to use different zones for different purposes.)
The variable name can be a constant or a string variable itself. You can also use the short form of assignment; see Notes on variable assignment.
ASN $var=@value
Assign numeric value, e.g. ASN x=12.ASNS $var=$text
Assign string value, e.g. ASN x="testing".These operate the same as ASN an ASNS, except globally instead of locally:
GLOBAL $var=@value
Assign global numeric value, e.g. GLOBAL x=12.GLOBALSTR $var=$text
Assign global string value, e.g. GLOBALSTR x="testing".
LOADVARS $filename
Loads variables from a file, erasing current variables in memoryMERGEVARS $filename
Loads variables from a file, merging them with current variables in memorySAVEVARS $filename
Saves variables to a fileDEFER { act }
Delays repacking of the behavior table and custom buttons until the end of the DEFER clause. Use this whenever you need to issue several FREE* commands (see below) at the same time. (Version 4.0)Technical stuff: In earlier versions of Magsbot, variables were referenced by name, so that the program needed to search through the entire global variable list each time it had to find the value of a variable. In Magsbot 4.0, global variables are referenced by name only on the first call, after which the pointer to the variable is saved and the variable referenced by pointer, which is much faster. The downside to this is that whenever a variable is freed (see various FREE* commands below), the behavior table and all custom buttons must be searched through for any references to that variable, and those references set to nil, so the program won't try to reference a variable that no longer exists. If many FREE* commands are issued together, the repacking process occurs repeatedly, once for each FREE* command, and this can cause a noticable delay of several seconds. The DEFER command causes the repacking process to be delayed until the end of the DEFER clause, then performs repacking only once.
FREEVAR $varname
Frees a single variable from memoryFREEVARS $prefix
Frees all variables with specified prefix from memory; frees ALL variables if no $prefix is given.FREELIST $list
Similar to FREEVARS, but using a string list name instead of var prefix. FREELIST somename is the same as FREEVARS "$somename:"FREELIST_ $list
Similar to FREEVARS, but using a numeric list name instead of var prefix. FREELIST_ somename is the same as FREEVARS "@somename:"FREEITEM $list @n
Frees item number @n from string list $list. FREEITEM somename 7 is the same as FREEVAR "$somename:7"FREEITEM_ $list @n
Frees item number @n from numeric list $list. FREEITEM_ somename 7 is the same as FREEVAR "@somename:7"ENLIST $list $item
Adds $item to string list $list, assigning it a number automatically.ENLIST_ $list @item
Adds @item to numeric list $list, assigning it a number automatically.SETITEM $list @n $item
Sets the value of item @n of string list $list to the value $itemSETITEM_ $list @n @item
Sets the value of item @n of numeric list $list to the value @itemRESETLIST
Resets the list index for $nextitem, @nextitem functions. Formerly this was used to reset the index of the Nearby List for similar purposes, but that function has been renamed RESETNEARBY.RESETLIST_
Same as RESETLIST above, except for use with numeric instead of string lists.
List File I/ONOTE: There are three different sets of functions for reading and writing lists from to and to text files. One set for standard lists and list files, one for object lists and object list files, and one for object lists and propdump files.
GET- and MERGE- functions read from a text file, SAVE- and APPEND- functions save to a text file.
-LIST functions are used with standard lists. The list item numbers are not saved to file, and when being read in, the item numbers are generated sequentially starting with 1.
Example:-OBJLIST functions are used with object lists. The list item numbers represent object numbers and are saved to the file as a comma-delimited field that preceeds the list item (object data). When read in, the first comma-delimited field is used for the list item number.File:
apple
banana
cherry
dateList in memory:
$n:1=apple
$n:2=banana
$n:3=cherry
$n:4=dateExample:-PD (propdump) functions are used to read and write between object lists in memory and propdump files.File:
598193,-2215,1418,-400,975,"dolphin4","","create rotate -4",28777,984101073
598209,243,2094,80,2745,"dock8","","",120974,980558983
598212, 47,2752,30,2625,"tiki1","","create name t",120974,996360751
598324,1556,-1567,-75,-555,"pflower01","","",28777,986929457List in memory:
$n:598193=-2215,1418,-400,975,"dolphin4","","create rotate -4",28777,984101073
$n:598209=243,2094,80,2745,"dock8","","",120974,980558983
$n:598212=47,2752,30,2625,"tiki1","","create name t",120974,996360751
$n:598324=1556,-1567,-75,-555,"pflower01","","",28777,986929457Example:File:
120974 929752872 135 -35 749 150 5 0 0 tiki1
120974 941563258 830 40 976 2400 8 0 31 stnarch1bump warp 11.0N 3.4E -0.0a 270
28777 904506110 447 -20 276 -1785 5 23 11 sign1to Dock of the Bay Cafecreate sign
120974 929245437 292 -140 665 2400 4 0 0 dockList in memory:
$n:1= 749,135,-35,150,"tiki1","","",120974,929752872
$n:2= 976,830,40, 2400,"stnarch1","","bump warp 11.0N 3.4E -0.0a 270",120974,941563258
$n:3= 276,447,-20,-1785,"sign1","to Dock of the Bay Cafe","create sign",28777,904506110
$n:4= 665,292,-140,2400,"dock","","",120974,929245437
GETLIST $filename $listname
Reads a text file into memory as a numbered list of string variables. Item numbers are generated sequentially.MERGELIST $filename $listname
Adds a text file to a numbered list of string variables in memory. Item numbers are generated sequentially.SAVELIST $filename $listname
Saves a numbered list of string variables to a text file, in order of item number.APPENDLIST $filename $listname
Appends a numbered list of string variables to a text file, in order of item number.
GETOBJLIST $filename $listname
Reads an object list file into memory as a numbered list of string variables. The item numbers are taken from the the first comma-delimited field of each line in the file. (Note that this has changed in version 2.0. The functionality of the previous GETOBJLIST command is now contained in GETLISTFROMPD.)MERGEOBJLIST $filename $listname
Adds an object list file to a numbered list of string variables in memory. The item numbers are taken from the the first comma-delimited field of each line in the file. (Note that this has changed in version 2.0. The functionality of the previous MERGEOBJLIST command is now contained in MERGELISTFROMPD.)SAVEOBJLIST $filename $listname
Saves a object list to a text file, in order of item number. The item numbers are prefixed to each line of the file as a comma-delimited field. (This is new in version 2.0.)APPENDOBJLIST $filename $listname
Appends an object list of variables to a text file, in order of item number. The item numbers are prefixed to each line of the file as a comma-delimited field. (This is new in version 2.0.)
GETLISTFROMPD $filename $listname
Reads a propdump file into memory as a numbered list of string variables. Item numbers are generated sequentially.
(This is new in version 2.0.)MERGELISTFROMPD $filename $listname
Adds a propdump to a numbered list of string variables in memory. Item numbers are generated sequentially.
(This is new in version 2.0.)SAVELISTTOPD $filename $listname
Saves a numbered list of string variables to a text file, in order of item number. Item numbers are discarded since propdumps don't contain object numbers. (This is new in version 2.0.)APPENDLISTTOPD $filename $listname
Appends a list of variables to a text file, in order of item number. Item numbers are discarded since propdumps don't contain object numbers. (This is new in version 2.0.)
STORE @list $field=$value
Store a string value in a user-created variable list. User-created variable lists are created using the @vlist function. The list is automatically freed when the variable its assigned to is freed.STORE_ @list $field=@value
Store a numeric value in a user-created variable list.SORTVLIST @list @byname
Sort a variable list. If optional @byname is 1, then items are sorted by name, otherwise they're sorted by value.VLISTNAME @list $name
Gives a name to a vlist that you can use for purposes of identification. The name can be retrieved using the $vlistname function.SHOWVLIST @list
Causes a dialog similar to the global variable list window to appear, showing the contents of the user-created variable list. (Unlike the global variable list window, the user-created variable list window is a "snapshot" that does not update itself continually.)FREEVLIST @list
Free a user-created variable list.FREELVAR @list $varname
Free a variable from a user-created variable list. Note that $varname must be the full name of that variable including the @ or $.FREELVARS @list $prefix
Free variables with the specified prefix from a user-created variable list. Note that $prefix must begin with a @ or $.GETLIST_ $filename @vlist
Reads a text file into a vlist. Item numbers are generated sequentially.MERGELIST_ $filename @vlist
Merges a text file into a vlist. Item numbers are generated sequentially.SAVELIST_ $filename @vlist
Saves a vlist to a text file.APPENDLIST_ $filename @vlist
Appends a vlist to a text file.
GETOBJLIST_ $filename @vlist
Reads a text file into a vlist using item numbers from the file.
MERGEOBJLIST_ $filename @vlist
Merges a text file into a vlist using item numbers from the file.SAVEOBJLIST_ $filename @vlist
Saves a vlist to a text file, including item numbers.
APPENDOBJLIST_ $filename @vlist
Appends a vlist to a text file, including item numbers.GETLISTFROMPD_ $filename @vlist
Reads a propdump file into a vlist. Item numbers are generated sequentially.MERGELISTFROMPD_ $filename @vlist
Merges a propdump file into a vlist. Item numbers are generated sequentially.SAVELISTTOPD_ $filename @vlist
Saves a vlist to a propdump file.APPENDLISTTOPD_ $filename @vlist
Appends a vlist to a propdump file.
Also see VList-related functions, and an explanation of VLists in general, here.
These assign values to AW attributes by name and cause the changes to take effect immediately:
SETVAL $awattrib=@value
SETSTR $awattrib=$text
(For example: SETSTR OBJECT_MODEL="tree7m.rwx")
These assign values to AW attributes by attribute number and cause the changes to take effect immediately:
SETVAL_ @n @value
SETSTR_ @n $text
(Using the attribute number)
These assign values to AW attributes by name, but SETSTATE must be called before the changes take effect:
AWINT $awattrib=@value
AWFLOAT $awattrib=@value
AWSTR $awattrib=$value
These assign values not to actual AW attributes, but to data sent to the behavior table. Used with the EVENT command. New in version 6.6.15.
AWINT_ $awattrib=@value
AWFLOAT_ $awattrib=@value
AWSTR_ $awattrib=$value
These assign values to data sent to the behavior table, as do AWINT_, AWFLOAT_ and AWSTR_ above. However these commands allow you to arbitrarily set attributes of any name, not just valid AW attributes. You could therefore use these to set values of such non-SDK attributes as @userevent, etc. Used with the EVENT command. (Note MBNUM is used to assign either integers or floats.) New in version 6.6.15
MBNUM $attrib=@value
MBSTR $attrib=$value
SETSTATE
Causes the current values of AW attributes (set by using AWINT, AWFLOAT or AWSTR) to take effect.
RESETWORLDATTRIBS
Resets the world to it's original attributes, if the bot's owner is a world is a caretaker.
WORLDRELOADREGISTRY
Reloads the world registry.
SETWORLDATTRIB @n $value
Sets a world attribute by the specified atdump number (not the AW attribute number!).WORLDATTRCHANGE
Changes the attributes of the world the bot is in, according to the current values of world-related AW attributes. (You would typically set the world attibutes first using AWINT and AWSTR, then call WORLDATTRCHANGE to cause the new settings to be actualized in the world. Example: AWINT WORLD_FOG_ENABLE=1; AWINT WORLD_FOG_MINIMUM=200; AWINT WORLD_FOG_MAXIMUM=300; WORLDATTRCHANGE.)
UNIVATTRCHANGE
Changes the attributes of the universe the bot is in, according to the current values of universe-related AW attributes. (You would typically set the universe attibutes first using AWINT and AWSTR, then call UNIVATTRCHANGE to cause the new settings to be actualized in the world. Example: AWSTR UNIVERSE_WORLD_START="MyWorld" ; UNIVATTRCHANGE.) This command can only be performed by a bot instance belonging to citizen number 1. NOTE: since I don't own a universe, I have no way of testing this command, so use it at your own risk!
Commands below in purple can only be performed by an administrative instance.
ADMINWORLDADD
Creates a new world on the world server. Before calling this command, use AWINT and AWSTR to set the various AW attributes that will be applied to the newly-created world. (See the SDK help for details.)
ADMINWORLDDELETE @id
Deletes the world from the server. The world id is the index of the world in the list of worlds on the server, with the first world being index 0.
ADMINWORLDCHANGE @id
Changes the attributes of the world with the specified id. The world id is the index of the world in the list of worlds on the server, with the first world being index 0. Before calling this command, use AWINT and AWSTR to set the various AW attributes that will be applied to the newly-created world. (See the SDK help for details.)
ADMINWORLDLIST
Causes the server to transmit a list of worlds and their data, in the ADMINWORLDINFO event. When all the data has been transmitted, the ADMINWORLDLISTDONE event will occur. See the SDK Help for details regarding what information is given.
ADMINWORLDSET @id
Selects the world that commands will be applied to. The world id is the index of the world in the list of worlds on the server, with the first world being index 0.
ADMINWORLDSTART @id
Starts a world that has been stopped. The world id is the index of the world in the list of worlds on the server, with the first world being index 0.
ADMINWORLDSTOP @id
Stops the operation of a world on the server, without actually deleting it. ADMINWORLDSTART can be used to restart the world. The world id is the index of the world in the list of worlds on the server, with the first world being index 0.
These Actions cause CLOCKTICK events to be generated. "N"=timer number, an integer used to identify the timer. Within the CLOCKTICK event, @timer will be set to the ID of the timer that caused the CLOCKTICK. "Interval" is in microseconds.
STARTTIMER @n @intervalSTOPTIMER @n
NOTE: Object numbers should be specified in signed number format, or use the @int function to convert unsigned object numbers to signed.
The old OBJECTADD, OBJECTLOAD and OBJECTCHANGE
commands were phased out with Magsbot version 3, since they don't allow
you to know the object number of
the newly created or changed object. The @objectadd,
@objectload,
and @objectchange
functions should be used instead. The OBJECTADD, OBJECTLOAD and
OBJECTCHANGE
commands
will still work for backward compatibility, but they don't support tilt
and roll, or special objects, and are discouraged.
In
Magsbot 7 (for AW 4.1), the @objectadd_, @objectload_ and
@objectchange_ (names with underscores) that were added in Masbot 3
have been removed and the @objectadd, @objectload and @objectchange
functions have been updated to include tilt and roll in the appropriate
place in the argument list, as the "underscored" functions did. The
object creation functions also have two new optional arguments to
support special objects available in AW 4.1.OBJECTADD @ns @we @alt @yaw $model $desc $action |
Note the versions of the commands below that use object id
instead of object number are new in Magsbot 7.x (AW 4.1).
Note: in the SDK, before calling aw_object_click, aw_object_select or aw_object_bump you must set AW_OBJECT_SYNC=1 if you want the event to be globally detectable. Magsbot does this automatically in the OBJECTCLICK, OBJECTCLICK_, OBJECTSELECT, OBJECTSELECT_, OBJECTBUMP and OBJECTBUMP_ commands, but I thought you might like to know since there is no documentation that I'm aware of concerning this.. :)
OBJECTDELETE @object_number @ns @we
OBJECTCLICK @object_number @ns @we
OBJECTDELETE_ @object_id 0 0
Deletes the object. OBJECTDELETE (no underscore) uses the object number, and OBJECTDELETE_ (with an underscore) uses object ID instead. The object location is unimportant in the case of OBJECTDELETE_ and I will be removing those arguments in the next version of Magbot (version 7.3.15 or 7.4). NOTE: OBJECTDELETE_ (using object id) does not work as of SDK build 63. You can use OBJECTDELETE (using object number) instead.
OBJECTCLICK_ @object_id 0 0
Simulates the bot clicking on an object. OBJECTCLICK (no underscore) uses the object number, and OBJECTCLICK_ (with an underscore) uses object ID instead. The object location is unimportant in the case of OBJECTDELETE_ and I will be removing those arguments in the next version of Magbot (version 7.3.15 or 7.4).OBJECTSELECT @object_number @ns @we
OBJECTSELECT_ @object_id 0 0
Simulates the bot selecting an object. OBJECTSELECT (no underscore) uses the object number, and OBJECTSELECT_ (with an underscore) uses object ID instead. The object location is unimportant in the case of OBJECTSELECT_ and I will be removing those arguments in the next version of Magbot (version 7.3.15 or 7.4).
OBJECTBUMP @object_number @ns @we
BUILD @ns_offset @we_offset @alt_offset $propdump @delay
OBJECTBUMP_ @object_id 0 0
Simulates the bot bumping an object. OBJECTBUMP (no underscore) uses the object number, and OBJECTBUMP_ (with an underscore) uses object ID instead. The object location is unimportant in the case of OBJECTBUMP_ and I will be removing those arguments in the next version of Magbot (version 7.3.15 or 7.4).
Build from a propdump file.LOAD @ns_offset @we_offset @alt_offset $propdump @delay
Build from a propdump file. The difference between BUILD and LOAD is only that LOAD creates objects using the creator ID and timestamp values from the propdump file, whereas BUILD uses the bot's owner and current time. Also see the @objectload function.DELETEALLOBJECTS
Deletes all objects in the current world, if the bot's owner is a world caretaker. Needless to say, use this one with extreme care!RELOADREGISTRY
Reload the world registry, if the bot's owner is a world is a caretaker.SETBUILD3AXIS @cond
Sets the Options/Include Tilt,Roll in Build menu item. When this is checked, the BUILD and LOAD commands will expect tilt and roll values to be in the propdump file, and will use those values when creating objects. (New in version 3.0.)
FCLOSE @handle
Closes the file with the specified handle.WRITE @handle $s @appendEOL
Writes a string $s to the file with the specified handle. The handle is obtained from the @fopen function. The third argument, @appendEOL, is optional and specifies whether or not an End-Of-Line (carriage return) should be added to the string. The default for @appendEOL is 1 (true), so if the third argument is omitted, then an EOL will be added.All of the other commands in the File I/O and Management section are new as of version 4.1 b26:
FDELETE $fname
Deletes the specified file.FRENAME $oldfname $newfname
Renames the specified file.CREATEDIR $path
Creates a new folder.SETDIR $path
Sets the current working directory.FINDFIRST @vfileinfo $path @attr
FINDNEXT @vfileinfo
Searches a folder and returns file information. In order to use this command, you must first create a user-created variable list (VList) to hold the information, using the @vlist function. The vlist will receive the file information when FINDFIRST or FINDNEXT are called.The $path argument specifies the path to search and can contain wildcard characters "*" and "?".
The @attr argument specifies the kind of files to search for:
1 Read-only filesThe numbers can be combined to search for files with two or more characteristics, for instance 1+2 to search for hidden, read-only files.
2 Hidden files
4 System files
8 Volume ID files
16 Directory files
32 Archive files
63 Any fileAfter calling FINDFIRST, the vlist will contain the following information that you can retrieve using the @lv_ or $lv_ functions:
@result the result of the search,For instance, if the vlist is @v, then $lv_[@v,name] would contain the name of the file that was found by the search. The @lv_[@v,attr] value contains information about the file using the same numbers as the @attr argument passed to the FINDFIRST command. Thus you can check if a particular file matches a certain characteristic using the bitwise AND operator "&", for instance if @lv_[@v,attr] & 2 is true, then the file is a hidden file.
0 if a matching file was found, or a negative number (Windows error code) otherwise
@date the file date
@size the file size
@attr the file characteristics (see below)
$name the name of the file that was found by the searchAfter FINDFIRST returns information about the first file that matches the specified criteria, you can call FINDNEXT repeatedly until @lv_[@v,result] is 0. Then you should use the FINDCLOSE command to end the process. Also don't forget to use FREEVLIST to free the vlist that you created to hold the results.
FINDCLOSE @vfileinfo
Ends the file search process begun using FINDFIRST and continued using FINDNEXT.
The following example of how to use FINDFIRST, FINDNEXT and FINDCLOSE causes the name, date and size of all files in the current directory to be reported in the Magsbot log window: @v=@vlist;
FINDFIRST @v "*.*" 63;
WHILE @lv_[@v,result]=0 {
REPORT $fmt["%s: %s, %s bytes",$lv_[@v,name],$date[@lv_[@v,date]],@lv_[@v,size]];
FINDNEXT @v };
FINDCLOSE @v;
FREEVLIST @v
Associated Functions (see the File IO section):
CALLDLL $dll $func $arg
Calls the specified function within the specified DLL, passing the specified string argument. The DLL/function name must already be loaded when MB starts; see DLLs for details.CALLDLLV $dll $func @arg
Calls the specified function within the specified DLL, passing the specified vlist to the DLL. The DLL/function name must already be loaded when MB starts; see DLLs for details.
RUNEXE $exe $args
Run a program. E.g. RUNEXE "notepad.exe" "userdefs.udf" calls notepad to edit the user-defined functions file.
In the following Actions, @State=1 for ON, 0 for OFF.
SETLOG $filename @appendLOGCHAT @state
LOGEVENTS @state
BEHAVIORSACTIVE @state
Turn Behavior Table on/offVERBOSE @state
Set verbose modeSHOWBOTMOVES @state
Sets "Show Bot Movements" menu itemSHOWAVMOVES @state
Set "Show Nearby Avatar Movement" menu itemSHOWARRIVEDEPART @state
Sets "ShowAvatar Arrivals & Departures" menu itemSHOWCLICKS @state
set "Show Clicks" menu item
HUDCLICK
Simulates a HUD click. (Set HUD_ELEMENT_ID before calling.)
Sorry I can't find more documentation on how the aw_hud_click function in the SDK works, but I assume you set the id and perhaps the HUD_ELEMENT_X, _Y and _Z.
HUDCREATE
Creates a HUD. Before using the command, you should set the various attributes that define the HUD:
AWINT HUD_ELEMENT_ID=1;
AWINT HUD_ELEMENT_SESSION=@avsession;
AWINT HUD_ELEMENT_TYPE=@hud_type_text;
AWSTR HUD_ELEMENT_TEXT="some text to display";
REM ................................;
REM set position;
AWINT HUD_ELEMENT_ORIGIN=@hud_origin_top_left;
AWINT HUD_ELEMENT_X=1;
AWINT HUD_ELEMENT_y=1;
AWINT HUD_ELEMENT_z=0;
REM ................................;
REM set flags, color, opacity;
AWINT HUD_ELEMENT_FLAGS=@hud_flag_stretch|@hud_flag_clicks|@hud_flag_size_percent;
AWINT HUD_ELEMENT_COLOR=@dec["0000ff"];
AWFLOAT HUD_ELEMENT_OPACITY=0.9;
REM ................................;
REM set size;
AWINT HUD_ELEMENT_SIZE_X=100;
AWINT HUD_ELEMENT_SIZE_y=100;
AWINT HUD_ELEMENT_SIZE_z=0;
REM ................................;
REM set offset;
AWINT HUD_ELEMENT_TEXTURE_OFFSET_X=0;
AWINT HUD_ELEMENT_TEXTURE_OFFSET_Y=0;
HUDCREATE;
The following defines are in the
macros file (userdefs.udf) for you to use in your code:
for HUD_ELEMENT_TYPE:
@hud_type_text
@hud_type_image
@hud_type_model
for
HUD_ELEMENT_FLAGS (can be combined using | the bitwise OR operator)
@hud_flag_clicks
@hud_flag_stretch
@hud_flag_additive
@hud_flag_size_percent
@hud_flag_transition
@hud_flag_temporary
@hud_flag_universe_path
@hud_flag_clamp
@hud_flag_highlight
for HUD_ELEMENT_ORIGIN:
@hud_origin_top_left
@hud_origin_top
@hud_origin_top_right
@hud_origin_left
@hud_origin_center
@hud_origin_right
@hud_origin_bottom_left
@hud_origin_bottom
@hud_origin_bottom_right
HUDDESTROY @session @id
Destroys a HUD.
HUDCLEAR @session
Clears the HUDs for a particular session.
CAVREQUEST @cit @session
Request CAV info, returned in CAV event.
CAVDELETE @cit @session
Deletes CAV.
CAVCHANGE @cit @session @definition @length
Changes CAV using specified data.
WORLDCAVREQUEST @cit @session
Request world CAV info, returned in CAV event.
WORLDCAVDELETE @cit @session
Deletes world CAV.
WORLDCAVCHANGE @cit @session @definition @length
Changes world CAV using specified data.
BOTMENU @session $questions $answers
Sets up a menu that will appear when the bot's avatar is right-clicked.You need to first create a text file containing the menu items, one to a line, and then put it on the OP for the world that the bot will be operating in. The address of the bot menu file is set in WORLD_BOTMENU_URL.
Next send the menu to a given person in the world using the BOTMENU command, like
BOTMENU @avsession "2 4 7" ""
When that person clicks on the bot, they will see a menu containing lines 2, 4 and 7 of the botmenu file. When the person selects an item from the menu, it generates a BOTMENU event.
Using these Actions, MB can actually program itself! (Also see @behcount, @behstate, $event and $action functions.)
LOADBEHAVIOR $filename
SAVEBEHAVIOR $filename
MERGEBEHAVIOR $filename
CLEARBEHAVIOR
CLEARBUTTONS
These have the same effect as the corresponding File menu items.ADDBEHAVIOR @state $event $action
Adds a row to the Behavior Table. Each argument contains the value for a column of the Table.INSERTBEHAVIOR @row @state $event $action
Inserts a row to the Behavior Table at the specified row. The other arguments each contain the value for a column of the Table.DELETEBEHAVIOR @row
Deletes a row of the Behavior Table.SETBEHAVIOR @row @state $event $action
Changes a row to the Behavior Table at the specified row. The other arguments each contain the value for a column of the Table.
(Buttons are numbered beginning with 0 indicating the first button on the Actions Panel.)ADDCATEGORY $name
Add a category tab to the Action buttons panel.DELETECATEGORY $name
Remove a category tab to the Action buttons panel.
(Note: this was previously listed here incorrectly as DELCATEGORY. Fixed in version 7.6.8.)SAVECATEGORY $name $file
Save the buttons in one category to a file.
ADDBTN $label $act
Add a button with $label and assign Action string $act to it.DELBTN $label
Delete a button with $labelSETBTN $label $action
Find button with label and set action as specifiedSETBTN_ @n $label $action
Set the label and action for button number @nCLICKBTN $label
Trigger the Action assigned to button with label $lbl. (See also PROC and the @proc and $proc functions.)SAVEBTN @n $filename
Save button number @n to file $filename.SAVEBTNS $filename
Save all buttons to file $filename.MERGEBTN $filename @edit_on_error
Merge button(s) in file $filename with existing buttons. The optional @edit_on_error parameter, new in version 4.2 b4, specifies if the edit window should pop up automatically to allow changes, if there is an error in the button code. (The default is 0, thus the edit window will not automatically pop up. This is a change from previous versions where the edit window would always pop up if there was an error.) Whether the edit window automatically pops up or not, an error message will appear if the button code is bad.