Skip to content
jamesu edited this page Oct 16, 2010 · 8 revisions

Scumm 6 functions

Scumm 6 functions

An almost complete list of the built-in functions in scumm. A couple are still missing as they are not yet usable in ScummC for some reason. Nearly all need a better description.

I renamed many functions compared to the name found in ScummVM and other references in order to bring a little more consistence in the naming schema and make some name more descriptive. Any comments or suggestion is more than welcome.

1. Scripts

startScript( flags, script, [ args ] )

OP Code: 0×5E

The 2 first bits of flags are used: bit 0 mean freeze resistant, and bit 1 recursive. Freeze resistant mean that the script won’t be freezed by “normal” freezeUnfreeze() calls. If recursive is not set, then any running instance of the script is stopped before the script is started.

startScript0( script, [ args ] )

OP Code: 0×5F

Same as calling startScript with flags set to 0.

startScript2( script, [ args ] )

OP Code: 0xBF

Same as calling startScript with flags set to 2.

freezeUnfreeze( a )

OP Code: 0×6A

Unfreeze all frozen thread if a == 0. If a < 0×80 it freeze all freezable threads. If a >= 0×80 it freeze all threads including the unfreezable.

Freezing is a nestable operation, a thread which is frozen twice must be thawed twice before it becomes runnable again.

breakScript()

OP Code: 0×6C

Break out of the current script letting other scripts execute.

breakXTimes( X )

OP Code: 0xCA

Break a script X times.

stopObjectScript( obj )

OP Code: 0×77

Stop an object script.

stopScript( script )

OP Code: 0×7C

Stop a script.

int isScriptRunning( script )

OP Code: 0×8B

Check if a script is running.

waitForActor( actor )

OP Code: 0xA9A8

Break the current script until the actor stop moving.

waitForMessage()

OP Code: 0xA9A9

Break the script as long a message is displayed (check VAR_HAVE_MSG).

waitForCamera()

OP Code: 0xA9AA

Break the current script until the camera finished moving.

waitForSentence()

OP Code: 0xA9AB

Break the current script until the sentence script is finished.

waitForAnimation( actor )

OP Code: 0xA9E2

Break the current script until the actor animation is finished ??

waitForTurn( actor )

OP Code: 0×9AE8

Break the current script until the actor finished turning. WARNING: ScummVM have a dirty hack because of some problems in the dig. See scumm/script_v6.cpp for more details. If the actor have an id such that actor % 45 == 0 the hack will kick in and the current actor will be used instead.

delay( ticks ), delaySeconds( sec ), delayMinutes( min )

OP Code: 0xB0, 0xB1, 0xB2

Break the current script for some times. A tick is 1/60th of a second.

stopSentence()

OP Code: 0xB3

Stop the sentence script.

killAllScriptsExceptCurrent()

OP Code: 0xC9 [ 0×09 ]

Stop all script except the current one.

jumpToScript( flags, script, [ args ] )

OP Code: 0xD5

Stop all running script, then start a new one. flags are the same as for startScript.

int isRoomScriptRunning( obj )

OP Code: 0xD8

Check if the verb script from an object owned by the room is running. This opcode is not supported by the LEC interpreter.

2. Interface

cursorOn(), cursorOff()

OP Code: 0×6B90, 0×6B91

Enable/Disable the mouse cursor.

userPutOn(), userPutOff()

OP Code: 0×6B92, 0×6B93

Enable/Disable user input.

softCursorOn(), softCursorOff(), softUserPutOn(), softUserPutOff()

OP Code: 0×6B94-0×6B97

These are a bit different, they use ++ and — instead of setting to 0 or 1. Dunno what they are good for.

setCursorImage( obj, room )

OP Code: 0×6B99

Use the given object as cursor.

setCursorHotspot( x, y )

OP Code: 0×6B9A

Set the cursor hotspot coordinate.

setCursorTransparency( color )

OP Code: 0×6BD6

Set the transparent color for the cursor.

