backIndex

Xelagot action script

Events: AvatarClick

Refer to Events for general information.

This event is triggered when an avatar (the source) left-clicks on another avatar (the target). The target avatar may or may not be within the perception range of the bot. In the latter case, only the session number is given by the world server. The program will attempt to recover the rest of the data from its own database. In the event handler, you must test whether the target is defined or not, and exit if it is not:
IfTargetUndefined Escape

Installer: OnAvatarClickEvent <eventlabel>
Event type: 500

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. 0 means success, other positive codes are equivalent to the rc codes of the SDK and the Windows codes. See SDK Error Codes.
GetSourceName $a The name of the avatar causing this event is stored in $a
GetSourceSession %a The session number of the avatar causing this event is stored in %a
GetSourcePerson &s The data of the avatar causing this event are stored in &s. This includes name and session number.
GetTargetName $a The name of the avatar clicked upon is stored in $a
GetTargetSession %a The session number of the avatar clicked upon is stored in %a
GetTargetPerson &t The data of the avatar clicked upon are stored in &t. This includes name and session number.
GetSourceTarget &s &t The data of both the source and the target are stored in &s and &t. This includes names and session numbers. ObjectClick and ObjectSelect use a similar syntax:
GetSourceTarget &s ~t
IfTargetDefined statement1
[Else statement2]
tests whether the target person is defined. If defined, executes statement1. Otherwise, optionally, executes statement2
IfTargetUndefined statement1
[Else statement2]
tests whether the target person is not defined. If not defined, executes statement1. Otherwise, optionally, executes statement2

An example... that only responds to avatar clicks from the boss...

[Head]
Type=Script
Version=2.0

[Settings]
Origin=0.000n 0.000w 0.00a 0.0°

[Script]
  OnAvatarClickEvent AvClick
Label LoopHere
  Goto LoopHere
End

Event AvClick
  IfTargetUndefined EndEvent
  GetSourcePerson &p
  IfPerson &p IsNotBoss EndEvent
  GetTargetPerson &t
  GetName $n &p
  GetName $t &t
  @t = &t
  LocMove3D @t 2 0 0
  LocTurn @t &t
  WarpLocal @t
  SayConcat $n " clicked on " $t " at " &t
EndEvent


backIndex