Getarraysequence: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Added documentation for getarraysequence
 
Fox (talk | contribs)
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''getarraysequence''' <[[gamearray]]> <[[gamevar]]> {<[[gamevar]]>}*
'''getarraysequence''' <gamearray> <gamevar 1> [...] <gamevar N>


Equivalent: '''getarrayseq''' <[[gamearray]]> <[[gamevar]]> {<[[gamevar]]>}*
'''getarrayseq''' <gamearray> <gamevar 1> [...] <gamevar N>


Saves the values of the first N entries of a [[gamearray]] to the provided [[gamevar|gamevars]].


Starting from index 0, retrieves values from an array and stores them in the provided gamevars in sequence.
Current the limit of gamevars is 32.


This command takes a variable number of arguments, up to a maximum of 32.
This is useful for creating a state that takes the values of multiple gamevars. A common usage is to make a custom [[rotatesprite]] function.
 
Example:
 
state Rotatesprite_Scaled
  getarraysequence Rotatesprite_Sequence X Y Scale Ang Picnum Shade Pal Orientation X1 Y1 X2 Y2
  ifn userdef[].statusbarscale 100
  {
    sub X 160
    sub Y 200
    scalevar X X userdef[].statusbarscale 100
    scalevar Y Y userdef[].statusbarscale 100
    scalevar Scale Scale userdef[].statusbarscale 100
    add X 160
    add Y 200
  }
  rotatesprite X Y Scale Ang Picnum Shade Pal Orientation X1 Y1 X2 Y2
ends
appendevent EVENT_DISPLAYSBAR
  set X2 xdim
  sub X2 1
  set Y2 ydim
  sub Y2 1
  setarraysequence Rotatesprite_Sequence 160 166 65536 0 BOTTOMSTATUSBAR 4 0 24 0 0 X2 Y2
  state Rotatesprite_Scaled
endevent
 
See also [[setarraysequence]].


[[Category:EDuke32 specific commands]]
[[Category:EDuke32 specific commands]]
[[Category:Gamearray manipulation]]
[[Category:Gamearray manipulation]]

Latest revision as of 21:29, 19 February 2020

getarraysequence <gamearray> <gamevar 1> [...] <gamevar N>

getarrayseq <gamearray> <gamevar 1> [...] <gamevar N>

Saves the values of the first N entries of a gamearray to the provided gamevars.

Current the limit of gamevars is 32.

This is useful for creating a state that takes the values of multiple gamevars. A common usage is to make a custom rotatesprite function.

Example:

state Rotatesprite_Scaled
  getarraysequence Rotatesprite_Sequence X Y Scale Ang Picnum Shade Pal Orientation X1 Y1 X2 Y2

  ifn userdef[].statusbarscale 100
  {
    sub X 160
    sub Y 200

    scalevar X X userdef[].statusbarscale 100
    scalevar Y Y userdef[].statusbarscale 100
    scalevar Scale Scale userdef[].statusbarscale 100

    add X 160
    add Y 200
  }

  rotatesprite X Y Scale Ang Picnum Shade Pal Orientation X1 Y1 X2 Y2
ends

appendevent EVENT_DISPLAYSBAR
  set X2 xdim
  sub X2 1
  set Y2 ydim
  sub Y2 1

  setarraysequence Rotatesprite_Sequence 160 166 65536 0 BOTTOMSTATUSBAR 4 0 24 0 0 X2 Y2
  state Rotatesprite_Scaled
endevent

See also setarraysequence.