initCharset( chset )

OP Code: 0×6B9C

Set the charset used for text.

setCharsetColors( [ colors ] )

OP Code: 0×6B9D

Set the colormap used for the charset, it need 16 entries.

panCameraTo( x )

OP Code: 0×78

Pan the camera to show column x.

setCameraAt( x )

OP Code: 0×7A

Set camera to show column x.

cameraFollowActor( actor )

OP Code: 0×79

Make the camera automatically follow the given actor.

grabCursor( x, y, w, h )

OP Code: 0xC9 [ 0×04 ]

Set the cursor from a part of the view.

clearCharsetMask()

OP Code: 0xC9 [ 0×6E ]

3. Room

startRoom( room )

OP Code: 0×7B

Start the given room.

WARNING: In scummvm this function is named loadRoom. However it is clashing with the resource functions. So I renamed this one startRoom which anyway better reflect what it do.

startRoomWithEgo( obj, room, x, y )

OP Code: 0×85

Load a room then walk the actor to the given object ?? If x is not -1 walk to x, y ??

WARNING: In scummvm this function is named loadRoomWithEgo, I renamed it to match the startRoom() function.

setBoxFlags( [ boxes ], flags )

OP Code: 0×99

Set the given flags for on the box listed. The flags are the same as those stored in the BOXD structure. For reference:

  • 0×08 : X flip
  • 0×10 : Y flip
  • 0×20 : Ignore scale / Player only
  • 0×40 : Locked
  • 0×80 : Invisible

To disable/enable a box blocking/allowing actors to go through it you want to set the Invisible flag. When this is done createBoxMatrix() must be called for the changes to take effect.

createBoxMatrix()

OP Code: 0×9A

Recreate the room box matrix of the current room. The box matrix store the point between the box, in other word how to get from box A to box B.

int getSpecialBox( x, y )

OP Code: 0xC8 [ 0×73 ]

int isInBox( x, y, box )

OP Code: 0xC8 [ 0×74 ]

Check if a point is inside a box.

int getBoxFlags( box )

OP Code: 0xC8 [ 0xD7 ]

Get the flags of a box.

setBoxSet( set )

OP Code: 0xE4

Switch the room to an alternative box set (or if you like, “path”). This mean room can have several box set, that’s new to me as in 0.6.1 that op code did nothing.

setRoomColor( r ,g ,b ,color )

OP Code: 0×9CAF

Set a palette entry.

setShakeOn(), setShakeOff()

OP Code: 0×9CB0,0×9CB1

Start, stop the good old shaking effect.

setRoomIntensity( scale, start, end )

OP Code: 0×9CB3

Equivalent to setRoomRGBIntensity(scale,scale,scale,start,end). This will generally be used to darken the image and such kind of effect.

setRoomRGBIntensity( rScale, gScale, bScale, start, end )

OP Code: 0×9CB6

Modify the rgb intensity of the palette elements from start to end. The scaling is as follow: newRed = red * rScale / 0xFF.

setRoomShadow( rScale, gScale, bScale, start, end )

OP Code: 0×9CB7

Setup the shadow palette. Entries are defined with: r = ((palR/4)*rScale)/256 where palR is the red value of the color in the current palette.

roomPalManipulate( resID, start, end, time )

OP Code: 0×9CBA

Do some tricks with palette, dunno what. It seems resID must a palette.

setRoomCycleDelay( cycle, delay )

OP Code: 0×9CBB

Set the delay between palette rotation steps.

setRoomPalette( palette )

OP Code: 0×9CD5

Set the current room palette.

setRoomScroll( minx, maxx )

OP Code: 0×9CAC

Set the area that will be visible. Internally it just set VAR_CAMERA_MIN_X and VAR_CAMERA_MAX_X but it also clamp their value screenWidth/2 and roomWidth-(screenWidth/2).

setScreen( top, bottom )

OP Code: 0×9CAE

