Professional Documents
Culture Documents
Usage
sets a flag to true
sets a flag to false
the operation will only be executed wenn flag is true
executes an operation wenn flag was false
executes <init-op>, while flag is true <operation;incr-op>
repeats the operation while flag is true
ends a loop and continues with the script that follows to the loop
jumps to the beginning of the loop (next loop round)
defines a function, can be called with funcname()
ends the function immediatelly and returns to the function caller
pauses the script execution for the specified time
initializes var as an array of the specified size
creates a string variable varname with the given value
allows timeouts on this machine even if the player didnt entered the level first
adds a string to a string list (saved as flag)
inserts a string into a string list at the specified index
replaces the string at position 'index' with 'text'
removes all occurences of a string
deletes string list entry at position 'index'
Effect
changes the npcs image
changes the npcs image and only displays the rectangle (x,y,width,height) of it
hides the npc
shows an hidden npc
lets the npc dont block the player anymore
turns off the three previous flags
draws the npc over the player
draws the npc under the player
draws the npc above day/night
changes the way the npc's image is drawn (0 - as light 1 - as transparency 2 - holes)
the npc can now be lifted and carried by the player
turns off the previous flag
the npc can now be pushed by the player
turns off the previous flag
the npc can now be pulled by the player
turns off the previous flag
Effect
moves the npc, options: cachtype(0,1,2)+blockcheck(4)+eventwhendone(8)+applydir(16)
displays signs
displays text as sign
lays an item
lays an item to the specified position
takes an item if available
takes the item with the specified index
displays a text message over the npc
lets the npcs timeout be shown
displays a player character instead of the npc image
sets string properties of the character
sets the animation for the npc
sets the gender of the npc (male/female)
triggers a if (action<action>)... on the objects on (x,y)
creates a npc, scriptname is the name of a textfile containing the npc script
creates a npc at given x,y with set {script}
calls the script of another npc (not immediatelly)
calls the script of a weapon (used together with the variable selectedweapon)
deletes the npc
the character carries an object
throwcarry;
followplayer;
toinventory flag;
toweapons weaponname;
setcoloreffect red,green,blue,alpha;
setzoomeffect zoomfactor;
showimg index,filename,x,y;
showimg index,@font@style@text,x,y;
showimg2 index,filename,x,y,z;
showani index,filename,x,y;
showani2 index,filename,x,y,z;
showpoly index,{x1,y1,...,xn,yn};
showpoly2 index,{x1,y1,z1,...,xn,yn,zn};
showtext index,x,y,font,style,text;
showtext2 index,x,y,z,font,style,text;
hideimg index;
hideimgs start-index,end-index;
changeimgpart index,x,y,width,height;
changeimgvis index,drawingheight;
changeimgcolors index,red,green,blue,alpha;
changeimgzoom index,zoomfactor;
changeimgmode index,mode;
shootarrow direction;
shootfireball direction;
shootfireblast direction;
shootnuke direction;
shootball;
spyfire length,power;
hitplayer index,halfhearts,fromx,fromy;
hitnpc index,halfhearts,fromx,fromy;
hitobjects power,x,y;
hidelocal;
showlocal;
dontblocklocal;
blockagainlocal;
takehorse index;
triggeraction x,y,action,params;
tokenize str;
tokenize2 delims,str;
setshape type,width,height;
setshape2 width,height,{tiletypes..};
wraptext linelength,delimeters,text;
wraptext2 width,zoom,delimiters,text;
setshootparams param1,param2;
shoot x,y,z,angle,zangle,powergani,aniparams;
Player Manipulation
setlevel filename;
setlevel2 filename,x,y;
seturllevel URL;
setbody filename;
sethead filename;
setsword imgname,power;
setshield imgname,power;
setani ganifile;
setplayerdir direction;
setgender gender;
setskincolor colorname;
setcoatcolor colorname;
setsleevecolor colorname;
setshoecolor colorname;
setbeltcolor colorname;
Effect
warps the player (URLs not supported)
warps the player to the specified level and position
warps the player to an URL (without the leading http://!)
sets the body image for the player
sets the head image for the player
changes the players sword (-20 power 20)
changes the players shield (0 power 10)
sets the animation for the player
sets the player looking direction
sets the gender of the player (male/female)
changes the player skin
changes the player coat
changes the player sleeves
changes the player shoes
changes the player belt
setplayerprop messagecode,string;
takeplayercarry;
takeplayerhorse;
disableweapons;
enableweapons;
freezeplayer seconds;
unfreezeplayer;
hideplayer seconds;
hidesword seconds;
hurt halfhearts;
disabledefmovement;
enabledefmovement;
disableselectweapons;
enableselectweapons;
disablepause;
enablepause;
disablemap;
enablemap;
enablefeatures flag;
replaceani ani,newani;
attachplayertoobj type,id;
detachplayer;
Effect
makes level board modifies visible
puts an object onto the board
puts a bomb on the board
puts an explosion on the board
puts an explosion on the board (power=1 -> normal, 3 -> jolt bomb)
procduces an object explosion (0-bush,1-swamp,2-stone,3-sign,4-ball,5-water)
puts a horse (or boat) on the board
the background gets the color palette of the specified image
signs will be displayed using the specified image instead of letters.png
changes the map, the player will be placed on (x,y)
changes the minimap, the player will be placed on (x,y)
sets the day/night effect (default 0,0,0,0)
sets the level focus to the given x,y
resets the focus to the player
disables hurting with sword/npc weapons
removes the bomb with the specified index
removes the arrow with the specified index
removes the item with the specified index
removes the explosion with the specified index
removes the horse with the specified index
explodes the bomb with the specified index
reflects the arrow with the specified index (like a mirror shield)
specifys the tiles images for all levels that start with 'levelstart' (0-standard type,1-new order)
replaces parts of the tiles image
removes all tile definitions from all levels which file begins with levelstart
loads terrain map (*.gmap) the level names must start with string & *.gmap file must start with strin
updates changes done to a level that is part of a *.gmap
shows/hides parts of the stats bar 1-ASD,2-icons,4-rupees,8-bombs,
16-arrows,32-hearts,64-ap,128-mp,256-minimap,512-inv,1024-player
Baddy Manipulation
putcomp baddyname,x,y;
putnewcomp baddyname,x,y,imgname,power;
hitcompu index,decrpower,fromx,fromy;
removecompus;
Effect
puts a new baddy on the board
puts a baddy on the board (with the specified image and power)
hurts a baddy
removes all baddies
File Operation
play filename;
Effect
plays a sound/music file or whatever can be played with Windows Media Player
play2 filename,x,y,volume;
playlooped filename;
stopsound filename;
stopmidi;
setmusicvolume left,right;
openurl URL;
openurl2 URL,width,height;
showfile filename;
In Game Flags
Player Flags
canspin
carrying
carriesblackstone
carriesbush
carriessign
carriesstone
carriesvase
hasweapon( name )
weaponsenabled
isleader
isonmap
isfocused
issparringzone
lighteffectsenabled
nopkzone
playeronline
playerchats
playerpaused
playermap
playerdies
playerendsreading
playerenters
playerhurt
playerisfemale
playerismale
playerlaysitem
playeronhorse
playerreading
playerswimming
playertouchsme
playertouchsother
playerattached
True When
the player has spin power (for sword)
the player carries something
the player carries a blackstone
the player carries a bush
the player carries a sign
the player carries a stone
the player carries a vase
the player has the weapon specified with name
the player weapons are enabled
the player entered the level first (of all players in the same room)
the player is on an outside level
the player is currently focused on
the player is in a sparring level
the player can see light effects
the player is in a level where you cant hurt other players
the game is in online mode
the player says something
the player is currently paused
the player is viewing the map
the player died
the player finished reading
the player enters the room
the player has been hurt
the player is female
the player is male (specified in headsconfig.txt)
somebody layed an item
the player rides on a horse (or boat)
the player is reading a sign
the player is swimming
the player touches the npc
the player touches another npc
the player is attached to this npc
NPC Flags
timeout
visible
followsplayer
washit
waspelt
wasshot
wasthrown
exploded
peltwithblackstone
peltwithbush
peltwithnpc
peltwithsign
peltwithstone
peltwithvase
shotbybaddy
shotbyplayer
True When
the npcs timeout counter runs to 0
the npc is visible
the npc currently follows the player
the npc was slayed with a sword or axe
the npc was pelt
the npc was shot with arrows
the npc was carried and then thrown
the npc was exploded by a bomb
the npc was pelt with a blackstone
the npc was pelt with a bush
the npc was pelt with another npc
the npc was pelt with a sign
the npc was pelt with a stone
the npc was pelt with a vase
the npc was shot by a computer opponent
the npc was shot by the player
Weapon Flags
True When
weaponfired
firedonhorse
isweapon
actionprojectile
actionprojectile2
Level Flags
compsdead
compusdied
onwall( x, y )
onwall2( x,y,w,h )
onwater( x, y )
True When
there is no living baddy
all baddies died
the specified point is blocked
the specified field is blocked
the specified field is water
String Flags
startswith( partstr, str )
strcontains( str, partstr )
strequals( str1, str2 )
True When
str starts with partstr
str contains partstr
str1=str2 (both strings can contain message codes)
Mouse Flags
leftmousebutton
rightmousebutton
middlemousebutton
mousedown
mouseup
mousewheel
actionleftmouse
actionrightmouse
actionmiddlemouse
actiondoublemouse
True When
the left mouse button has been pushed
the right mouse button has been pushed
the middle mouse button has been pushed
the mouse button is currently pushed down
the mouse button was just released
the mouse wheel has moved
the npc was clicked with the left mouse button
the npc was clicked with the right mouse button
the npc was clicked with the middle mouse button
the npc was double clicked
Keyboard Flags
keypressed
keydown( key )
keydown2( keycode,true )
True When
after any standard key has been pushed #p(0) is keycode #p(1) is character
the specified key is pressed (0..10: up,left,down,right,S,A,D,M,tab,Q,P)
checks if a key has been pressed
Variables
NPC's Own Variables
x
y
timeout
rupees
bombs
darts
hearts
glovepower
swordpower
shieldpower
dir
sprite
ap
hurtdx
hurtdy
save[ 0 ],..,save[ 9 ]
Value
the npcs horizontal position
the npcs vertical position (top=0)
the npcs timeout counter (seconds)
the npcs rupees count
the npcs bombs count
the npcs darts count
the npcs hearts count
the npcs glove power (1-glove1,2-glove2)
the npcs sword power (1-normal sword,2-axe,3-lizardsword,4-golden sword)
the npcs shield power (1-normal sword,2-mirror shield,3-lizard shield)
the direction of the character
the sprite of the character
the alignment points of the character
will be set when the player uses the sword/npc weapon on the npc
(x/y difference, >=-1, <=1)
built-in variables that work in online mode (integer values >=0, <=220)
Value
the npcs count
the server id of the npc
Player Variables
playerscount
players[ index ].x
players[ index ].y
players[ index ].freezetime
players[ index ].rupees
players[ index ].bombs
players[ index ].darts
players[ index ].mp
players[ index ].ap
players[ index ].hearts
players[ index ].fullhearts
players[ index ].dir
players[ index ].glovepower
players[ index ].swordpower
players[ index ].shieldpower
players[ index ].headset
players[ index ].sprite
players[ index ].anistep
players[ index ].id
players[ index ].saysnumber
players[ index ].id
players[ index ].attachid
players[ index ].attachtype
playerhurtdpower
playerhurtdx
playerhurtdy
selectedweapon
weaponscount
Value
the player count
a players horizontal position
a players vertical position
a player's remaining freezetime
a players rupees count
a players bombs count
a players darts count
a players magic points (0..100)
a players alignment points (0..100)
a players hearts count
a players max hearts count
a players direction (0-up,1-left,2-down,3-right)
a players glove power (2-glove1,3-glove2)
a players sword power (1-normal sword,2-axe,3-lizardsword,4-golden sword)
a players sield power (1-normal sword,2-mirror shield,3-lizard shield)
a players head sprites set (head+playerheadset+.gif)
a players sprites set (0..40)
current frame of the player's ani
a players id (=-1 for npc characters)
the (index+1)th player says that number
a players id (=-1 for npc characters)
the player is attached to the npc with that id (<=0-> not attached)
the type of object the player is attached to
how much power the player lost when hurt last
the horizontal hurting movement of the player
the vertical hurting movement of the player
the index of the selected weapon of the player
count of weapons/items the player has
Baddy Variables
compuscount
compus[ index ].x
compus[ index ].y
compus[ index ].type
compus[ index ].dir
compus[ index ].headdir
compus[ index ].power
compus[ index ].mode
Value
the baddy count
a baddys horizontal position
a baddys vertical position
a baddys type (0..9, see the baddy names list)
a baddys body direction (0..3)
a baddys head direction (0..3)
a baddys power
a baddys mode
Bomb Variables
Value
bombscount
bombs[ index ].x
bombs[ index ].y
bombs[ index ].power
bombs[ index ].time
Arrow Variables
arrowscount
arrows[ index ].x
arrows[ index ].y
arrows[ index ].dx
arrows[ index ].dy
arrows[ index ].dir
arrows[ index ].type
arrows[ index ].from
Value
the arrows count (arrows + balls)
an arrows horizontal position
an arrows vertical position
the horizontal speed per tick (0.05secs)
the vertical speed per tick (0.05secs)
the flying direction (0,1,2,3)
the shottype (-1 -> ball, 0..3 -> arrow with power 1..4)
the shooter (0 -> baddy, 1 -> current player)
Item Variables
itemscount
items[ index ].x
items[ index ].y
items[ index ].type
items[ index ].time
Value
the items count
an items horizontal position
an items vertical position
the item type (0..24)
the time left till the item disappears (8.2 .. 0)
Explosion Variables
exploscount
explos[ index ].x
explos[ index ].y
explos[ index ].power
explos[ index ].time
explos[ index ].dir
Value
the explosions count (putexplosion produces 9 explosions of size 2x2!)
an explosions horizontal position
an explosions vertical position
the power of the bomb which produced this explosion
the time left till the explosion disappears
the direction from the bomb which produced the explosion
Horse Variables
horsescount
horses[ index ].x
horses[ index ].y
horses[ index ].dir
horses[ index ].bushes
horses[ index ].bombs
horses[ index ].bombpower
horses[ index ].type
Value
the horses count
an horsess horizontal position
an horsess vertical position
the direction of the horse
bushes eaten by the horse
bombs count in the horses mouth
the power of the bombs on the horses mouth
the horse type (0 -> riding horse, 1 - boat)
Sign Variables
signscount
signs[ index ].x
signs[ index ].y
Value
the signs count
a signs horizontal position
a signs vertical position
Mouse Variables
mousex
mousey
mousebuttons
mousescreenx
mousescreeny
mousewheeldelta
Value
x position of the mouse in the level. (in tiles)
y position of the mouse in the level. (in tiles)
sum of mouse buttons being pressed (1=left 2=middle 3=right)
x position of the mouse on the game screen. (in pixels)
y position of the mouse on the game screen. (in pixels)
movement of the mouse wheel in the last .05 seconds.
Level Variables
levelorgx
levelorgy
onmapx( level )
onmapy( level )
groundsheight( x, y )
waterhieght( x, y )
gravity
Value
level origin (x), can be different to 0,0 if the player is attached to an npc
level origin (y)
x-position of the level on the current map
y-position of the level on the current map
the height of the ground at x,y
the depth of the water at x,y
the rate at which shot projectiles fall
timevar
screenheight
screenwidth
musicpos
musiclen
focusx
focusy
String Variables
arraylen( var )
sarraylen( list )
indexof( partstr, str )
lindexof( str, list )
strlen( str )
strtofloat( str )
tokenscount
Value
the size of an array
the size of a string list
position of where partstr appears in str (-1 -> not in str)
position of where the string appears in the string list
the length of the string
the value of str as number
count of tokens produced with tokenize
File Variables
Value
imgwidth( filename )
imgheight( filename )
graalversion
downloadsize
downloadpos
Functions
Mathmatical Functions
abs( var )
arctan( var )
cos( a )
getangle( dx,dy )
int( var )
random( a, b )
sin( a )
min( a,b )
max( a,b )
log( base,x )
Output
the absolute value
the arcus tangens of var; (some maths: a = arctan( sin(a) / cos(a) ))
the cosinus of a; a is an angle in the radiant system (0...3.14)
the angle of vector (dx,dy) to the x coordinate (0...2*3.14)
the integer value of a variable (truncates the floating point part)
a random floating point value, a<= value < b
the sinus of a; a is an angle in the radiant system (0...3.14)
finds the minimum between a and b
finds the maximum between a and b
finds the log of x with given base
Test Functions
testbomb( x, y )
testcompu( x, y )
testexplo( x, y )
testhorse( x, y )
testitem( x, y )
testnpc(x, y )
testplayer( x, y )
testsign( x, y )
tiletype( x, y )
Output
the index of the bomb on position (x,y)
the index of the baddy on position (x,y)
the index of the explosion on position (x,y)
the index of the horse on position (x,y)
the index of the item on position (x,y)
the index of the npc on position (x,y)
the index of the player on position (x,y)
the index of the sign on position (x,y)
the type of tile that is at x,y
Conversion Functions
ascii( index )
board[ index ]
tiles[ x,y ]
getz( x,y )
screenx( x,y )
screeny( x,y )
worldx( x,y )
worldy( x,y )
Output
the ascii code of a character
the level board (index = 0..64*64-1)
the index of the tiles at x,y
the z value of the specfied x,y cord
converts level cordinates to points on the screen
converts level cordinates to points on the screen
converts screen cordinates to points on the level
converts screen cordinates to points on the level
vecx( dir )
vecy( dir )
textwidth( zoom,font,style,text )
textheight( zoom,font,style,text )
Strings
Player Message Codse
#a
#n, #n( index )
#g, #g( index )
#c, #c( index )
#m, #m( index )
#W, #W( index )
#w,#w( index )
#1, #1( index )
#2, #2( index )
#3, #3( index )
#5, #5( index )
#6, #6( index )
#8, #8( index )
#C0, #C0( index )
#C1, #C1( index )
#C2, #C2( index )
#C3, #C3( index )
#C4, #C4( index )
Signifigance
the account name of the player
the nick name of the player (index=-1 -> npc character, 0 -> current player)
the guild name of the player
the current chat text of the player
the animation of the player
the filename of the weapon icon
the name of the current npc weapon of the player
the sword image filename of the player
the shield image filename of the player
the head image filename of the player
the image filename of the players horse
the image filename of the npc that is carried by the player
the body image filename of the player
the skin color
the coat color
the sleeves color
the shoes color
the belt color
Signifigance
the current level filename
the image filename of the npc
the gani attribute 1 (hat)
the gani attribute 2
action parameter of the specified index
Signifigance
extracts a substring out of string (length=-1 -> till the end)
gets a string of a string list
the value of the string variable var
token of the specified index, produced with tokenize
trims the string (removes spaces at the beginning and end)
randomly selects one of the strings
the value of var as string
Signifigance
line break (for say2)
displays an image or a part of an image when used in a sign
Signifigance
the name of the specified key
the description of the specified key (in local language / key assignments)
Signifigance
file currently being downloaded
Misc Information
Special Symbols
!
&&
||
==
+
Meaning
not
and
or
equals
addition
*
/
%
^
=
a += b
a -= b
a *= b
a /= b
a ++
a -in
this.
substraction
multiplication
division
mod; a%b = a - int(a/b)*b;
power; a^0.5 = squareroot(a)
assigment
a = a+b
a = a-b
a = a*b
a = a/b
a = a+1
a = a-1
tests if an array/range contains a variable (e.g. 2 in {1,2,3}; x,y in |0,64|)
variables that start with this. are only accessible for the npc itself
Player Sprites
0
1-8
9-13
14-18
19-22
23
24
25-32
33
34-36
37
38
39
40
Description
no movement, or not a default animation
walking
sword slaying
pushing
pulling
lifting
no movement, carrying something
walking, carrying something
shooting
riding
sitting
sleeping
hurted (can only be set on showcharacter-npcs)
dead (can only be set on showcharacter-npcs)
Directions
up
left
down
right
(you can also use normal variables with values between 0 and 3)
Baddy Names
graysoldier
bluesoldier
redsoldier
shootingsoldier
swampsoldier
frog
octopus
goldenwarrior
lizardon
dragon
Baddy Modes
0
1
2
3
4
5
6
7
8
9
Description
walking
looking
hunting
hurted
bumped
dying
shooting (swampsoldier)
jumping (frog)
shooting (spider)
dead
Enable Features
1
2
4
8
0x10
0x20
0x40
0x80
0x100
0x200
0x400
0x800
0x1000
0x2000
0x4000
0x8000
allfeatures
Itemname
greenrupee
bluerupee
redrupee
bombs
darts
heart
glove1
bow
bomb
shield
sword
fullheart
superbomb
battleaxe
goldensword
mirrorshield
glove2
lizardshield
lizardsword
goldrupee
fireball
fireblast
nukeshot
joltbomb
spinattack
Item Index
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Tile Types
0
2
3
4
5
6
7
8
9
11
12
20
21
22
Colors
white
yellow
orange
pink
red
darkred
lightgreen
green
darkgreen
lightblue
blue
darkblue
brown
cynober
purple
darkpurple
lightgray
gray
black
transparent
Carry Objects
bush
sign
vase
stone
blackstone
bomb
hotbomb
superbomb
joltbomb
hotjoltbomb
none