Xelagot action script

Events: WorldAttributes

Introduced in X1 2.9999964, Av99/SrvcXlgbot 1.78.

Refer to Events for general information, and World attributes and rights for specific information on this topic.

WorldAttributes is triggered when the bot receives the list of world attributes from the world server. This happens when the bot enters a world, after a 'waiting for server' when the bot reconnects, when a Caretaker changes any of the attributes, and when a Caretaker deletes all objects using the 3.1 command aw_delete_all_objects. A caretaker bot can also for receipt of world attributes by setting them without changing any of them. See a 3.1 example below.


OnWorldAttributesEvent <eventlabel>
Event type: 6400

Specific statements (must be inside the event handler):

GetEventType %a stores the event type code in variable %a
GetEventResult %a stores the event result code in variable %a. Is always 0.

Example for a Caretaker bot. The new 3.1 world servers can tell the bot how many objects there are in the world. They do that with a world attribute, but this number becomes outdated as soon as an object is added or deleted. A caretaker bot can force a refresh in the following way (full working example). In this example, a command heard by the bot, "count objects", triggers a series of actions: the bot resets the world attributes (without changing them) in Sub Count, waits for the event to happen in Event WorldAttrib, and announces the final count (and as a bonus, the size of the world).


Origin=0.000n 0.000w 0.00a 0.0°

  # this script requires a caretaker bot in a 3.1 world 
  # (server build 30 or higher)
  OnChatEvent Chat
  OnWorldAttributesEvent WorldAttr
Label MainLoop
  Goto MainLoop


Event Chat
  GetChatline $a
  IfString "count objects" IsIn $a Gosub Count

Event WorldAttr
  WorldObjects %s
  WorldSize %z
  GetWorld $w
  SayConcat $w " has " %s " objects within these coordinates: " %z "n " %z "s " %z "w " %z "e."

Sub Count
  SayConcat "Please wait, counting objects..."
  GetWorld $w
  SetWorld $w