Structure access: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
!Struct!!ID type!!<nowiki>-</nowiki>'''var'''<nowiki>?</nowiki>!!Description!!Notes!!
!Struct!!ID type!!<nowiki>-</nowiki>'''var'''<nowiki>?</nowiki>!!Description!!Notes!!
|-
|-
|actor
|[[Members of the sprite, hittype, and spriteext structures|actor]]
|[[sprite id]]
|[[sprite id]]
|Yes
|Yes
Line 19: Line 19:
|You can use [[THISACTOR]] as the id for current sprite.
|You can use [[THISACTOR]] as the id for current sprite.
|-
|-
|tspr
|[[Members of the tsprite structure|tspr]]
|[[sprite id]]
|[[sprite id]]
|No
|No
|sprites' display properties
|sprites' display properties
|Can only be used within [[EVENT_ANIMATESPRITES]] on sprites with [[mdflags]] containing flag 16. You can use [[THISACTOR]] as the id for current sprite.
|Can only be used within [[EVENT_ANIMATESPRITES]] on sprites with [[mdflags]] containing flag 16.<br>You can use [[THISACTOR]] as the id for current sprite.
|-
|-
|projectile
|[[Members of the projectile structure|projectile]]
|[[tile number]]
|[[tile number]]
|No
|No
Line 31: Line 31:
|
|
|-
|-
|thisprojectile
|[[Members of the projectile structure|thisprojectile]]
|[[sprite id]]
|[[sprite id]]
|No
|No
Line 37: Line 37:
|You can use [[THISACTOR]] as the id for current sprite.
|You can use [[THISACTOR]] as the id for current sprite.
|-
|-
|sector
|[[Members of the sector structure|sector]]
|[[sector id]]
|[[sector id]]
|No
|No
Line 43: Line 43:
|You can use [[THISACTOR]] as the sector id for the sector in which the current actor is in.
|You can use [[THISACTOR]] as the sector id for the sector in which the current actor is in.
|-
|-
|wall
|[[Members of the wall structure|wall]]
|[[wall id]]
|[[wall id]]
|No
|No
Line 49: Line 49:
|
|
|-
|-
|player
|[[Members of the player structure|player]]
|[[player id]]
|[[player id]]
|Yes
|Yes
|players
|players
|The player id can be [[THISACTOR]], [[screenpeek]], or [[myconnectindex]], though using myconnectindex is strongly recommended against.
|The player id is usually [[THISACTOR]], but [[screenpeek]] and [[myconnectindex]] are technically possible.
|-
|-
|input
|[[Members of the input structure|input]]
|[[player id]]
|[[player id]]
|No
|No
|input
|input
|Can only be used within [[EVENT_PROCESSINPUT]]. The player id is usually provided by [[THISACTOR]]. It is unknown whether other values are useful or applicable.
|Can only be used within [[EVENT_PROCESSINPUT]].<br>The player id is usually provided by [[THISACTOR]]. It is unknown whether other values are useful or applicable.
|-
|-
|userdef
|[[Members of the userdef structure|userdef]]
|(none)
|(none)
|No
|No

Revision as of 16:35, 23 May 2012

get<struct>[<id>].<member> <gamevar>
set<struct>[<id>].<member> <value>
get<struct>var[<id>].<gamevar> <gamevar>
set<struct>var[<id>].<gamevar> <value>

The get commands fetch one of the members of a structure into a gamevar.

The set commands assign the value provided to the member.

The commands with the "var" suffix are used to access custom members for a struct, which are really just that ID's gamevars which have the per-<struct> flag set. So setactorvar[THISACTOR].temp 0 is the same as setvar temp 0.

Struct ID type -var? Description Notes
actor sprite id Yes sprites and hittypes You can use THISACTOR as the id for current sprite.
tspr sprite id No sprites' display properties Can only be used within EVENT_ANIMATESPRITES on sprites with mdflags containing flag 16.
You can use THISACTOR as the id for current sprite.
projectile tile number No projectile types
thisprojectile sprite id No individual projectiles You can use THISACTOR as the id for current sprite.
sector sector id No sectors, floors, and ceilings You can use THISACTOR as the sector id for the sector in which the current actor is in.
wall wall id No walls
player player id Yes players The player id is usually THISACTOR, but screenpeek and myconnectindex are technically possible.
input player id No input Can only be used within EVENT_PROCESSINPUT.
The player id is usually provided by THISACTOR. It is unknown whether other values are useful or applicable.
userdef (none) No user preferences Use THISACTOR for the id.