Setup the room image size and position. The height (bottom-top) MUST match the height of the room image otherwise the rendering go havoc.

screenEffect( effect )

OP Code: 0×9CB5

Set the effect that will be used on the next room switching. The effect parameter store in fact 2 effect a closing and an opening one. The highest byte define the closing effect and the lowest byte define the opening effect. So for ex. screenEffect(0×8082) would first do the dissolve then the scroll.

  • 0×01: box closing effect with the image
  • 0×02: new image slide from the top left
  • 0×03: new image slide from the bottom right
  • 0×04: old image slide to the top left
  • 0×05: box opening with the image
  • 0×06: new image slide from the left and a bit above
  • 0×80: disolve
  • 0×81: black screen
  • 0×82: scroll from the left
  • 0×83: scroll from the right
  • 0×84: scroll from the top
  • 0×85: scroll from the bottom
  • 0×86: fine dissolve
  • 0×87: columns dissolve

setPseudoRooms( room, [ pseudos ] )

OP Code: 0xA1

Set the listed pseudo room to point to room. pseudo rooms must be greater or equal to 0×80.

fadeOut( effect ), fadeIn( effect )

OP Code: 0xC9 [ 0×05 ], 0xC9 [ 0×06 ]

Perform a fade-in or fade-out affect like on room transition.

setShadowPalette( startColor, endColor, rScale, gScale, bScale )

OP Code: 0xC9 [ 0×6C ]

shiftShadowPalette( startColor, endColor, rScale, gScale, bScale, start, end )

OP Code: 0xC9 [ 0×70 ]

int getRoomObjects( room )

OP Code: 0xDD

Return an array with all object in the room. ScummVM have a warning if room is not the current room. Dunno why. This OP code is not supported by the LEC interpreter for dott.

saveLoadThing( a, b )

OP Code: 0×9CB3

Really dunno what that do.

4. Objects

Note that objects and actors share the same address space. Actors have addresses up to 0xE (0xF is used to represent the room). This mean that some of the following functions are also usable with actors.

startObject( flags, obj, verb, [ args ] )

OP Code: 0×60

Execute the code attached to an abject verb. Flags are the same as for scripts: bit 0 freeze resistant, bit 1 recursive.

startObject2( obj, verb, [ args ] )

OP Code: 0xBE

Same as calling startObject with flags set to 2.

drawObject( obj, state )

OP Code: 0×61

Force a redraw. If state is 0 it’s set to 1, probably to be sure it really draw something. Useful for redrawing backgrounds in a credit sequence for example.

drawObjectAt( obj, x, y )

OP Code: 0×62

Same as drawObject but at a given position.

int isObjectOfClass( obj, [ classes ] )

OP Code: 0×6D

Check if an object match the given class combination. If the class number is or’d with 0×80 then the object must belong to the class, otherwise it mustn’t belong to it. For ex isObjectOfClass(obj,[ Openable + 128, Pickable ]) will return 1 if the object is Openable and not Pickable. Note that we use + here because the LEC interpreter doesn’t support bitwise or. As classes number only range up to 32 using + is ok anyway.

setObjectClass( obj, [ classes ] )

OP Code: 0×6E

Set the classes an object belong to. As for isObjectOfClass() the highest bit of the classes indicate if the object belong to the class or not. 0 have a special effect it reset the class of the object at the same index (inside the room). That must be checked against the LEC interpreter.

int getObjectState( obj ), setObjectState( obj, state )

OP Code: 0×6F, 0×70

Get/Set the state of an object.

int getObjectOwner( obj ), setObjectOwner( obj, owner )

OP Code: 0×72, 0×71

Get/Set the owner of an object. Owner should be an actor, but can be 0.

pickupObject( obj, room )

OP Code: 0×84

Make VAR_EGO the owner of the object, set the object as untouchable, turn it into state 1 and run the inventory script. It’s generally just what is needed to pick an object from the room.

int getObjectX( obj ), int getObjectY( obj )

OP Code: 0×8D, 0×8E

