Difference between revisions of "M32 script examples"

From EDukeWiki
Jump to navigation Jump to search
m
(update)
Line 15: Line 15:
 
<br>
 
<br>
  
==== EVENT_PREKEYS3D<br> ====
+
==== EVENT_PREKEYS3D<br> ====
  
Various keys are overridden for special purposes in 3D mode when this event is enabled.<br>
+
Various keys are overridden for special purposes in 3D mode when this event is enabled.<br>  
  
 
*When aiming at a Polymer SE light, the following key bindings on the keypad become active:<br>
 
*When aiming at a Polymer SE light, the following key bindings on the keypad become active:<br>
  
{| cellspacing="1" cellpadding="1" border="1" align="left" width="250"
+
{| width="250" cellspacing="1" cellpadding="1" border="1" align="left"
 
|-
 
|-
| '''<br>'''
+
| '''<br>'''  
| /<br>
+
| /<br>  
| *<br>
+
| *<br>  
 
| bgcolor="#33ffcc" | -<br>
 
| bgcolor="#33ffcc" | -<br>
 
|-
 
|-
| bgcolor="#9999ff" | 7<br>
+
| bgcolor="#9999ff" | 7<br>  
| bgcolor="#ffcc66" | 8<br>
+
| bgcolor="#ffcc66" | 8<br>  
| bgcolor="#9999ff" | 9<br>
+
| bgcolor="#9999ff" | 9<br>  
| rowspan="2" bgcolor="#33ffcc" | +<br>
+
| bgcolor="#33ffcc" rowspan="2" | +<br>
 
|-
 
|-
| bgcolor="#ffcc66" | 4<br>
+
| bgcolor="#ffcc66" | 4<br>  
| bgcolor="#ffcc66" | 5<br>
+
| bgcolor="#ffcc66" | 5<br>  
 
| bgcolor="#ffcc66" | 6
 
| bgcolor="#ffcc66" | 6
 
|-
 
|-
| bgcolor="#cc9999" | 1<br>
+
| bgcolor="#cc9999" | 1<br>  
| bgcolor="#cc9999" | 2<br>
+
| bgcolor="#cc9999" | 2<br>  
 
| bgcolor="#cc9999" | 3<br>
 
| bgcolor="#cc9999" | 3<br>
 
|-
 
|-
| colspan="2" | <br>
+
| colspan="2" | <br>  
 
| .<br>
 
| .<br>
 
|}
 
|}
  
<br>
+
<br>  
  
<br>
+
<br>  
  
<br>
+
<br>  
  
<br>
+
<br>  
  
<br>
+
<br>  
  
{| cellspacing="0" cellpadding="0" border="0" align="left" width="258" style=""
+
{| width="258" cellspacing="0" cellpadding="0" border="0" align="left" style=""
 
|-
 
|-
| bgcolor="#ffcc66" | '''KP 4,5,6,8'''<br>
+
| bgcolor="#ffcc66" | '''KP 4,5,6,8'''<br>  
 
| bgcolor="#ffcc66" | angle/horizon<br>
 
| bgcolor="#ffcc66" | angle/horizon<br>
 
|-
 
|-
| bgcolor="#9999ff" | '''KP 7,9'''<br>
+
| bgcolor="#9999ff" | '''KP 7,9'''<br>  
 
| bgcolor="#9999ff" | range (light distance)<br>
 
| bgcolor="#9999ff" | range (light distance)<br>
 
|-
 
|-
| bgcolor="#33ffcc" | '''KP+/-'''<br>
+
| bgcolor="#33ffcc" | '''KP+/-'''<br>  
 
| bgcolor="#33ffcc" | spotlight cone radius<br>
 
| bgcolor="#33ffcc" | spotlight cone radius<br>
 
|-
 
|-
| bgcolor="#cc9999" | '''KP 1,2,3'''<br>
+
| bgcolor="#cc9999" | '''KP 1,2,3'''<br>  
 
| bgcolor="#cc9999" | RGB color (Shift inverts)<br>
 
| bgcolor="#cc9999" | RGB color (Shift inverts)<br>
 
|}
 
|}
  
<br>
+
<br>  
 
 
<br>
 
 
 
<br>
 
  
 +
<br>
  
 +
<br>
  
Also, various modifiers (usually '''Shift''' and/or '''Ctrl''') affect in what increments these values are changed.<br>
+
<br>  
  
Finally, '''Alt-KP1''' asks for RBG values and '''Alt-KP2''' for a tile number used as light projection.
+
Also, various modifiers (usually '''Shift''' and/or '''Ctrl''') affect in what increments these values are changed.<br>
  
 +
Finally, '''Alt-KP1''' asks for RBG values and '''Alt-KP2''' for a tile number used as light projection.
  
 +
<br>
  
*When aiming at a wall or a sector with Polymer enabled, '''KP/''' toggles the cvars ''r_pr_overrideparallax'' and ''r_pr_overridespecular''. When override mode is enabled, the following keys let you tweak the parallax and specular parameters:<br>
+
*When aiming at a wall or a sector with r_pr_override* enabled (you have to enable them manually from the console), certain keys let you tweak the overridden parallax and specular parameters:<br>
  
