Xelagot action script

Events: JoinComplete, WalkComplete

Refer to Events for general information.


This event is triggered when the bot has finished executing a IfGotoPerson statement, or gets within reach of a person for the first time in a IfJoinPerson, IfJoinFacePerson or IfFollowPerson statement. This event will not be triggered if the target person leaves before the bot arrives: this situation must be taken care of in AvatarDelete event. But if the target returns, and the bot is still targetting it, the event can still be triggered.

Installer: OnJoinCompleteEvent <eventlabel>
Event type: 5200


This event is triggered when the bot has finished executing a Walk statement 'normally', that is, the Walk ends properly on its own account without being cancelled. For example, a Stop statement, or a new Walk statement issued in an event handler cancel a Walk and do not allow this event to be triggered. PauseWalk and ResumeWalk do not cancel a Walk.

Installer: OnWalkCompleteEvent <eventlabel>
Event type: 5100

Specific statements (must be inside this event handler):

GetEventType %a stores the event type code in variable %a
GetEventResult %a stores the event result code in variable %a.
GetMessage $a stores the tag specified when starting a walk. Used only in WalkComplete, not in JoinComplete.

This example uses similar code to the one in AvatarScan event example, but instead of using the To statement, it uses Walk. It also illustrates how to use the message set in the Walk statement to execute an action in the WalkComplete event


Origin=0.000n 0.000w 0.00a 0.0°

  @a = 2n 2w 0a
  @b = 2n 0w 0a
  @c = 2n 1.5w 0a
  %r = 5.0
  Step 1.5
  $x = "SayConcat @z"
  OnAvatarScanEvent AvScan
  OnAvatarScanCompleteEvent AvScanned
  OnWalkCompleteEvent WaCom
Label Start

Label First
  $N = "Second"
  @z = @a
  Walk @z : $x
Label FirstLoop
  Goto FirstLoop
Label Second
  $N = "Third"
  @z = @b
  Walk @z : $x
Label SecondLoop
  Goto SecondLoop

Label Third
  $N = "First"
  @z = @c
  Walk @z : $x
Label ThirdLoop
  Goto ThirdLoop

  Goto Start


Event WaCom
  GetMessage $g
  Do $g
  %x = -1
  Scanav %r

Event AvScan
  # the avatar
  GetAvatarPerson &p
  # the bot
  GetPerson &b
  # %d = distance between bot and avatar
  Distance %d &b &p
  IfReal %x < 0 Goto AvScan1
  Else IfReal %d < %x Goto AvScan1
Label AvScan1
  %x = %d
  &x = &p

Event AvScanned
  # no one meets requirement? carry on walking...
  IfInt %x < 0 SayConcat "No-one here..."
  IfInt %x < 0 EscapeTo $N
  # otherwise... bingo!
  GetName $x &x
  WhisperConcat &x $x ", you are very near me :)"
  StringFromReal $d %x 2
  SayConcat $x " is " $d " metres away from me!"
  EscapeTo $N