Get the object/actor X or Y coordinate.

int getObjectDir( obj )

OP Code: 0×8F

Get the direction of an object, that is in which direction actors standing in front of it should look.

setObjectName( obj, name )

OP Code: 0×97

Change the name of an object.

int getObjectAt( x, y )

OP Code: 0xA0

Find the object at the given position.

int getObjectVerbEntrypoint( obj, verb )

OP Code: 0xA3

Return the offset at which the code for the given verb is found. Mostly useful to find out if an object implement a verb or not.

int getRoomObjectX( obj ), int getRoomObjectY( obj )

OP Code: 0xC8 [ 0xCF ], 0xC8 [ 0D0 ]

Get the position of an object in the current room.

int getRoomObjectWidth( obj ), int getRoomObjectHeight( obj )

OP Code: 0xC8 [ 0xD1 ], 0xC8 [ 0D2 ]

Get the size of an object in the current room.

enqueueObject( obj, x, y, w, h, scaleX, scaleY, image )

OP Code: 0xC9 [ 0×77 ]

stampObject( obj, x, y, state )

OP Code: 0xCD

Set the object state, optionally setting the object position to x*8,y*8 if x != -1. (might be useful for a “find the object” puzzle?)

int getObjectNewDir( obj )

OP Code: 0xED

Get the object direction in a “new” format ??

loadFlObject( obj, room )

OP Code: 0×9B77

Create an FlObject effectively loading an object from another room in the current one.

5. Actor

setCurrentActor( actor )

OP Code: 0×9DC5

Set an actor as the current one.

initActor()

OP Code: 0×9D53

Reset the actor and play it’s init anim ??

initActorQuick()

OP Code: 0×9DD9

Like actorInit() but it directly go to anim 2 (the walk anim by default).

setActorName( name )

OP Code: 0×9D58

Set the name of the current actor.

walkActorToObj( actor, object, distance )

OP Code: 0×7D

Make an actor walk to an object. It will go at distance pixel away from the object, where distance is only horizontal.

walkActorTo( actor, x, y )

OP Code: 0×7E

Make an actor walk to the given position.

putActorAt( actor, x, y, room )

OP Code: 0×7F

Give an actor a new position. If room == 0xFF, it use the room where the actor currently is.

putActorAtObject( actor, obj, room )

OP Code: 0×80

Put an actor next to an object, eventually in another room ??

actorFace( actor, obj )

OP Code: 0×81

Make the actor face the given object or actor.

setActorStanding()

OP Code: 0×9DE5

Stop the current actor and make it stand.

setActorDirection( dir )

OP Code: 0×9DE6

Set the direction of the current actor.

actorTurnToDirection( dir )

OP Code: 0×9DE7

Make the actor turn to the given direction. The direction is in degree (0 is north, 90 east, 180 south and 270 west). This doesn’t seems to be supported by the LEC interpreter.

setActorIgnoreTurnsOn(), setActorIgnoreTurnsOff()

OP Code: 0×9DD7, 0×9DD8

Probably change the way the current actor is turning on himself.

actorFreeze(), actorUnfreeze()

OP Code: 0×9DE9, 0×9DEA

Freeze, unfreeze the current actor.

setActorWalkSpeed( x, y )

OP Code: 0×9D4D

Set the walking speed of the current actor. The higher the value the slower it is.

int isActorMoving( actor )

OP Code: 0×8A

Check if the actor is moving ??

setActorIgnoreBoxes()

OP Code: 0×9D5F

Allow the current actor to go anywhere ??

setActorFollowBoxes()

OP Code: 0×9D60

Force the actor to stay in the boxes.

int getActorElevation( actor ), setActorElevation( ev )

OP Code: 0xA2, 0×9D54

Get the elevation of the given actor. Set the elevation of the current actor.

int getActorCostume( actor ), setActorCostume( cost )

OP Code: 0×91, 0×9D4C

Get the costume worn by an actor. Set the costume of the current actor.

