View source for Category:Event manipulation - EDukeWiki

# View source for Category:Event manipulation

← Category:Event manipulation

You do not have permission to edit this page, for the following reasons:

- The action you have requested is limited to users in the group: Users.
- You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Events are special occurrences in the game engine, including a tick in the game's 30 Hz state machine, key presses, display calls, etc. == Usage == Used outside of all [[actor]]s and [[state]]s, '''onevent''' and '''appendevent''' define a special block of CON code to be executed when a specific [[event]] happens in the game code. '''endevent''' is used to end the block. [[gamevar]] MYMEDPACK 100 1 '''onevent''' [[EVENT_TURNAROUND]] [[palfrom]] 32 0 0 32 [[addphealth]] 5 [[subvar]] MYMEDPACK 5 [[setvar]] [[RETURN]] -1 '''endevent''' The hardcoded portion of many events can be modified by altering the special [[gamevar]] [[RETURN]] in a way specific to each event. Events are also the only of the three CON entry points (the other two being [[actor]] and [[eventloadactor]] code) that may recurse, for example through [[EVENT_EGS]], [[EVENT_SPAWN]] or [[EVENT_KILLIT]]. Please see the [[EDuke32 event list]] for a complete list of all events available. == Event Chaining == The keyword '''appendevent''' performs the same function as '''onevent''', but with the difference that successive definitions of events are ''prepended'' with '''onevent''', and ''appended'' with '''appendevent'''. This is useful for keeping your CONs organized, as well as to facilitate [[CON mutator]]s. For example: definequote 666 Placeholder. appendevent EVENT_ENTERLEVEL redefinequote 666 0 echo 666 endevent appendevent EVENT_ENTERLEVEL redefinequote 666 1 echo 666 endevent onevent EVENT_ENTERLEVEL redefinequote 666 -1 echo 666 endevent appendevent EVENT_ENTERLEVEL redefinequote 666 2 echo 666 endevent onevent EVENT_ENTERLEVEL redefinequote 666 -2 echo 666 endevent -2 -1 0 1 2 The two commands are identical when defining the first instance of an event found when the game parses the CONs. == Terminating Execution == === [[break]] === The [[break]] keyword can be used to terminate the current event block. definequote 666 This will print. definequote 616 This will never print. appendevent EVENT_ENTERLEVEL echo 666 break echo 616 endevent appendevent EVENT_ENTERLEVEL echo 666 break echo 616 endevent appendevent EVENT_ENTERLEVEL echo 666 break echo 616 endevent This will print. This will print. This will print. === [[return]] === The [[return]] keyword will prevent any further execution of the event in the block chain. Use with caution! definequote 666 This will print. definequote 616 This will never print. appendevent EVENT_ENTERLEVEL echo 666 endevent appendevent EVENT_ENTERLEVEL echo 666 return echo 616 endevent appendevent EVENT_ENTERLEVEL echo 616 endevent This will print. This will print. The command also functions from [[state]]s. definequote 666 This will print. definequote 616 This will never print. state example_state return ends appendevent EVENT_ENTERLEVEL echo 666 endevent appendevent EVENT_ENTERLEVEL echo 666 state example_state echo 616 endevent appendevent EVENT_ENTERLEVEL echo 616 endevent This will print. This will print. [[Category:All commands]]

Return to Category:Event manipulation.

Retrieved from "http://wiki.eduke32.com/wiki/Category:Event_manipulation"