Main Page | Recent changes | Edit this page | Page history

Printable version | Disclaimers | Privacy policy

Not logged in
Log in | Help
 

State

From EDukeWiki

A state is a block of code written outside of any actors or events, that can be called from within them. This is useful because it allows you to use the same code in multiple places without rewriting it.

Syntax for state creation:

state <name> { state code } ends

<name> is the name of the state.

{ state code } is the code executed within that state.

ends denotes the end of a state.


Calling a state within an actor is simply:

state <name>


Example code:

define MYACTOR1 3585
define MYACTOR2 3586
define MYACTOR3 3587

state spawnblood
ifhitweapon
{
    guts JIBS6 12
    spawn BLOODPOOL
    killit
}
ends

useractor notenemy MYACTOR1 2
    state spawnblood
enda

useractor notenemy MYACTOR2 2
    state spawnblood
enda

useractor notenemy MYACTOR3 2
    state spawnblood
enda

Use break to exit a state before all of it's code is finished executing.

Retrieved from "http://sc8-pr-shell1.sourceforge.net../../../s/t/a/State.html"

This page has been accessed 146 times. This page was last modified 08:18, 24 September 2005 by Richard Gobeille. Based on work by Jonathan Smith. Content is available under SourceForge.


[Main Page]
Main Page
Recent changes
Random page
EDuke32.com

Edit this page
Discuss this page
Page history
What links here
Related changes

Special pages
Bug reports