animateActor( actor, anim )

OP Code: 0×82

Make the actor play the given anim.

setActorAnimSpeed( speed )

OP Code: 0×9D61

Set the current actor animation speed.

setActorWalkFrame( frame )

OP Code: 0×9D4F

Change the frame used for the walk anim of the current actor. Default to 2.

setActorTalkFrame( start, stop )

OP Code: 0×9D50

Change the frames used for starting, stoping a talking sequence. Default to 4 and 5.

setActorStandFrame( frame )

OP Code: 0×9D51

Set the anim used when the current actor is standing. Default to 3 .

setActorInitFrame( frame )

OP Code: 0×9D59

Set the anim used when initing the current actor. Default to 1.

setActorDefaultFrames()

OP Code: 0×9D55

Reset the current actor anims to the defaults.

int getActorAnimVar( actor, var ), setActorAnimVar( actor, var )

OP Code: 0xD2, 0×9DC6

Get/Set the value of an actor animation variable.

int getActorAnimCounter1( actor )

OP Code: 0xAB

Get the actor’s first anim counter. According to ScummVM, this is equivalent to the amount of times “frameSkip()” has been called in the costume.

setActorSounds( [ sounds ] )

OP Code: 0×9D4E

Set the sounds used by the costume of the current actor.

int getActorRoom( actor )

OP Code: 0×8C

Get the room in which the actor is present.

int getActorWalkBox( actor )

OP Code: 0×90

Get the current walk box of the actor.

setActorPalette( color, room_color )

OP Code: 0×9D56

Remaps the specified color (0-32) in the actors costume palette to room_color. Useful for fixing costume colors and differentiating actors.

setActorTalkColor( color )

OP Code: 0×9D57

Set the color to be used for text said by the current actor.

int getActorWidth( actor ), setActorWidth( width )

OP Code: 0xA8, 0×9D5B

Get the actor width. Set the current actor width. Dunno really what’s that for.

setActorScale( a )

OP Code: 0×9D5C

Set the current actor scaling factor.

actorNeverZClip()

OP Code: 0×9D5D

Disable z clipping on the current actor.

setActorZClip( clip )

OP Code: 0×9DE1

Enable / disable z clipping of the current actor.

setActorShadowMode( mode )

OP Code: 0×9D62

Set the current actor shadow mode. Dunno what’s that is.

setActorTalkPos( x, y )

OP Code: 0×9D63

Set the offset to use to place the text of the current actor.

int getActorLayer( actor ), setActorLayer( layer )

OP Code: 0xEC, 0×9DE3

Get the layer of an actor, set the layer of the current actor.

setActorWalkScript( script )

OP Code: 0×9DE4

Set the walk script for the current actor.

setActorTalkScript( script )

OP Code: 0×9DEB

Set the talk script for the current actor.

int getActorAt( x, y )

OP Code: 0×9F

Get the actor at the given position.

int getActorXScale( actor )

OP Code: 0xAA

Get the X scale factor of the actor.

int isActorInBox( actor, box )

OP Code: 0xAF

Check if an actor is inside a box.

actorSay( actor, string ), egoSay( string )

OP Code: 0xBA

Make the actor (or ego) say something. egoSay(s) is equivalent to actorSay(VAR_EGO,s).

int getActorFrame( actor )

OP Code: 0xC8 [ 0xD4 ]

Get the current frame of an actor.

setActorScale( unk, x )

OP Code: 0xC9 [ 0×6B ]

Set the actor scaling.

setActorShadowMode( actor, modeA, modeB )

OP Code: 0xC9 [ 0×6F ]

stopTalking()

OP Code: 0xD1

Stops whichever actor is talking from talking. Note that this wont work in the DOTT interpreter, so instead use:

actorSay(0xFF, "");

6. Inventory

int findInventory( owner, idx )

OP Code: 0×92

Find the object idx (first, second, etc) in the owner inventory.

int getInventoryCount( owner )

