M32 script variables

From EDukeWiki
Revision as of 06:51, 20 September 2009 by Helixhorned (talk | contribs) (M32-script variable and other stuff reference.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Mapster32 Scripting M32 script commands M32 script variables


This is a list of events, variables, arrays, constants and keys accessible in Mapster32-script.

Events

  • EVENT_ENTER3DMODE

fired upon entering 3D mode.

  • EVENT_ANALYZESPRITES

continuously fired event in 3D mode, used to modify the properties of drawn sprites (not permanently)

  • EVENT_INSERTSPRITE2D

fired after a sprite is inserted in 2D mode, sets the current sprite.

  • EVENT_INSERTSPRITE3D

fired after a sprite is inserted in 3D mode, sets the current sprite.

  • EVENT_DRAW2DSCREEN

fired after the screen has been drawn in 2D mode, can be used to implement additional drawing.

  • EVENT_KEYS2D

continuously fired event in 2D mode before most key checks have been made.

  • EVENT_KEYS3D

continuously fired event in 3D mode after most key checks have been made.

  • EVENT_OVERHEADEDITOR

continuously fired event in 2D mode after most key checks have been made.

Variables

Legend:
write-enabled variable
variables used by various commands

variables set by appropriate commands

  • RETURN (also used in Sort)
  • LOTAG
  • HITAG
  • TEXTURE
  • I (capital i; current sprite)
video variables
  • xdim
  • ydim
  • windowx1
  • windowx2
  • windowy1
  • windowy2
  • rendmode
misc. variables
  • totalclock (incremented by 120 per second)

See Setaspect

  • viewingrange
  • yxaspect
  • randomseed
  • numwalls
  • numsectors
  • numsprites
  • numtiles

variables used in sort

  • SV1
  • SV2

number of drawn sprites (valid in EVENT_ANALYZESPRITES)

  • spritesortcnt
position and orientation of "mapper arrow"
  • posx
  • posy
  • posz
  • ang
  • horiz
  • cursectnum (use updatecursectnum after changing position)
"aiming" and selection variables

mouse pointer screen coordinates

  • searchx
  • searchy

Mouse "aiming" variables in 3D mode. searchstat describes what is being aimed at: 0:wall 1:ceiling 2:floor 3:sprite 4:masked wall

  • searchstat

searchwall is the index of the aimed at sprite if searchstat equals 4, the index of the aimed at wall if searchstat equals 0 or 4, and the index of the wall that intersects the ray from the current position to the aimed at point (as seen from above) otherwise.

  • searchwall
  • searchsector

searchbottomwall is only valid if searchstat equals 0 and differs from searchwall only if the "swap bottom wall" (key '2') is set.

  • searchbottomwall

pointhighlight holds the current highlighted (blinking) point or sprite in 2D mode. If pointhighlight is less than 16384, then its value is the wall index of the highlighted point (A wall in BUILD actually only holds coordinates for one point; the wall[].point2 is the other end point of the wall). Otherwise, pointhighlight-16384 is a sprite index of the currently highlighted sprite.

  • pointhighlight
  • linehighlight

highlightcnt is the number of currently highlighted (semi-permanently, with RSHIFT) points and sprites.

  • highlightcnt

highlightsectorcnt is the number of currently highlighted (permanently, with RALT) sectors.

  • highlightsectorcnt

In 2D mode, mousxplc and mousyplc are the BUILD coordinates under the current mouse crosshair position.

  • mousxplc
  • mousyplc
clipboard contents
  • temppicnum
  • tempcstat
  • templotag
  • temphitag
  • tempextra
  • tempshade
  • temppal
  • tempvis
  • tempxrepeat
  • tempyrepeat
start position
  • startposx
  • startposy
  • startposz
  • startang
  • startsectnum
variables useful for 2D drawing

A zoom of 16384 corresponds to a scale of one pixel per BUILD unit.

  • zoom

drawlinepat is the stroke pattern for the 2D drawing function, e.g. 0xffffffff (-1) is a continuous line, 0x0000ffff is a broken line (long intervals) and 0x55555555 is a dotted line.

  • drawlinepat
  • halfxdim16
  • midydim16
  • ydim16

Arrays

The following is a listing of all accessible arrays along with their size in brackets. Where the size is variable, it indicates the maximum allowable index plus 1.
All of the builtin arrays are read-only.
highlight is an array of highlighted points/sprites. Its elements follow the same convention as the `pointhighlight' variable (see above).

  • highlight[highlightcnt]

highlightsector is an array of highlighted sectors.

  • highlightsector[highlightsectorcnt]
  • sintable[2048] X

These are the (head|next|prev)sprite(stat|sect) arrays.

  • hsect[MAXSECTORS+1]
  • nsect[MAXSPRITES]
  • psect[MAXSPRITES]
  • hstat[MAXSTATUS+1]
  • nstat[MAXSPRITES]
  • pstat[MAXSPRITES]

The tilesiz(x/y) arrays are indexed by tile numbers and hold the x/y dimensions of the loaded tiles. If a tile doesn't exist, they will be 0.

  • tilesizx[MAXTILES]
  • tilesizy[MAXTILES]
  • show2dsector[(MAXSECTORS+7)>>3] X
  • show2dwall[(MAXWALLS+7)>>3]

show2dsprite is a bitmap of which sprites are highlighted with RSHIFT.

  • show2dsprite[(MAXSPRITES+7)>>3]
  • keystatus[256]
  • alphakeys[27]
  • numberkeys[10]

Constants

  • CLIPMASK0
  • CLIPMASK1
  • MAXSPRITES
  • MAXSECTORS
  • MAXWALLS
  • MAXTILES

MAXSTATUS is useful for checking whether a sprite number is valid (i.e, whether a sprite with the given sprite number is in the map). This is the case if sprite[spritenum].statnum is lower than MAXSTATUS. It is needed because sprite numbers need not be contiguous during a session.

  • MAXSTATUS
  • NO
  • COLOR_WHITE (used with 3D text commands)

Keys

  • KEY_SPACE, KEY_A through KEY_Z (in alphakeys[])
  • KEY_0 through KEY_9 (in numberkeys[])
  • KEY_ENTER, KEY_BS, KEY_TAB
  • KEY_DASH, KEY_EQUAL, KEY_LBRACK, KEY_RBRACK, KEY_SEMI, KEY_QUOTE, KEY_BQUOTE, KEY_BSLASH, KEY_COMMA, KEY_PERIOD, KEY_SLASH
  • KEY_LALT, KEY_LCTRL, KEY_LSHIFT, KEY_RALT, KEY_RCTRL, KEY_RSHIFT

Keypad keys:

  • KEY_gDEL, KEY_gDOWN, KEY_gEND, KEY_gHOME, KEY_gINS, KEY_gKP5, KEY_gLEFT, KEY_gMINUS, KEY_gPGDN, KEY_gPGUP, KEY_gPLUS, KEY_gRIGHT, KEY_gSLASH, KEY_gSTAR, KEY_gUP
  • KEY_HOME, KEY_UP, KEY_PGUP, KEY_LEFT, KEY_RIGHT, KEY_END , KEY_DOWN, KEY_PGDN, KEY_INSERT, KEY_DELETE