Difference between revisions of "FraggleScript functions"

From DoomWiki.org

[unchecked revision][unchecked revision]
(a start...)
 
(legacy extensions)
Line 8: Line 8:
 
; displayplayer
 
; displayplayer
 
; fov : The current field of view size
 
; fov : The current field of view size
 +
; zoom: (legacy extension)
 
; trigger : The object which triggered the current script to start
 
; trigger : The object which triggered the current script to start
 
  script 82 {
 
  script 82 {
Line 54: Line 55:
 
     }
 
     }
 
  }
 
  }
 +
; prnd (legacy extension)
 
; input : (non-functional) read a line from the keyboard
 
; input : (non-functional) read a line from the keyboard
 
; beep : Make a sound
 
; beep : Make a sound
Line 65: Line 67:
 
; exitlevel: Exit the level
 
; exitlevel: Exit the level
 
; tip : Display a message to the player (in the centre of the screen)
 
; tip : Display a message to the player (in the centre of the screen)
 +
; timedtip (legacy extension)
  
 
=== Messages ===
 
=== Messages ===
Line 77: Line 80:
 
     print("player 2 is in the game!");
 
     print("player 2 is in the game!");
 
  }
 
  }
 +
; gameskill (legacy extension)
 +
; gamemode (legacy extension)
 +
 +
=== Player information and control ===
  
=== Player information ===
 
 
; playername: Returns the name of a given player
 
; playername: Returns the name of a given player
 
; playerobj: Returns a reference to the object controlled by a player
 
; playerobj: Returns a reference to the object controlled by a player
 +
; playeraddfrag (legacy extension)
 +
; isobjplayer (legacy extension)
 +
; isplayerobj (legacy extension)
 +
; skincolor (legacy extension)
 +
; playerkeys (legacy extension)
 +
; playerammo (legacy extension)
 +
; maxplayerammo (legacy extension)
 +
; playerweapon (legacy extension)
  
 
=== Objects ===
 
=== Objects ===
Line 99: Line 113:
 
; objangle
 
; objangle
 
; objhealth
 
; objhealth
 +
; spawnexplosion (legacy extension)
 +
; radiusattack (legacy extension)
 +
; testlocation (legacy extension)
 +
; pushthing (legacy extension)
 +
; objdead (legacy extension)
 +
; objreactiontime (legacy extension)
 +
; reactiontime (legacy extension)
 +
; objtarget (legacy extension)
 +
; objmomx (legacy extension)
 +
; objmomy (legacy extension)
 +
; objmomz (legacy extension)
 +
; spawnmissile (legacy extension)
 +
; mapthings (legacy extension)
 +
; objtype (legacy extension)
 +
; mapthingnumexist (legacy extension)
  
 
=== Sector control ===
 
=== Sector control ===
 
; floorheight
 
; floorheight
 
; floortext
 
; floortext
 +
; floortexture (legacy extension)
 
; movefloor
 
; movefloor
 
; ceilheight
 
; ceilheight
 +
; ceilingheight (legacy extension)
 
; moveceil
 
; moveceil
 +
; moveceiling (legacy extension)
 
; ceiltext
 
; ceiltext
 +
; ceilingtexture (legacy extension)
 
; lightlevel
 
; lightlevel
 
; fadelight
 
; fadelight
Line 114: Line 147:
 
; setcamera
 
; setcamera
 
; clearcamera
 
; clearcamera
 +
; movecamera (legacy extension)
  
=== Trigonometry ===
+
=== Math functions ===
 
; pointtoangle
 
; pointtoangle
 
; pointtodist
 
; pointtodist
 +
; max (legacy extension)
 +
; min (legacy extension)
 +
; abs (legacy extension)
 +
; sin (legacy extension)
 +
; asin (legacy extension)
 +
; cos (legacy extension)
 +
; acos (legacy extension)
 +
; tan (legacy extension)
 +
; atan (legacy extension)
 +
; exp (legacy extension)
 +
; log (legacy extension)
 +
; sqrt (legacy extension)
 +
; floor (legacy extension)
 +
; pow (legacy extension)
  
 
=== Sound effects ===
 