OP Code: 0×93

Get the number of objects owned by owner.

7. Verb

doSentence( verb, objA, dummy, objB)

OP Code: 0×83

Prepare a sentence. The sentence script is then called with verb, objA and objB as argument. objB might be 0.

int getVerbAt( x, y )

OP Code: 0×94

Find the verb at the given coordinate.

setCurrentVerb( verb )

OP Code: 0×9EC4

Set the current verb.

setVerbImage( obj )

OP Code: 0×9E7C

Set the object image to be used with the current verb. The object must be in the resource room. To use object from other rooms use verbSetObject().

setVerbName( name )

OP Code: 0×9E7D

Set the name of the current verb.

setVerbColor( color )

OP Code: 0×9E7E

Set the color of the current verb.

setVerbHiColor( color )

OP Code: 0×9E7F

Set the highlight color of the current verb.

setVerbXY( x, y )

OP Code: 0×9E80

Set the position of the current verb.

setVerbOn(), setVerbOff()

OP Code: 0×9E81, 0×9E82

Enable, disable the current verb.

killVerb()

OP Code: 0×9E83

Destroy the current verb.

initVerb()

OP Code: 0×9E84

Initialize the current verb.

setVerbDimColor( color )

OP Code: 0×9E85

Set the dimmed color for the current verb.

verbDim()

OP Code: 0×9E86

Set the current verb as dimmed.

setVerbKey( key )

OP Code: 0×9E87

Set the key binded to the current verb.

verbCenter()

OP Code: 0×9E88

Set the current verb as centered.

setVerbNameString( array )

OP Code: 0×9E89

Set the current verb name’s from an array. This function need the array address as argument.

setVerbObject( obj, room )

OP Code: 0×9E8B

Set the current verb image using an object from any room.

setVerbBackColor( color )

OP Code: 0×9E8C

Set the background color for the current verb.

redrawVerb()

OP Code: 0×9EFF

Redraw the current verb.

saveVerbs( fromVerb, toVerb, slot ), restoreVerbs( fromVerb, toVerb, slot)

OP Code: 0xA58D

Save/restore the verbs fromVerb to toVerb to/from the given slot. Typically this is used to hide a set of verbs without multiple costly calls to setCurrentVerb().

deleteVerbs( fromVerb, toVerb, slot )

OP Code: 0xA58E

Destroy a verb save ??

int getVerbX( verb ), int getVerbY( verb )

OP Code: 0xC8 [ 0xD5 ], 0xC8 [ 0xD6 ]

Get the position of a verb.

8. Music and sound

stopMusic()

OP Code: 0×69

Stop the background music.

startSound( sound )

OP Code: 0×74

Plays the given sound resource. The actual sound should be a sound, not a voice.

stopSound( sound )

OP Code: 0×75

Stop the sound (or is the argument something else ?)

startMusic( sound )

OP Code: 0×76

Start the background music.

int isSoundRunning( sound )

OP Code: 0×98

Check if the given sound is running ??

saveSound( sound )

OP Code: 0xC9 [ 0×7C ]

soundKludge( [ cmds ] )

OP Code: 0xAC

The main gateway to imuse. This should be abstracted.

9. Resources

loadScript( script ), loadSound( sound ), loadCostume( cost ), loadRoom( room ), loadCharset( chset)

OP Code: 0×9B64-0×9B67, 0×9B75

Ensure that a resource is loaded.

nukeScript( script ), nukeSound( sound ), nukeCostume( cost ), nukeRoom( room ), nukeCharset( chset )

OP Code: 0×9B68-09B6B, 0×9B76

Free a resource.

lockScript( script ), lockSound( sound ), lockCostume( cost ), lockRoom( room )

OP Code: 0×9B6C-0×9B6F

Lock a resource in memory. So it’s still available even after leaving the room.

unlockScript( script ), unlockSound( sound ), unlockCostume( cost ), unlockRoom( room )

OP Code: 0×9B70-0×9B73

