M32 script commands: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
→‎drawing commands: added sound commands
added fixrepeats, minor changes
Line 84: Line 84:
*[[Inv]] '''''var'''''
*[[Inv]] '''''var'''''
*[[Clamp]] '''''var''''' ''min'' ''max''
*[[Clamp]] '''''var''''' ''min'' ''max''
*[[Sqrt]] ''invar'' '''''outvar'''''
*[[Sqrt]] ''var'' '''''resvar'''''
*[[Mulscale]] ''factor1'' ''factor2'' ''rshiftamount''
*[[Mulscale]] ''factor1'' ''factor2'' ''rshiftamount''
*[[Dist]] '''''res''''' ''sprite1'' ''sprite2''
*[[Dist]] '''''res''''' ''sprite1'' ''sprite2''
Line 96: Line 96:
valid iteration types (''what''):<br>
valid iteration types (''what''):<br>
Note: where the current sprite is affected, it is restored at the end of the loop
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''')
*allsprites ('''i'''), allsectors, allwalls, selsprites ('''i'''), selsectors, selwalls, drawnsprites ('''s''', indexes tsprite[])
*spritesofsector ''sector'' ('''i'''), loopofwall ''wall'', wallsofsector ''sector'', range ''num''
*spritesofsector ''sector'' ('''i'''), loopofwall ''wall'', wallsofsector ''sector'', range ''num''


Line 152: Line 152:
*[[Insertsprite]] '''X''' '''i''' '''s'''
*[[Insertsprite]] '''X''' '''i''' '''s'''
*[[Dupsprite]] ''oldsprite'' | '''i''' '''s'''
*[[Dupsprite]] ''oldsprite'' | '''i''' '''s'''
*[[Tdupsprite]] ''sprite'' | '''s''' (this will copy a sprite to a tsprite with index (new ''spritesortcnt'')-1)
*[[Tdupsprite]] ''sprite'' | '''s''' (copies ''sprite'' to tsprite[''spritesortcnt''] and increments ''spritesortcnt'')
*[[Deletesprite]] ''spritenum''
*[[Deletesprite]] ''spritenum''
*[[Lastwall]] ''point'' '''''resultvar'''''
*[[Lastwall]] ''point'' '''''resultvar'''''
Line 180: Line 180:
*[[Nextspritesect]] '''X'''
*[[Nextspritesect]] '''X'''
*[[Sectorofwall]] ''wallnum''
*[[Sectorofwall]] ''wallnum''
*[[Fixrepeats]] ''wallnum''


====debugging commands====
====debugging commands====
Line 187: Line 188:


====quote commands====
====quote commands====
*[[Definequote]] ''quotenum'' [text...] | (static)
*[[Definequote]] ''quotenum'' [text...] | (initial definition of a quote)
*[[Redefinequote]] ''quotenum'' [text...] | (dynamic)
*[[Redefinequote]] ''quotenum'' [text...] | (replacement occurs at runtime)
*[[Quote]] ''quotenum''
*[[Quote]] ''quotenum''
*[[Error]] ''quotenum''
*[[Error]] ''quotenum''

Revision as of 08:09, 4 January 2010

Mapster32 Scripting

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

control flow

struct access (redundant)

All of these are redundant, use "set xyz zyx" instead.

arrays

var commands

varvar commands

math commands

special commands

  • Sort array count [comparison_state]
  • For itervar what [what2]

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, indexes tsprite[])
  • spritesofsector sector (i), loopofwall wall, wallsofsector sector, range num

var if* and while* commands

varvar if* and while* commands

other if* commands

BUILD functions

debugging commands

quote commands

Specifying a negative max argument will make the allowable number range be max to -max:

findnear* (not tested)

misc. commands

current sprite commands

drawing commands

used in EVENT_DRAW2DSCREEN
used elsewhere

sound commands

All sound commands accept vars. Sounds should appear from current sprite if set and globally otherwise (not tested).