Onevent: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
m Whitespace
Blar
Line 1: Line 1:
onevent <[[event]] name> { code } [[endevent]]
Used outside of all [[actor]]s, '''onevent''' defines a special block of [[CON]] code to be executed when a specific [[event]] happens in the game code[[endevent]] is used to end the statement.  Many events can be canceled by setting the [[gamevar]] RETURN to -1 inside the aforementioned block of code.


Used outside of all [[actor]]s. When the [[event]] called <[[event]] name> occurs, any following code occurs. [[endevent]] is used to end the statement. Set the [[gamevar]] RETURN to -1 inside an onevent statement to cancel to effects of the [[event]].
gamevar MYMEDPACK 100 1
'''onevent''' EVENT_TURNAROUND
{
    palfrom 32 0 0 32
    addphealth 5
    subvar MYMEDPACK 5
    setvar RETURN -1
}
endevent


Example code:
See the [[EDuke32 event list]] for a list of all currently valid events in Eduke32.
 
<pre>
gamevar MYMEDPACK 100 1
 
onevent EVENT_TURNAROUND
{
    palfrom 32 0 0 32
    addphealth 5
    subvar MYMEDPACK 5
    setvar RETURN -1
}
endevent
</pre>
 
See the [[EDuke32 event list]] for a list of all currently valid [[event]]s in Eduke32.


[[Category:EDuke commands]]
[[Category:EDuke commands]]
[[Category:Event manipulation]]
[[Category:Event manipulation]]

Revision as of 09:32, 7 September 2006

Used outside of all actors, onevent defines a special block of CON code to be executed when a specific event happens in the game code. endevent is used to end the statement. Many events can be canceled by setting the gamevar RETURN to -1 inside the aforementioned block of code.

gamevar MYMEDPACK 100 1

onevent EVENT_TURNAROUND
{
    palfrom 32 0 0 32
    addphealth 5
    subvar MYMEDPACK 5
    setvar RETURN -1
}
endevent

See the EDuke32 event list for a list of all currently valid events in Eduke32.