Unlock a resource.

nukeFlObjects( unk, first, last )

OP Code: 0xC9 [ 0×68 ]

Destroy the FlObjects with address between first and last.

10. Game

restartGame()

OP Code: 0xAE9E

Restart the game without any confirmation.

pauseGame()

OP Code: 0xAE9F

Set the game in paused mode.

shutdown()

OP Code: 0xAEA0

Quit the game without any confirmation.

11. Print

The print function are available in 6 versions:

  • print: 0xB4XX
  • cursorPrint: 0xB5XX
  • dbgPrint: 0xB6XX
  • sysPrint: 0xB7XX
  • actorPrint: 0xB8XX
  • egoPrint: 0xB9XX

All functions are identical in each variant except actorPrintBegin which take the actor as argument (all other *PrintBegin don’t take any argument. Taking printAt as example the other variant are: cursorPrintAt, dbgPrintAt, sysPrintAt, actorPrintAt and egoPrintAt.

printAt( x, y )

OP Code: 0xXX41

Set the position where a string should be printed.

printColor( color )

OP Code: 0xXX42

Set the color in which the string will be printed.

printClipped( right )

OP Code: 0xXX43

Set some clipping ???

printLeft()

OP Code: 0xXX47

Set the string to be left aligned ??

printCenter()

OP Code: 0xXX45

Set the string to be centered ??

printOverhead()

OP Code: 0xXX48

Set the string to be displayed above an actor ??

printMumble()

OP Code: 0xXX4A

The actor saying it will mumble ??

print( string )

OP Code: 0xXX4B

Print a string.

printBegin(), printEnd()

OP Code: 0xXXFE, 0xXXFF

Start/End a print context.

12. Utils

int getRandomNumber( max )

OP Code: 0×87

Return a random number between 0 and max. VAR_RANDOM_NR is also set with the returned value.

int getRandomNumberRange( min, max )

OP Code: 0×88

Return a random number between min and max. Also set VAR_RANDOM_NR.

drawBox( x1, y1, x2, y2, color )

OP Code: 0xA6

Draw a box on the screen.

int isAnyOf( val, [ list ] )

OP Code: 0xAD

Check if val exist in the list.

int abs( val )

OP Code: 0xC4

Return the absolute value of val.

int getDistObjObj( objA, objB )

OP Code: 0xC5

Get the distance between two objects.

int getDistObjPt( obj, x, y )

OP Code: 0xC6

Get the distance between an object and a point.

int getDistPtPt( x1, y1, x2, y2 )

OP Code: 0xC7

Get the distance between two points.

int getPixel( x, y )

OP Code: 0xC8 [ 0×71 ]

Get the value of a pixel from the screen, probably only available in S&M

int getColor( r, g, b )

OP Code: 0xC8 [ 0xCE ]

Get the best matching palette entry for the given RGB value.

int getKeyState( key )

OP Code: 0xC8 [ 0xD3 ]

Get the state of a key.

swapColors( colorA, colorB )

OP Code: 0xC9 [ 0×78 ]

Swap two colors in the palette.

copyColor( src, dst )

OP Code: 0xC9 [ 0×7B ]

Overwrite a color from the palette with another.

int pickOneOf( idx, [ list ] )

OP Code: 0xCB

Pick element idx in the list. The engine will spit an error if idx is out of range, dunno if that lead to a shutdown, but probably.

int pickOneOfDefault( idx, [ list ], default )

OP Code: 0xCC

Like pickOneOf but it return default if idx is out of range.

getDateTime()

OP Code: 0xD0

Get the current date and time. The result is set in the following variables: VAR_TIMEDATE_YEAR, VAR_TIMEDATE_MONTH, VAR_TIMEDATE_DAY, VAR_TIMEDATE_HOUR and VAR_TIMEDATE_MINUTE.

shuffle( array, min, max )

OP Code: 0xD4

Shuffle the array element between index min and max.

Clone this wiki locally