 |
These functions and properties are unique to each event that is started.
Properties
Functions
property EventGroup = 0
Each event has an associated identification code, which is 0 unless otherwise set. It tells the group number of the event, and it can be used to refer to this event (also known as a thread, or instance of executuion), from within other concurrent events. The code has no inherent meaning, so it is up to the script programmer to decide.
NotesDo not use values greater than or equal to 1,000,000, since they are reserved by AGAST for use in the standard script libraries.
property KillOnExit = true
Causes the interpreter to kill this event or script automatically when the scene is exited, before the next scene is entered. Set this to false if you want an event to survive a change of scene.
NotesThis will terminate a whole event, not just the most recently-called script.
Exampleevent Match -> StickOfDynamite
{
"Ok, it's lit. I'll drop it right here."
dropItem(StickOfDynamite);
"Now I'd better get out!"
killOnExit = false;
delay 10000; // set timer
if currentScene == InsideMine {
enter ExplosionSequence;
}
else {
"Whew! I made it out of the mine in the nick of time!"
}
}
property ActiveObject = PlayerObject
This property represents the object which is currently being controlled by the script. Whenever a new event is started by the interpreter, the active object is set to the PlayerObject, and, when the script is started or called by another script, it takes the ActiveObject of the script that started or called it.
ExampleEGO: // is equivalent to:
ActiveObject = Ego;
function Finish
This kills the current event, effecting the whole chain of scripts that was called before it, all the way back to where the current event was started (by another script) or triggered (by the interpter). Think of it as a super-return, that returns not only from the current script, but from all the scripts Whereas an event may be "killed" by another executing event, the "finish" dentotes that the event finished on its own accord.
function KillEvents (EventGroupCode)
This function causes all events with a matching eventGroup codes to be killed.
Parameters
EventGroupCode | | The EventGroup code of the events to kill. |
ReturnsThe number of events that were killed (the death toll, you could say).
NotesThe caller is immune, meaning that even if the caller has a matching EventGroup code, it will not be killed.
function ClickX
If the event is triggered by the player clicking a point somewhere on the screen, this function returns the virtual x-coordinate. That is, unlike MouseX, it takes the ScrollX at the time of the click into consideration: ClickX = ScrollX + MouseX.
function ClickY
If the event is triggered by the player clicking a point somewhere on the screen, this function returns the virtual y-coordinate: ClickY = ScrollY + MouseY.
function SourceObject
Inventory code of item that was used to generate the event.
function TargetObject
If the event was triggered by the player clicking some item on an object, this will return the object that was clicked.
function SourceScene
Returns the index of the scene in which this event was triggered.
|