Onevent: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
One (talk | contribs)
No edit summary
a little clarification
Line 1: Line 1:
'''onevent''' [EventName] { event body } endevent
'''onevent''' [EventName] { event body } 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, '''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.  The hardcoded portion of many events can be canceled by setting the [[gamevar]] RETURN to -1 inside the aforementioned block of code, permitting only the custom-coded one to run.


  gamevar MYMEDPACK 100 1
  gamevar MYMEDPACK 100 1

Revision as of 13:20, 10 May 2012

onevent [EventName] { event body } endevent

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. The hardcoded portion of many events can be canceled by setting the gamevar RETURN to -1 inside the aforementioned block of code, permitting only the custom-coded one to run.

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.