{| cellspacing="1" cellpadding="1" border="1" width="250"
+
{| width="250" cellspacing="1" cellpadding="1" border="1" align="left"
 
|-
 
|-
| <br>
+
| '''<br>'''
| /<br>
+
| bgcolor="#33ffcc" | /<br>  
| *<br>
+
| bgcolor="#33ffcc" | *<br>  
 
| -<br>
 
| -<br>
 
|-
 
|-
| bgcolor="#ffcc66" | 7<br>
+
| bgcolor="#9999ff" | 7<br>  
| bgcolor="#9999ff" | 8<br>
+
| bgcolor="#ffcc66" | 8<br>  
| bgcolor="#9999ff" | 9<br>
+
| bgcolor="#9999ff" | 9<br>  
 
| rowspan="2" | +<br>
 
| rowspan="2" | +<br>
 
|-
 
|-
| bgcolor="#ffcc66" | 4<br>
+
| bgcolor="#cc9999" | 4<br>  
| 5<br>
+
| bgcolor="#ffcc66" | 5<br>  
| bgcolor="#33ffcc" | 6<br>
+
| bgcolor="#cc9999" | 6
 
|-
 
|-
| bgcolor="#cc9999" | 1<br>
+
| 1<br>  
| bgcolor="#cc9999" | 2<br>
+
| 2<br>  
| bgcolor="#33ffcc" | 3<br>
+
| 3<br>
| <br>
 
 
|-
 
|-
| colspan="2" | <br>
+
| colspan="2" | <br>  
 
| .<br>
 
| .<br>
| <br>
 
 
|}
 
|}
  
<br>
+
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>  
  
{| cellspacing="0" cellpadding="0" border="0" width="200"
+
{| width="200" cellspacing="0" cellpadding="0" border="0"
 
|-
 
|-
| bgcolor="#ffcc66" | '''KP 4,7'''<br>
+
| bgcolor="#ffcc66" | '''KP 8,5'''<br>  
 
| bgcolor="#ffcc66" | parallaxscale<br>
 
| bgcolor="#ffcc66" | parallaxscale<br>
 
|-
 
|-
| bgcolor="#9999ff" | '''KP 8,9'''<br>
+
| bgcolor="#cc9999" | '''KP 4,6'''<br>  
| bgcolor="#9999ff" | parallaxbias<br>
+
| bgcolor="#cc9999" | parallaxbias<br>
 
|-
 
|-
| bgcolor="#cc9999" | '''KP 1,2'''<br>
+
| bgcolor="#33ffcc" | '''KP *,/'''<br>  
| bgcolor="#cc9999" | specularfactor<br>
+
| bgcolor="#33ffcc" | specularfactor<br>
 
|-
 
|-
| bgcolor="#33ffcc" | '''KP 3,6'''<br>
+
| bgcolor="#9999ff" | '''KP 7,9'''<br>  
| bgcolor="#33ffcc" | specularpower<br>
+
| bgcolor="#9999ff" | specularpower<br>
 
|}
 
|}
  
Again, modifiers control the increment speed.<br>
+
Both '''Ctrl''' and '''Alt''' multiply the increment by 10 (seperately).<br>  
 +
 
 +
*When aiming on a sprite, '''Alt-KP1''' queries you for the values of the x/y/zvel members.
  
 
<br>
 
<br>
 
 
  
 
== Geometry manipulations<br> ==
 
== Geometry manipulations<br> ==

Revision as of 15:26, 29 August 2010

Mapster32 Scripting



This page documents the semi-official scripted Mapster32 enhancements implemented in samples/a.m32.


Polymer related manipulations

state printlights

Calling this routine prints all Polymer SE lights in the current map formatted as expected by maphack files to the console, so that they can be copied and pasted from mapster32.log.


EVENT_PREKEYS3D

Various keys are overridden for special purposes in 3D mode when this event is enabled.

  • When aiming at a Polymer SE light, the following key bindings on the keypad become active:

/
*
-
7
8
9
+
4
5
6
1
2
3

.






KP 4,5,6,8
angle/horizon
KP 7,9
range (light distance)
KP+/-
spotlight cone radius
KP 1,2,3
RGB color (Shift inverts)





Also, various modifiers (usually Shift and/or Ctrl) affect in what increments these values are changed.

Finally, Alt-KP1 asks for RBG values and Alt-KP2 for a tile number used as light projection.


  • When aiming at a wall or a sector with r_pr_override* enabled (you have to enable them manually from the console), certain keys let you tweak the overridden parallax and specular parameters:

/
*
-
7
8
9
+
4
5
6
1
2
3

.






KP 8,5
parallaxscale
KP 4,6
parallaxbias
KP *,/
specularfactor
KP 7,9
specularpower

Both Ctrl and Alt multiply the increment by 10 (seperately).

  • When aiming on a sprite, Alt-KP1 queries you for the values of the x/y/zvel members.


Geometry manipulations

state rotselspr

Using this routine, you can rotate a collection of sprites around a pivot sprite by an arbitrary angle.

To use it, first select the sprites you want to rotate using RSHIFT. Next, bring the mouse pointer close to the sprite you wish to be the pivotal one so that it blinks. To carry out the rotation, enter the following command in the console:

do set dang <angle in BUILD units>, state rotselspr

where positive angle values specify clockwise rotation.


state duprot and state duplin in EVENT_ANALYZESPRITES

These routines permit you to duplicate a collection of sprites in a circular arc or a straight line, adding a z offset to each step. The main use of them is the construction of sprite stairways.

Their usage is documented as a tutorial in m32script_ex.map.



Miscellaneous functions

EVENT_INSERTSPRITE3D

When this event is enabled, inserting a LOCATORS sprite will auto-increment its lotag value by setting it to the maximum lotag value of all LOCATORS in its sector plus one.


EVENT_KEYS3D

This event defines a few convenience function for the SPACE key:

  • When hit on a door wall (but not a swinging door), its sound will play.
  • When hit an on SE7 (teleporter/water) or SE17 sprite, it will teleport you to the other location.