Various commands allow user input and output of data.
User input may be achieved by calling an input form. The syntax is:
Input $title $comment $default $buttonThe form caption is set by the contents of $title, a comment is set with $comment, $default is a default input string and $button defines the text on the exit button.
Input shows the input text on the form, InputSecret shows * symbols (use for inputting passwords).
The input string may be collected in a string variable with the following statement:
GetInput $a
[Head] Type=Script Version=2.0 [Settings] Origin=0.000n 0.000w 0.00a 0.0° [Script] Input "Input" "Type in what the bot must say:" "Hi all of you!" "Ok" GetInput $a Say $a End |
[Head]
Type=Script
Version=2.0
[Settings]
Origin=0.000n 0.000w 0.00a 0.0°
[Script]
$a = ''
%b = 0
OnInputEvent MyInput
InputSecret "Input" "Type in your privilege password:" "" "Done!"
label loop
# the code in this loop will be executed
# until the form closes
# and the event is triggered
ifInt %b = 0 goto loop
# here some more code that uses the password
# for instance to log in the bot
# make sure the bot is not logged in
Void
# set the necessary data
UniverseData "Active Worlds" "" 0
CitizenData 289499 "XelaG" $a
BotName "MyBot"
@w = "20n 5w 0a 90: xelagon"
# log in
Warp @w
End
Event MyInput
GetInput $a
%b = 1
EndEvent
|
Any code following an Input or InputSecret statement in an event handler is ignored. These statements must always be the last ones if used within an event handler. There are 2 solutions for retrieving the input string:
User output has the following statements:
| UserMsg $a | Opens a message window and prints string $a in bold letters. |
| UserMsgHigh $a | Opens a message window, prints string $a in bold letters and changes the icon to a flashing icon. The icon will stop flashing when you click on the window. |
| UserMsgLow $a | Opens a message window and prints string $a in normal letters. |
| UserMsgOpen | Opens an empty message window. |
| UserMsgClose | Closes the message window. Normally, this will be done by the user by clicking on the 'close' icon, not using this statement. |