List of builtin events

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi all,


Would like to get a list of all available events. Maybe there's one around, but I couldn't get a hand on it...

To begin with, here are the events I know for sure for having used them, completed with the ensuing answers in this thread :

<OnAIUpdate>
- gSource = object that carries the item
- gItem = the item
The OnAIUpdate event for an item is called once every 30 ticks on every non-player ship that carries the item. Use this event to implement special behaviors. For example, an <OnAIUpdate> event on an armor patch item allows a non-player ship to use the armor patch when it is damaged.
Use this event sparingly because it will impact performance.

<OnAttacked>

<OnAttackedByPlayer>

<OnContractGenerate>

<OnContractQuery>

<OnCreate>
For systems, stations, ships, at object creation.

<OnDamage>
gSource = station object
aAttacker = object that attacked
aHitPos = vector position of hit
aHitDir = angle direction from which hit came
aDamageHP = hit points of damage
aDamageType = type of damage
This event is called when a station is hit by a weapon. The event must return the number of hit points of damage to do to the station. For example, imagine a station that takes half damage from the player (but full damage from all others). The event could check aAttacker and return half of aDamageHP if it is the player and full aDamageHP otherwise.
The event should avoid affecting other objects and should not destroy the station (e.g., by calling objDestroy). If necessary, the event could return a very large number to insure that the station is destroyed.

<OnDestroy>
gSource = ship object
- aDestroyer = object that caused destruction
- aWreckObj = ship wreck left behind
The <OnDestroy> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.

<OnEnteredGate>
gSource = station object
aGateObj = gate object
Version 0.99 uses aGateObj instead of aGate (as in previous versions) to be consistent with <OnObjEnteredGate>.

<OnGameEnd>
Found inside <AdventureDesc>

<OnGameStart>
Found inside <AdventureDesc>

<OnGlobalSystemCreated>
(no parameters)
For systems, all instances executed whenever a system is created.
This event is called after a system is created (right after <OnCreate> for the system). You may use this event to create new objects in the system or to otherwise alter the system. Remember that there is no guarantee that other systems have been created at this point.
Look at Huari.xml for an example of how this event is used.
Warning : multiple instances of this event can be created on multiple system types. They will ALL be called when ANY system is created, and their order can NOT be forecast.

<OnGlobalTopologyCreated>
(no parameters)
For topology, once when the topology is created.
This event is called at the beginning of the game right after the complete system topology has been generated. You may use this event to explore the topology and add data to topology nodes that may later be used inside systems. Remember that no systems have been created yet. You can only call functions that work on topology nodes.
For an example of how this event is used, look at Huari.xml.

<OnInvokedByPlayer>

<OnInit>
For dockscreens, when the dockscreen is shown.

<OnMining>
For asteroids.

<OnObjDestroyed>
- aWreckObj : the wreck left behind the destroyed object.
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
Is triggerred when an object A has registered for object B events and object B is destroyed. <OnDestroy> is fired on object B, and <OnObjDestroyed> is fired on object A.
0.99c : the <OnObjDestroyed> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.
See example on earth slaver.

<OnObjDocked>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
This was primarily used before <OnOrdersCompleted>.

<OnObjEnteredGate>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.

<OnObjJumped>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.

<OnObjReconned>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.

<OnOrderChanged>

<OnOrdersCompleted>
For ships, when all queued orders are completed.

<OnRefuel>

<OnShieldDown>

<OnShow>
When a communication menu messages is shown.

<OnUpdate>
- gSource = object that carries the item
- gItem = the item
The OnUpdate event for an item is called once every 30 ticks on every object that carries the item. Use this event sparingly because it will impact performance.

EDIT #1 : a little more, I added dvlenk6, F50 and bobby contributions. Thanks again !

EDIT #2 : What I'm trying to list are the builtin events, those which exist in the engine itself and that you can override or not in XML code. Extra events that are created from the XML itself don't interest me.

EDIT #3 : thanks Betelgeuse !

EDIT #4 : thanks digdug !

EDIT #5 : more insight on some events, thanks to digdug and to the modding page of the main Transcendence site.
Last edited by Mutos on Tue Nov 04, 2008 5:20 am, edited 12 times in total.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
dvlenk6
Militia Captain
Militia Captain
Posts: 519
Joined: Sun Mar 05, 2006 6:56 am
Location: Sanctuary and beyond
Contact:

There's a bunch listed in this thread:
http://neurohack.com/transcendence/foru ... php?t=1350

Then you can make your own for missions also:
SEE CommonwealthFleet.xml, <Events...> section of CSC Task Force. Then look at the mission codes to see how onwhatever events are constructed.

(sysAddObjTimerEvent timer gSource "OnTimerConvoyAppears3A") in the mission code will execute whatever is in the event:
<OnTimerConvoyAppears3A>
...
</OnTimerConvoyAppears3A>
from the <Events...> section.
and so on...
Last edited by dvlenk6 on Tue Oct 07, 2008 7:58 pm, edited 1 time in total.
"War is hell."
-William Tecumseh Sherman
http://dvlenk6.blackraven3d.com/transgals.html
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

OnObjEnteredGate
OnEnteredGate
OnDestroy
OnContractGenerate (or something similar. don't know what this does)
OnObjDocked (this was primarily used before OnOrdersCompleted)


EDIT: OnDestroy might actually be OnDestroyed
Last edited by F50 on Wed Oct 08, 2008 2:38 pm, edited 1 time in total.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

<OnAIUpdate>: on the qac, looks like it charges itself when on ai ships.
<OnObjDestroyed>;earth slaver for example
<OnMining>:asteroids
<OnGameStart>: don't ask me for advice...
<OnGameEnd>:same as above, found inside <AdventureDesc
<onDamage>
<OnAttackedByPlayer>
<onInit>:dockscreens
<onShow>:c menu messages
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi all,

Thanks for all that ^-^

What I'm trying to list are the builtin events, those that exist in the engine itself and that you can override or not in XML code. Extra events that are created from the XML itself don't interest me.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

<onAttacked>
Crying is not a proper retort!
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi Betelgeuse,


Thanks for this one, I was just wondering if it existed, because this one will be most useful for what I'm trying to do !
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi all,


I noticed that <OnObjAttacked> on the same template that all the <OnObj*> didn't exist. A shame, it could have been very useful. I'll replace it with a objFireEvent order sent by the attacked ship to the aggressor.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

<OnRefuel>
<OnShieldDown>
<OnObjJumped>
<OnObjReconned>
<OnOrderChanged>
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi digdug, hi all,


Thanks for the extra events, I added them to the list.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

i scavenged a little more the XMLs: (I hope I didn't do a mess, they need to be rechecked)

<OnLaunchPatrol>
<OnBountyHunterCheck>
<OnBehavior>
<OnTimerAttack1>
<OnTimerAttack2>
<OnCheckRevenge>
<OnBehaviorControl>
<OnContractQuery>
<OnTimer>
<OnAresPatrolCheck>
<OnSuicideRunCheck2B>
<OnTimerConvoyAppears3A>
<OnTimerConvoyAppears3B>
<OnTimerConvoyAppears4B>
<OnTimerFreighterAppears2B>
<OnTimerConvoyAppears>
<OnInvokedByPlayer>
<OnConstruction>
<OnTimerDefaultAttack>
<OnTimerZeroHour>
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi digdug,


Thanks for the list. I checked each of them, only <OnContractQuery> and <OnInvokedByPlayer> are builtin. The other ones are activated by event commands like sysAddObjTimerEvent or sysAddObjRecurringTimerEvent.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

cool! when it's finished, can you repost it in Script Reference ? Nice job! :D
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi digdug, hi all,


Yes, or maybe an admin would be able to just move the topic to the Scripting Reference, while keeping a placeholder in the Shipyards ? I know it can be done but I haven't the rights to do it.

Btw, would someone have an idea of the difference between <OnObjEnteredGate> and <OnObjJumped> ?
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

I think that <OnObjJumped> is triggered by the function objJumpTo, that moves a ship in the system, like a teleport.
Basically the same as objMoveTo except it has an extra gating animation.

Instead <OnObjEnteredGate> is triggered when a system is changed using objGateTo ? (or maybe hardcoded only for the stargates)

PS: I will move the topic when the list is finished.
Post Reply