M32 script commands: Difference between revisions
Jump to navigation
Jump to search
minor edit |
Helixhorned (talk | contribs) update |
||
Line 1: | Line 1: | ||
[[Mapster32 Scripting]] [[M32 script commands]] [[M32 script variables]] | [[Mapster32 Scripting]] | [[M32 script commands]] | [[M32 script variables]] | ||
---- | ---- | ||
This is a categorized list of every command in Mapster32-script. | This is a categorized list of every command in Mapster32-script. | ||
'''Legend''':<br> | |||
'''I''': acts on current sprite, '''S''': acts on current sprite by pointer (also valid in "for i drawnsprites")<br> | |||
'''i''': sets current sprite, '''s''': only sets current sprite by pointer<br> | |||
'''D''': differs from CON, '''X''': deprecated/do not use (yet)<br> | |||
'''''var/array/special''''': must be writable, [''something'']: optional command field | |||
====basic commands==== | ====basic commands==== | ||
*[[Nullop]] | *[[Nullop]] | ||
Line 21: | Line 23: | ||
====control flow==== | ====control flow==== | ||
*[[Else]] | *[[Else]] | ||
*[[Return]] '''D''' | *[[Return]] '''D''' (returns from states) | ||
*[[Break]] ''' | *[[Break]] '''D''' (also breaks '''for''' and '''while*''' loops) | ||
*[[Switch]] | *[[Switch]] | ||
*[[Case]] | *[[Case]] | ||
Line 30: | Line 32: | ||
*[[Jump]] '''X''' | *[[Jump]] '''X''' | ||
====struct access (redundant | ====struct access (redundant)==== | ||
All of these are redundant, use "'''set''' ''xyz'' ''zyx''" instead. | |||
*[[Setsector]] | *[[Setsector]] | ||
*[[Getsector]] | *[[Getsector]] | ||
Line 42: | Line 45: | ||
====arrays==== | ====arrays==== | ||
*[[Gamearray]] | *[[Gamearray]] | ||
*[[Setarray]] (redundant) | *[[Setarray]] (redundant, use '''set''') | ||
*[[Getarraysize]] ''array'' '''''size''''' | *[[Getarraysize]] ''array'' '''''size''''' | ||
*[[Resizearray]] ''array'' ''newsize'' | *[[Resizearray]] ''array'' ''newsize'' | ||
Line 79: | Line 82: | ||
*[[Cos]] '''''resvar''''' ''var'' | *[[Cos]] '''''resvar''''' ''var'' | ||
*[[Displayrand]] '''''resvar''''' | *[[Displayrand]] '''''resvar''''' | ||
*[[Inv]] ''var'' | *[[Inv]] '''''var''''' | ||
*[[Clamp]] '''''var''''' ''min'' ''max'' | |||
*[[Sqrt]] ''invar'' '''''outvar''''' | *[[Sqrt]] ''invar'' '''''outvar''''' | ||
*[[Mulscale]] ''factor1'' ''factor2'' ''rshiftamount'' | *[[Mulscale]] ''factor1'' ''factor2'' ''rshiftamount'' | ||
Line 90: | Line 94: | ||
*[[Sort]] '''''array''''' ''count'' [''comparison_state''] | *[[Sort]] '''''array''''' ''count'' [''comparison_state''] | ||
*[[For]] '''''itervar''''' ''what'' [''what2''] | *[[For]] '''''itervar''''' ''what'' [''what2''] | ||
valid iteration types (''what''): | valid iteration types (''what''):<br> | ||
*allsprites '''i''', allsectors, allwalls, selsprites '''i''', selsectors, selwalls, drawnsprites '''s''' | Note: where the current sprite is affected, it is restored at the end of the loop | ||
*spritesofsector ''sector'' | *allsprites ('''i'''), allsectors, allwalls, selsprites ('''i'''), selsectors, selwalls, drawnsprites ('''s''') | ||
*spritesofsector ''sector'' ('''i'''), loopofwall ''wall'', wallsofsector ''sector'', range ''num'' | |||
====var if* and while* commands==== | ====var if* and while* commands==== | ||
Line 127: | Line 132: | ||
*[[Ifhitkey]] KEY_??? | *[[Ifhitkey]] KEY_??? | ||
*[[Ifholdkey]] KEY_??? | *[[Ifholdkey]] KEY_??? | ||
*[[Resetkey]] KEY_??? | |||
*[[Ifeitheralt]] | *[[Ifeitheralt]] | ||
*[[Ifeitherctrl]] | *[[Ifeitherctrl]] | ||
Line 132: | Line 138: | ||
*[[Ifrnd]] ''number'' | *[[Ifrnd]] ''number'' | ||
*[[Ifinside]] ''x'' ''y'' ''sectnum'' | *[[Ifinside]] ''x'' ''y'' ''sectnum'' | ||
*[[Ifangdiffl]] '''S''' | *[[Ifangdiffl]] ''angdiff'' | '''S''' | ||
*[[Ifspritepal]] '''S''' | *[[Ifspritepal]] ''pal'' | '''S''' | ||
*[[Ifactor]] '''S''' | *[[Ifactor]] ''picnum'' | '''S''' | ||
*[[Ifpdistl]] '''S''' | *[[Ifpdistl]] ''dist'' | '''S''' (distance is that of "mapper arrow" to current sprite) | ||
*[[Ifpdistg]] '''S''' | *[[Ifpdistg]] ''dist'' | '''S''' (distance is that of "mapper arrow" to current sprite) | ||
*[[Ifawayfromwall]] '''S''' | *[[Ifawayfromwall]] '''S''' | ||
*[[Ifcansee]] '''S''' | *[[Ifcansee]] '''S''' (whether "mapper arrow" can see current sprite) | ||
*[[Ifonwater]] '''S''' | *[[Ifonwater]] '''S''' | ||
*[[Ifinwater]] '''S''' | *[[Ifinwater]] '''S''' | ||
Line 162: | Line 168: | ||
*[[Alignceilslope]] ''sectnum'' ''x'' ''y'' ''z'' | *[[Alignceilslope]] ''sectnum'' ''x'' ''y'' ''z'' | ||
*[[Alignflorslope]] ''sectnum'' ''x'' ''y'' ''z'' | *[[Alignflorslope]] ''sectnum'' ''x'' ''y'' ''z'' | ||
* | *'''Bsetsprite''' ''spritenum'' ''x'' ''y'' ''z'' ([[Setsprite]] in CON) | ||
*[[Setfirstwall]] ''sectnum'' ''wallnum'' | *[[Setfirstwall]] ''sectnum'' ''wallnum'' | ||
*[[Changespritestat]] ''spritenum'' ''statnum'' | *[[Changespritestat]] ''spritenum'' ''statnum'' | ||
Line 175: | Line 181: | ||
====debugging commands==== | ====debugging commands==== | ||
*[[Addlogvar]] ''var/array/special'' (short form: '''al''') | *[[Addlogvar]] ''var/array[]/special[].xxx'' (short form: '''al''') | ||
*[[Addlog]] | *[[Addlog]] | ||
*[[Debug]] '' | *[[Debug]] ''CONSTANT'' | ||
====quote commands==== | ====quote commands==== | ||
Line 188: | Line 194: | ||
*[[Printext256]] ''quotenum'' ''x'' ''y'' ''col'' ''backcol'' ''fontsize'' | *[[Printext256]] ''quotenum'' ''x'' ''y'' ''col'' ''backcol'' ''fontsize'' | ||
*[[Printext16]] ''quotenum'' ''x'' ''y'' ''col'' ''backcol'' ''fontsize'' | *[[Printext16]] ''quotenum'' ''x'' ''y'' ''col'' ''backcol'' ''fontsize'' | ||
Specifying a negative ''max'' argument will make the allowable number range be ''max'' to -''max'': | |||
*[[Getnumber16]] '''''var''''' ''quotenum'' ''max'' | *[[Getnumber16]] '''''var''''' ''quotenum'' ''max'' | ||
*[[Getnumber256]] '''''var''''' ''quotenum'' ''max'' | *[[Getnumber256]] '''''var''''' ''quotenum'' ''max'' |
Revision as of 13:05, 11 October 2009
Mapster32 Scripting | M32 script commands | M32 script variables
This is a categorized list of every command in Mapster32-script.
Legend:
I: acts on current sprite, S: acts on current sprite by pointer (also valid in "for i drawnsprites")
i: sets current sprite, s: only sets current sprite by pointer
D: differs from CON, X: deprecated/do not use (yet)
var/array/special: must be writable, [something]: optional command field
basic commands
- Nullop
- Define
- Include
- Defstate (only for defining)
- Ends
- State D (only for calling)
- Onevent
- Endevent
- Gamevar D (different flags)
control flow
- Else
- Return D (returns from states)
- Break D (also breaks for and while* loops)
- Switch
- Case
- Default
- Endswitch
- Getcurraddress X
- Jump X
struct access (redundant)
All of these are redundant, use "set xyz zyx" instead.
arrays
- Gamearray
- Setarray (redundant, use set)
- Getarraysize array size
- Resizearray array newsize
- Copy srcarray srcidx dstarray dstidx count
var commands
- Randvar
- Displayrandvar
- Setvar
- Addvar
- Subvar
- Mulvar
- Divvar
- Modvar
- Andvar
- Orvar
- Xorvar
- Shiftvarl (short: shiftl)
- Shiftvarr (short: shiftr)
varvar commands
- Randvarvar
- Displayrandvarvar (different from displayrand)
- Setvarvar
- Addvarvar
- Subvarvar
- Mulvarvar
- Divvarvar
- Modvarvar
- Andvarvar
- Orvarvar
- Xorvarvar
math commands
- Sin resvar var
- Cos resvar var
- Displayrand resvar
- Inv var
- Clamp var min max
- Sqrt invar outvar
- Mulscale factor1 factor2 rshiftamount
- Dist res sprite1 sprite2
- Ldist res sprite1 sprite2
- Getangle res x y
- Getincangle res ang1 ang2
special commands
valid iteration types (what):
Note: where the current sprite is affected, it is restored at the end of the loop
- allsprites (i), allsectors, allwalls, selsprites (i), selsectors, selwalls, drawnsprites (s)
- spritesofsector sector (i), loopofwall wall, wallsofsector sector, range num
var if* and while* commands
- Ifvarl
- Ifvarle
- Ifvarg
- Ifvarge
- Ifvare
- Ifvarn
- Ifvarand
- Ifvaror
- Ifvarxor
- Ifvareither
- Ifvarboth
- Whilevarn
- Whilevarl
varvar if* and while* commands
- Ifvarvarl
- Ifvarvarle
- Ifvarvarg
- Ifvarvarge
- Ifvarvare
- Ifvarvarn
- Ifvarvarand
- Ifvarvaror
- Ifvarvarxor
- Ifvarvareither
- Ifvarvarboth
- Whilevarvarn
- Whilevarvarl
other if* commands
- Ifhitkey KEY_???
- Ifholdkey KEY_???
- Resetkey KEY_???
- Ifeitheralt
- Ifeitherctrl
- Ifeithershift
- Ifrnd number
- Ifinside x y sectnum
- Ifangdiffl angdiff | S
- Ifspritepal pal | S
- Ifactor picnum | S
- Ifpdistl dist | S (distance is that of "mapper arrow" to current sprite)
- Ifpdistg dist | S (distance is that of "mapper arrow" to current sprite)
- Ifawayfromwall S
- Ifcansee S (whether "mapper arrow" can see current sprite)
- Ifonwater S
- Ifinwater S
- Ifoutside S
BUILD functions
- Insertsprite X i s
- Dupsprite oldsprite | i s
- Deletesprite spritenum
- Lastwall point resultvar
- Updatecursectnum
- Updatesector x y var | I
- Updatesectorz x y z var | I
- Getzrange sectnum ceilzvar ceilhitvar florzvar florhitvar walldist clipmask
- Hitscan x y z sectnum vx vy vz hitsectvar hitwallvar hitspritevar hitxvar hityvar hitzvar cliptype
- Cansee x1 y1 z1 sect1 x2 y2 z2 sect2 rvar
- Canseespr sprite1 sprite2 result
- Neartag x y z sectnum ang neartagsectorvar neartagwallvar neartagspritevar neartaghitdistvar neartagrange tagsearch
- Rotatepoint xpivot ypivot x y daang xres yres
- Dragpoint wallnum newx newy
- Getceilzofslope sectnum x y resz
- Getflorzofslope sectnum x y resz
- Alignceilslope sectnum x y z
- Alignflorslope sectnum x y z
- Bsetsprite spritenum x y z (Setsprite in CON)
- Setfirstwall sectnum wallnum
- Changespritestat spritenum statnum
- Changespritesect spritenum sectnum
- Headspritestat X
- Prevspritestat X
- Nextspritestat X
- Headspritesect X
- Prevspritesect X
- Nextspritesect X
- Sectorofwall wallnum
debugging commands
quote commands
- Definequote quotenum [text...] | (static)
- Redefinequote quotenum [text...] | (dynamic)
- Quote quotenum
- Error quotenum
- Printmessage16 quotenum
- Printmessage256 quotenum x y col backcol fontsize
- Printext256 quotenum x y col backcol fontsize
- Printext16 quotenum x y col backcol fontsize
Specifying a negative max argument will make the allowable number range be max to -max:
- Getnumber16 var quotenum max
- Getnumber256 var quotenum max
- Qsprintf destquote srcquote [up to 32 arguments...]
- Qstrcat destquote srcquote
- Qstrcpy destquote srcquote
- Qstrlen resvar quotenum
- Qstrncat destquote srcquote count | X
- Qsubstr dstquote srcquote start length
findnear* (not tested)
- Findnearsprite type maxdist resvar | I
- Findnearspritevar type maxdistvar resvar | I
- Findnearsprite3d type maxdist resvar | I
- Findnearsprite3dvar type maxdistvar resvar | I
- Findnearspritez type maxdist maxzdist resvar | I
- Findnearspritezvar type maxdist maxzdist resvar | I
misc. commands
- Getticks var
- Gettimedate (8 arguments...)
- Setaspect viewingrange yxaspect
current sprite commands
- Seti spritenum | i s
- Sizeat xrepeat yrepeat | S
- Cstat cstat | S
- Cstator bitstoset | S
- Clipdist clipdist | S
- Spritepal palnum | S
- Cactor picnum | S
- Spgetlotag S
- Spgethitag S
- Sectgetlotag S
- Sectgethitag S
- Gettexturefloor S
- Gettextureceiling S
drawing commands
used in EVENT_DRAW2DSCREEN
- Drawline16 x1 y1 x2 y2 col
- Drawline16b x1 y1 x2 y2 col (BUILD units)
- Drawcircle16 x y radius
- Drawcircle16b x y radius (BUILD units)
used elsewhere
- Rotatesprite16
- Rotatesprite
- Setgamepalette gamepal