FraggleScript functions

This is a comprehensive list of FraggleScript functions:

System variables
These are functions rather than variables, but are always available to the player:

script 82 { // kill the object which started this script kill(trigger); }
 * consoleplayer : The player on the console, ie. in a network game, the player on this machine.
 * displayplayer
 * fov : The current field of view size
 * trigger : The object which triggered the current script to start

Control functions
while (1) { break; } while (1) { continue; print("this message is never displayed"); } script 1 { return; print("this message is never displayed"); } script 1 { goto(my_label); print("this message is never reached"); my_label: } // include the contents of the wad lump named 'things.h' include("things.h");
 * break : Exit a loop, eg.
 * continue : Move to the next iteration in a loop
 * return : Stop the current script
 * goto : Jump to a particular label
 * include : Execute the contents of the lump specified (acts like "#include" in C)

Basic language functions
print("hello, world"); script 1 { int my_number = rnd; if (my_number % 2 == 0) { print("heads"); } else { print("tails"); } }
 * print : Print a message to the console
 * rnd : Returns a random number from 0..255
 * input : (non-functional) read a line from the keyboard
 * beep : Make a sound
 * clock : Returns the level time, in 1/100ths of a second
 * wait
 * tagwait
 * scriptwait
 * startscript
 * scriptrunning
 * startskill
 * exitlevel: Exit the level
 * tip : Display a message to the player (in the centre of the screen)

Messages
playermsg(2, "Hello, player 2"); playertip(2, "Dont go this way, player 2!"); if (playeringame(2)) { print("player 2 is in the game!"); }
 * message: Display a message to the player
 * playermsg: Send a message to a particular player
 * playertip: Send a tip to a particular player (centre-of-screen message)
 * playeringame: Returns 1 if the given player is in the game

Player information

 * playername: Returns the name of a given player
 * playerobj: Returns a reference to the object controlled by a player

Objects

 * spawn
 * kill
 * removeobj
 * objx: Returns the X coordinate of an object
 * objy: Returns the X coordinate of an object
 * objz: Returns the Z coordinate of an object
 * teleport
 * silentteleport
 * damageobj
 * player: If the object is a player, returns the number of the player
 * objsector
 * objflag
 * pushobj
 * objangle
 * objhealth

Sector control

 * floorheight
 * floortext
 * movefloor
 * ceilheight
 * moveceil
 * ceiltext
 * lightlevel
 * fadelight
 * colormap

Cameras

 * setcamera
 * clearcamera

Trigonometry

 * pointtoangle
 * pointtodist

Sound effects

 * startsound
 * startsectorsound
 * changemusic

Hubs

 * changehublevel

Doors

 * opendoor
 * closedoor

Miscellaneous

 * runcommand : Executes a console command

script 10 { // quit the game runcommand("quit"); }
 * linetrigger: Activates a particular Doom line trigger