=== Sound effects ===
Line 123: Line 171:
 
; startsectorsound
 
; startsectorsound
 
; changemusic
 
; changemusic
 +
; startambiantsound (legacy extension)
 +
; ambientsound (legacy extension)
  
 
=== Hubs ===
 
=== Hubs ===
Line 130: Line 180:
 
; opendoor
 
; opendoor
 
; closedoor
 
; closedoor
 +
 +
=== Heads-up GUI ===
 +
 +
; newhupic (legacy extension)
 +
; createpic (legacy extension)
 +
; deletehupic (legacy extension)
 +
; modifyhupic (legacy extension)
 +
; modifypic (legacy extension)
 +
; sethupicdisplay (legacy extension)
 +
; setpicvisible (legacy extension)
  
 
=== Miscellaneous ===
 
=== Miscellaneous ===
Line 140: Line 200:
 
  }
 
  }
 
; linetrigger: Activates a particular Doom line trigger
 
; linetrigger: Activates a particular Doom line trigger
 
+
; playdemo (legacy extension)
=== Legacy-specific extensions ===
+
; checkcvar (legacy extension)
 +
; setlinetexture (legacy extension)
 +
; lineflag (legacy extension)
 +
; setcorona (legacy extension)

Revision as of 11:01, 11 January 2005

This is a comprehensive list of FraggleScript functions:

System variables

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

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

Control functions

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

include("things.h");   

Basic language functions

print 
Print a message to the console
print("hello, world");
rnd 
Returns a random number from 0..255
script 1 {
    int my_number = rnd();
    if (my_number % 2 == 0) {
        print("heads");
    } else {
        print("tails");
    }
}
prnd (legacy extension)
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)
timedtip (legacy extension)

Messages

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

Player information and control

playername
Returns the name of a given player
playerobj
Returns a reference to the object controlled by a player
playeraddfrag (legacy extension)
isobjplayer (legacy extension)
isplayerobj (legacy extension)
skincolor (legacy extension)
playerkeys (legacy extension)
playerammo (legacy extension)
maxplayerammo (legacy extension)
playerweapon (legacy extension)

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
spawnexplosion (legacy extension)
radiusattack (legacy extension)
testlocation (legacy extension)
pushthing (legacy extension)
objdead (legacy extension)
objreactiontime (legacy extension)
reactiontime (legacy extension)
objtarget (legacy extension)
objmomx (legacy extension)
objmomy (legacy extension)
objmomz (legacy extension)
spawnmissile (legacy extension)
mapthings (legacy extension)
objtype (legacy extension)
mapthingnumexist (legacy extension)

Sector control

floorheight
floortext
floortexture (legacy extension)
movefloor
ceilheight
ceilingheight (legacy extension)
moveceil
moveceiling (legacy extension)
ceiltext
ceilingtexture (legacy extension)
lightlevel
fadelight
colormap

Cameras

setcamera
clearcamera
movecamera (legacy extension)

Math functions

pointtoangle
pointtodist
max (legacy extension)
min (legacy extension)
abs (legacy extension)
sin (legacy extension)
asin (legacy extension)
cos (legacy extension)
acos (legacy extension)
tan (legacy extension)
atan (legacy extension)
exp (legacy extension)
log (legacy extension)
sqrt (legacy extension)
floor (legacy extension)
pow (legacy extension)

Sound effects

startsound
startsectorsound
changemusic
startambiantsound (legacy extension)
ambientsound (legacy extension)

Hubs

changehublevel

Doors

opendoor
closedoor

Heads-up GUI

newhupic (legacy extension)
createpic (legacy extension)
deletehupic (legacy extension)
modifyhupic (legacy extension)
modifypic (legacy extension)
sethupicdisplay (legacy extension)
setpicvisible (legacy extension)

Miscellaneous

runcommand 
Executes a console command
script 10 {
    // quit the game

    runcommand("quit");
}
linetrigger
Activates a particular Doom line trigger
playdemo (legacy extension)
checkcvar (legacy extension)
setlinetexture (legacy extension)
lineflag (legacy extension)
setcorona (legacy extension)