backIndex

Xelagot server/client

Bot Clients and action script

Script statements are subject to change while the Server/Client is in beta testing

Version 2.9999943

Bot Clients only work with action script statements. These statements are listed in detail in the ActionScript pages: Bot Client statements and Events: Bot Client handlers.

See Setting up a script connection.

Each bot has a Bot Client that connects to one Server application at a time. Before it can connect, the Bot Client must set the IP address and Port number of the remote listening Server, as well as the Login name and Password (if required by the remote server). This can be done in two ways:

These data must also be on the remote server's Server connection list for the bot, and the protocol mentioned there must be bot or, if the bot is to send CLWriteToBot or AnyWriteToBot messages, master.

The script must have event handlers installed to trap the Bot Client 'connect', 'login', 'message', 'answer' and 'disconnect' messages. These events are: CLConnect, CLLogin, CLMessage, CLHear, CLAnswer, CLConfirm, CLDisconnect. Other events which can occur: CLAdd, CLDelete and CLUnsent. For example, to install the CLLogin event handler, you could write:
# installer
OnCLLoginEvent CLLogin1

# event handler
Event CLLogin1
# code here
EndEvent

Within the handlers, the script gets information about what is going on, using statements like GetMessage $a in ClMessage.

To connect, send messages and disconnect, the script uses the following statements: CLConnect, CLWrite $n $a, CLWriteAll $a, CLDisconnect.
# somewhere before connecting:
# installer
OnCLMessageEvent CLMessage1

# in the events handler and sub section
# event handler
Event CLMessage1
   GetMessage $a
   IfString "bonnie" IsIn $a ClWrite "My bonnie lies over the ocean"
   Else ClWrite "dunno what you are talking about!"
   # ClWrite requires proper strings surrounded by "" or variables like $b
EndEvent


backIndex