<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://graalonline.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Trant</id>
	<title>Graal Bible - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://graalonline.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Trant"/>
	<link rel="alternate" type="text/html" href="https://graalonline.net/Special:Contributions/Trant"/>
	<updated>2026-04-09T20:45:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.4</generator>
	<entry>
		<id>https://graalonline.net/index.php?title=Creation/Dev/Script/Starting_Guide&amp;diff=15781</id>
		<title>Creation/Dev/Script/Starting Guide</title>
		<link rel="alternate" type="text/html" href="https://graalonline.net/index.php?title=Creation/Dev/Script/Starting_Guide&amp;diff=15781"/>
		<updated>2010-04-16T15:48:38Z</updated>

		<summary type="html">&lt;p&gt;Trant: /* Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Scripting Tutorials]][[Category:Scripting Reference]]&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== Why scripts ===&lt;br /&gt;
&lt;br /&gt;
Scripts bring life into objects and make it easy to &lt;br /&gt;
customize the game. Instead of just placing a stone&lt;br /&gt;
into your world, you can make it so that the stone&lt;br /&gt;
can be lifted or kicked. Instead of being limited to&lt;br /&gt;
some fixed player movement you can rescript it&lt;br /&gt;
to let the player jump, strafe and duck. To let the &lt;br /&gt;
player inspect and organize his/her items you can&lt;br /&gt;
create some dialogs and display those by script,&lt;br /&gt;
e.g. when the player presses a special key.&lt;br /&gt;
&lt;br /&gt;
In Graal the scripting is done in 'Graal Script',&lt;br /&gt;
it's looking like Java/C++, but brings some &lt;br /&gt;
additional features for making things easier&lt;br /&gt;
for game creators, while on the other hand&lt;br /&gt;
running in a sandbox and limiting access to&lt;br /&gt;
game-related stuff only.&lt;br /&gt;
&lt;br /&gt;
Graal Script is almost fully compatible to &lt;br /&gt;
the 'old' Graal script used in Graal v1.0 - 3.0,&lt;br /&gt;
and is partially compatible to Torque script. &lt;br /&gt;
&lt;br /&gt;
=== NPCs and 'weapons' ===&lt;br /&gt;
&lt;br /&gt;
There are generally two types of objects in Graal&lt;br /&gt;
which have scripts: The first type are the &lt;br /&gt;
non-player-characters (NPCs). The name 'NPC' is&lt;br /&gt;
actually used for all visible objects in the game: &lt;br /&gt;
monsters, stones, bushes, houses, ships, plants etc.&lt;br /&gt;
Scripts for npcs are most of the time containing&lt;br /&gt;
code for moving the npc or for reacting to &lt;br /&gt;
activities of the player, e.g. giving money to&lt;br /&gt;
the player when he/she grabs the npc.&lt;br /&gt;
The other type of script-holding objects are the&lt;br /&gt;
'weapons'. Those are items in the inventory of&lt;br /&gt;
the player, not necessary being weapons. Most of&lt;br /&gt;
the time they are actually just scripts which&lt;br /&gt;
control the movement of the player, display weapon&lt;br /&gt;
graphics, or display menus.&lt;br /&gt;
&lt;br /&gt;
So there are objects in the game which have &lt;br /&gt;
their own script, and players which have a set&lt;br /&gt;
of scripts in their invisible backpack.&lt;br /&gt;
&lt;br /&gt;
=== Server-side and client-side ===&lt;br /&gt;
&lt;br /&gt;
Graal is an online game, and there are differences&lt;br /&gt;
to standard scripting in offline games.&lt;br /&gt;
In offline programs you have access to everything,&lt;br /&gt;
anytime. In online games everything is divided&lt;br /&gt;
into two parts: the server-side which controls&lt;br /&gt;
most things in the game, and the client-side which&lt;br /&gt;
displays the game to the player.&lt;br /&gt;
Since the client only displays things, it is not&lt;br /&gt;
possible to cheat by hacking the client. On client-side&lt;br /&gt;
you mainly have code for displaying special effects,&lt;br /&gt;
for displaying the GUI (windows, status bars, item menus),&lt;br /&gt;
playing sound effects and music. Also the player &lt;br /&gt;
movement is done on client-side.&lt;br /&gt;
On the server-side scripts are used to do the more&lt;br /&gt;
secure parts of the game engine,&lt;br /&gt;
and things that are the same for all players -&lt;br /&gt;
npcs are added, moved, npcs interact with players,&lt;br /&gt;
the stats of the players are calculated, the&lt;br /&gt;
communication between players is handled.&lt;br /&gt;
&lt;br /&gt;
All scripts for npcs and weapons can contain&lt;br /&gt;
server-side code and client-side code. The server-side&lt;br /&gt;
code is executed directly on the server, the&lt;br /&gt;
client-side code is sent to the client when he/she&lt;br /&gt;
logins and executed separately for each player on&lt;br /&gt;
their own computer. Usually the two parts of the script&lt;br /&gt;
are divided by a line that only contains &amp;quot;//#CLIENTSIDE&amp;quot;,&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;// Server-side part which is setting the image&lt;br /&gt;
// of the npc when it is created&lt;br /&gt;
function onCreated() {&lt;br /&gt;
  setimg(&amp;quot;door.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//#CLIENTSIDE&lt;br /&gt;
&lt;br /&gt;
// Here follows the client-side part,&lt;br /&gt;
// which plays a sound effect when the player&lt;br /&gt;
// touchs the npc&lt;br /&gt;
function onPlayerTouchsme() {&lt;br /&gt;
  play(&amp;quot;chest.wav&amp;quot;);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also see [[clientside]] and [[serverside]].&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
&lt;br /&gt;
In general scripts are made for reacting to &lt;br /&gt;
events - when the npc is created then the script&lt;br /&gt;
initializes the attributes of the npc,&lt;br /&gt;
when the player says something then the npc is&lt;br /&gt;
moving to the player, when the player grabs the&lt;br /&gt;
npc then the npc is giving the player some money etc.&lt;br /&gt;
So the script is basicly a collection of actions&lt;br /&gt;
that are done when special events are happening.&lt;br /&gt;
Events can e.g. be the &amp;quot;created&amp;quot; event when the npc&lt;br /&gt;
is created, the &amp;quot;playertouchsme&amp;quot; event when the &lt;br /&gt;
player touchs the npc, or the &amp;quot;playerchats&amp;quot; event&lt;br /&gt;
when the player says something. To write code that reacts&lt;br /&gt;
to one of those event, you define an event&lt;br /&gt;
function like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onEVENTNAME() {&lt;br /&gt;
  // actions&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the event is happening, then Graal executes&lt;br /&gt;
that scripting function and all commands you &lt;br /&gt;
have added there.&lt;br /&gt;
Sometimes the event gives some parameters to the &lt;br /&gt;
event function, then change your function to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onEVENTNAME(parameter1, parameter2, ...) {&lt;br /&gt;
  // actions&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By accessing 'parameter1' etc. (you can name&lt;br /&gt;
them differently) you can react to the event more&lt;br /&gt;
exactly. &lt;br /&gt;
&lt;br /&gt;
Instead of reacting to events, the npcs and&lt;br /&gt;
weapons can also invoke new events. That way &lt;br /&gt;
you can let other npcs doing things. You also&lt;br /&gt;
need that if you want to coninuously doing things -&lt;br /&gt;
use timeout events for that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onCreated() {&lt;br /&gt;
  setTimer(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function onTimeout() {&lt;br /&gt;
  // actions&lt;br /&gt;
  setTimer(1);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the onCreated event function the script is&lt;br /&gt;
setting the timer to 1 second. When that second is&lt;br /&gt;
over, then the &amp;quot;timeout&amp;quot; event is invoked on the&lt;br /&gt;
npc and the onTimeout event function is executed.&lt;br /&gt;
Because it is setting the timer to 1 second&lt;br /&gt;
again, the onTimeout event will occur again after&lt;br /&gt;
one second, and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Compatibility note:&lt;br /&gt;
In older Graal scripts you will also find the&lt;br /&gt;
deprecated way of receiving events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if (EVENTNAME) {&lt;br /&gt;
  // actions&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is an if-command outside of any brackets. If&lt;br /&gt;
Graal sees that you use such an if-command, then&lt;br /&gt;
it will execute the whole script so that the actions&lt;br /&gt;
you have written inside the if-command will be&lt;br /&gt;
executed too.&lt;br /&gt;
&lt;br /&gt;
The events for GUI controls are listed in the description of the different object types: &lt;br /&gt;
[[Creation/Dev/Script/Client#Classes_.2F_Object_Types|Object types]]&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== Accessing variables ===&lt;br /&gt;
&lt;br /&gt;
Graal Script variables are 'variant', that means they are objects&lt;br /&gt;
that hold values of different types.&lt;br /&gt;
When you assign a value to the variable then it automatically&lt;br /&gt;
switches to the right type:&lt;br /&gt;
&lt;br /&gt;
Numeric (floating point):&lt;br /&gt;
  var = 1;&lt;br /&gt;
String (text):&lt;br /&gt;
  var = &amp;quot;hello&amp;quot;;&lt;br /&gt;
Object link:&lt;br /&gt;
  var = player;&lt;br /&gt;
Array (list of objects):&lt;br /&gt;
  var = {1,2,3};&lt;br /&gt;
&lt;br /&gt;
You can check the current type with the&lt;br /&gt;
type()-function - obj.type() returns&lt;br /&gt;
0,1,2,3 for numeric, string, object or array.&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Addition                  a + b&lt;br /&gt;
Substraction              a - b&lt;br /&gt;
Mulitplication            a * b&lt;br /&gt;
Division                  a / b&lt;br /&gt;
Modulus                   a % b&lt;br /&gt;
Power                     a ^ b&lt;br /&gt;
String Concationation     a @ b&lt;br /&gt;
    with space            a SPC b&lt;br /&gt;
    with newline          a NL b&lt;br /&gt;
    with tabulator        a TAB b&lt;br /&gt;
Bool-And                  a &amp;amp;&amp;amp; b&lt;br /&gt;
Bool-Or                   a || b&lt;br /&gt;
Bool-Not                  !a&lt;br /&gt;
Negative                  -a&lt;br /&gt;
Equal                     a == b&lt;br /&gt;
Not-Equal                 a != b&lt;br /&gt;
Less                      a &amp;lt; b&lt;br /&gt;
Greater                   a &amp;gt; b&lt;br /&gt;
Less-Equal                a &amp;lt;= b,  a =&amp;lt; b&lt;br /&gt;
Greater-Equal             a &amp;gt;= b,  a =&amp;gt; b&lt;br /&gt;
In-Range                  a in &amp;lt;b,c&amp;gt;, a in |b,c&amp;gt;, a in &amp;lt;b,c|, a in |b,c|&lt;br /&gt;
In-Array                  a in {b,c,...}, {a,b,...} in {c,d,...}&lt;br /&gt;
Bitwise-Or                a | b&lt;br /&gt;
Bitwise-And               a &amp;amp; b&lt;br /&gt;
Bitwise-Shift left        a &amp;lt;&amp;lt; b&lt;br /&gt;
Bitwise-Shift right       a &amp;gt;&amp;gt; b&lt;br /&gt;
Bitwise-Invert            ~a&lt;br /&gt;
Bitwise-Xor               a xor b (operator ^ already used for power)&lt;br /&gt;
Array-Constructor         {a,b,...}&lt;br /&gt;
Empty Array               new [count], new[countdim1][countdim2]...&lt;br /&gt;
Array Member              a[index]&lt;br /&gt;
Function call             a(), a(b,c,...)&lt;br /&gt;
Object Attribute          a.b, a.(b)&lt;br /&gt;
Post Increment            a++&lt;br /&gt;
Post Decrement            a--&lt;br /&gt;
Pre Increment             ++a&lt;br /&gt;
Pre Decrement             --a&lt;br /&gt;
Old String Function       #a&lt;br /&gt;
Conditional               a? b : c&lt;br /&gt;
Assignment                a = b, a := b&lt;br /&gt;
Additive Assignment       a += b&lt;br /&gt;
Substractive Assignment   a -= b&lt;br /&gt;
Multiplicative Assignment a *= b&lt;br /&gt;
Division Assignment       a /= b&lt;br /&gt;
Modulus Assignment        a %= b&lt;br /&gt;
Power Assignment          a ^= b&lt;br /&gt;
Bitwise-Or Assignment     a |= b&lt;br /&gt;
Bitwise-And Assignment    a &amp;amp;= b&lt;br /&gt;
Shift Left Assignment     a &amp;lt;&amp;lt;= b&lt;br /&gt;
Shift Right Assignment    a &amp;gt;&amp;gt;= b&lt;br /&gt;
String Append             a @= b&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Standard object functions ===&lt;br /&gt;
&lt;br /&gt;
Here only some of the built-in functions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj.type()  - gets the type of the var (float 0, string 1, object 2, array 3)&lt;br /&gt;
obj.length() - string length&lt;br /&gt;
obj.trim() - removes spaces from the front and back of a string&lt;br /&gt;
obj.lower() - converts a string to lower case&lt;br /&gt;
obj.upper() - converts a string to upper case&lt;br /&gt;
obj.tokenize([delimiters]) - splits the string into an array wherever the delimiters occur&lt;br /&gt;
obj.charat(pos) - character at specified position&lt;br /&gt;
obj.pos(substring) - first position of the substring in the string&lt;br /&gt;
obj.positions(substring) - array of positions of the substring in the string&lt;br /&gt;
obj.starts(string) - does the string start with the specified string?&lt;br /&gt;
obj.ends(string) - does the string end with the specified string?&lt;br /&gt;
obj.substring(index[,length]) - returns the string starting at the index and ending after the length specified&lt;br /&gt;
obj.size() - array length&lt;br /&gt;
obj.add(obj2) - adds an object to an array&lt;br /&gt;
obj.delete(index) - deletes the object from an array at the specified index&lt;br /&gt;
obj.remove(obj2) - removes the first instance of the specified object from the array&lt;br /&gt;
obj.replace(index,obj2) - replace the object at the specified index&lt;br /&gt;
obj.insert(index,obj2) - insert the object at the index without replacing other indexes&lt;br /&gt;
obj.clear() - clear the array&lt;br /&gt;
obj.subarray(index[,length])&lt;br /&gt;
obj.addarray(obj2)&lt;br /&gt;
obj.insertarray(index,obj2)&lt;br /&gt;
obj.index(obj2) - position of obj2 in the array&lt;br /&gt;
obj.indices(obj2) - positions of obj2 in the array&lt;br /&gt;
obj.link() - used to pass an array to a function which&lt;br /&gt;
  can modify the array, also prevents copying of huge arrays&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also see [[Creation/Dev/Script/Client/TGraalVar|TGraalVar]] for more functions for objects.&lt;br /&gt;
&lt;br /&gt;
=== Standard functions ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
_(string) - translates a text on serverside &lt;br /&gt;
  to the language of the current player, &lt;br /&gt;
  if translations are enabled&lt;br /&gt;
abs(float) - returns absolute value of the float&lt;br /&gt;
arctan(float) - arcus tangens&lt;br /&gt;
char(ascii) - gets the character for an ascii code (char(65) returns 'A')&lt;br /&gt;
cos(angle) - cosinus of a radiant angle&lt;br /&gt;
exp(float)&lt;br /&gt;
float(string) - for explicitely converting a string &lt;br /&gt;
  to number (normally done automatically though&lt;br /&gt;
  when accessing a string with numeric operators)&lt;br /&gt;
format(format,parameters,...) - formats a &amp;quot;%s %d&amp;quot; string, &lt;br /&gt;
  inserts the parameters, and returns a string&lt;br /&gt;
getangle(delta x,delta y) - [http://en.wikipedia.org/wiki/Atan2 atan2]&lt;br /&gt;
getdir(delta x,delta y) - returns the direction for the delta x and y&lt;br /&gt;
int(a) - gets the integer part of a floating point number (truncates at the decimal)&lt;br /&gt;
log(base,a)&lt;br /&gt;
max(a,b) - returns the highest value between the two given&lt;br /&gt;
min(a,b) - returns the lowest value between the two given&lt;br /&gt;
printf(format,parameters,...) - same as &lt;br /&gt;
  echo(format(format,parameters,...))&lt;br /&gt;
random(rangestart,rangeend) - returns a random float between rangestart and rangeend&lt;br /&gt;
sin(angle) - sinus of a radiant angle&lt;br /&gt;
sleep(time) - suspends the current script for the time&lt;br /&gt;
vecx(direction 0..3) - direction to move x if dir is the specified direction&lt;br /&gt;
vecy(direction 0..3) - direction to move y if dir is the specified direction&lt;br /&gt;
waitfor(objectname,event[,timeout]) - suspends the current script&lt;br /&gt;
  and waits until an event is invoked on the specified object,&lt;br /&gt;
  returns false when the parameters are wrong or the event&lt;br /&gt;
  was not received before the timeout;&lt;br /&gt;
  only available in the latest versions of npcserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also see [[Creation/Dev/Script/Client#Functions|Client Functions]] for more functions.&lt;br /&gt;
&lt;br /&gt;
== Old script compatibility ==&lt;br /&gt;
&lt;br /&gt;
=== Removed functionality ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- toinventory&lt;br /&gt;
- followplayer&lt;br /&gt;
- playersays()&lt;br /&gt;
- setbackpal&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Supported old scripting commands and their mapping to new script ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addstring oldstring, oldstring;&lt;br /&gt;
                                list.add(string);&lt;br /&gt;
addtiledef oldstring, oldstring, float;&lt;br /&gt;
                                addtiledef(string,string,float);&lt;br /&gt;
addtiledef2 oldstring, oldstring, float, float;&lt;br /&gt;
                                addtiledef2(string,string,float,float);&lt;br /&gt;
attachplayertoobj float, float;&lt;br /&gt;
                                attachplayertoobj(float,float);&lt;br /&gt;
blockagain;&lt;br /&gt;
                                blockagain();&lt;br /&gt;
blockagainlocal;&lt;br /&gt;
                                blockagainlocal();&lt;br /&gt;
callnpc float, oldstring;&lt;br /&gt;
                                callnpc(float,string);&lt;br /&gt;
callweapon float, oldstring;&lt;br /&gt;
                                callweapon(float,string);&lt;br /&gt;
canbecarried;&lt;br /&gt;
                                canbecarried();&lt;br /&gt;
canbepulled;&lt;br /&gt;
                                canbepulled();&lt;br /&gt;
canbepushed;&lt;br /&gt;
                                canbepushed();&lt;br /&gt;
cannotbecarried;&lt;br /&gt;
                                cannotbecarried();&lt;br /&gt;
cannotbepulled;&lt;br /&gt;
                                cannotbepulled();&lt;br /&gt;
cannotbepushed;&lt;br /&gt;
                                cannotbepushed();&lt;br /&gt;
canwarp;&lt;br /&gt;
                                canwarp();&lt;br /&gt;
canwarp2;&lt;br /&gt;
                                canwarp2();&lt;br /&gt;
carryobject oldstring;&lt;br /&gt;
                                carryobject(string);&lt;br /&gt;
changeimgcolors float, float, float, float, float;&lt;br /&gt;
                                changeimgcolors(float,float,float,float,float);&lt;br /&gt;
changeimgmode float, float;&lt;br /&gt;
                                changeimgmode(float,float);&lt;br /&gt;
changeimgpart float, float, float, float, float;&lt;br /&gt;
                                changeimgpart(float,float,float,float,float);&lt;br /&gt;
changeimgvis float, float;&lt;br /&gt;
                                changeimgvis(float,float);&lt;br /&gt;
changeimgzoom float, float;&lt;br /&gt;
                                changeimgzoom(float,float);&lt;br /&gt;
deletestring oldstring, float;&lt;br /&gt;
                                deletestring(string,float);&lt;br /&gt;
destroy;&lt;br /&gt;
                                destroy();&lt;br /&gt;
detachplayer;&lt;br /&gt;
                                detachplayer();&lt;br /&gt;
disabledefmovement;&lt;br /&gt;
                                disabledefmovement();&lt;br /&gt;
disablemap;&lt;br /&gt;
                                disablemap();&lt;br /&gt;
disablepause;&lt;br /&gt;
                                disablepause();&lt;br /&gt;
disableselectweapons;&lt;br /&gt;
                                disableselectweapons();&lt;br /&gt;
disableweapons;&lt;br /&gt;
                                disableweapons();&lt;br /&gt;
dontblock;&lt;br /&gt;
                                dontblock();&lt;br /&gt;
dontblocklocal;&lt;br /&gt;
                                dontblocklocal();&lt;br /&gt;
drawaslight;&lt;br /&gt;
                                drawaslight();&lt;br /&gt;
drawoverplayer;&lt;br /&gt;
                                drawoverplayer();&lt;br /&gt;
drawunderplayer;&lt;br /&gt;
                                drawunderplayer();&lt;br /&gt;
enabledefmovement;&lt;br /&gt;
                                enabledefmovement();&lt;br /&gt;
enablefeatures float;&lt;br /&gt;
                                enablefeatures(float);&lt;br /&gt;
enablemap;&lt;br /&gt;
                                enablemap();&lt;br /&gt;
enablepause;&lt;br /&gt;
                                enablepause();&lt;br /&gt;
enableselectweapons;&lt;br /&gt;
                                enableselectweapons();&lt;br /&gt;
enableweapons;&lt;br /&gt;
                                enableweapons();&lt;br /&gt;
explodebomb float;&lt;br /&gt;
                                explodebomb(float);&lt;br /&gt;
followplayer;&lt;br /&gt;
                                followplayer();&lt;br /&gt;
freezeplayer float;&lt;br /&gt;
                                freezeplayer(float);&lt;br /&gt;
freezeplayer2;&lt;br /&gt;
                                freezeplayer2();&lt;br /&gt;
hide;&lt;br /&gt;
                                hide();&lt;br /&gt;
hideimg float;&lt;br /&gt;
                                hideimg(float);&lt;br /&gt;
hideimgs float, float;&lt;br /&gt;
                                hideimgs(float,float);&lt;br /&gt;
hidelocal;&lt;br /&gt;
                                hidelocal();&lt;br /&gt;
&lt;br /&gt;
hitcompu float, float, float, float;&lt;br /&gt;
                                hitcompu(float,float,float,float);&lt;br /&gt;
hitnpc float, float, float, float;&lt;br /&gt;
                                hitnpc(float,float,float,float);&lt;br /&gt;
hitobjects float, float, float;&lt;br /&gt;
                                hitobjects(float,float,float);&lt;br /&gt;
hideplayer float;&lt;br /&gt;
                                hideplayer(float);&lt;br /&gt;
hidesword float;&lt;br /&gt;
                                hidesword(float);&lt;br /&gt;
hitplayer float, float, float, float;&lt;br /&gt;
                                hitplayer(float,float,float,float);&lt;br /&gt;
hurt float;&lt;br /&gt;
                                hurt(float);&lt;br /&gt;
insertstring oldstring, float, oldstring;&lt;br /&gt;
                                insertstring(string,float,string);&lt;br /&gt;
join oldstring;&lt;br /&gt;
                                join(string);&lt;br /&gt;
lay oldstring;&lt;br /&gt;
                                lay(string);&lt;br /&gt;
lay2 oldstring, float, float;&lt;br /&gt;
                                lay2(string,float,float);&lt;br /&gt;
loadmap oldstring;&lt;br /&gt;
                                loadmap(string);&lt;br /&gt;
message oldstring;&lt;br /&gt;
                                message(string);&lt;br /&gt;
move float, float, float, float;&lt;br /&gt;
                                move(float,float,float,float);&lt;br /&gt;
noplayerkilling;&lt;br /&gt;
                                noplayerkilling();&lt;br /&gt;
openurl oldstring;&lt;br /&gt;
                                openurl(string);&lt;br /&gt;
openurl2 oldstring, float, float;&lt;br /&gt;
                                openurl2(string,float,float);&lt;br /&gt;
play oldstring;&lt;br /&gt;
                                play(string);&lt;br /&gt;
play2 oldstring, float, float, float;&lt;br /&gt;
                                play2(string,float,float,float);&lt;br /&gt;
playlooped oldstring;&lt;br /&gt;
                                playlooped(string);&lt;br /&gt;
putbomb float, float, float;&lt;br /&gt;
                                putbomb(float,float,float);&lt;br /&gt;
putcomp oldstring, float, float;&lt;br /&gt;
                                putcomp(string,float,float);&lt;br /&gt;
putexplosion float, float, float;&lt;br /&gt;
                                putexplosion(float,float,float);&lt;br /&gt;
putexplosion2 float, float, float, float;&lt;br /&gt;
                                putexplosion2(float,float,float,float);&lt;br /&gt;
puthorse oldstring, float, float;&lt;br /&gt;
                                puthorse(string,float,float);&lt;br /&gt;
putleaps float, float, float;&lt;br /&gt;
                                putleaps(float,float,float);&lt;br /&gt;
putnewcomp oldstring, float, float, oldstring, float;&lt;br /&gt;
                                putnewcomp(string,float,float,string,float);&lt;br /&gt;
putnpc oldstring, oldstring, float, float;&lt;br /&gt;
                                putnpc(string,string,float,float);&lt;br /&gt;
putnpc2 float, float, oldstring;&lt;br /&gt;
                                putnpc2(float,float,string);&lt;br /&gt;
reflectarrow float;&lt;br /&gt;
                                reflectarrow(float);&lt;br /&gt;
removearrow float;&lt;br /&gt;
                                removearrow(float);&lt;br /&gt;
removebomb float;&lt;br /&gt;
                                removebomb(float);&lt;br /&gt;
removecompus;&lt;br /&gt;
                                removecompus();&lt;br /&gt;
removeexplo float;&lt;br /&gt;
                                removeexplo(float);&lt;br /&gt;
removehorse float;&lt;br /&gt;
                                removehorse(float);&lt;br /&gt;
rmeoveitem float;&lt;br /&gt;
                                removeitem(float)&lt;br /&gt;
removestring oldstring, oldstring;&lt;br /&gt;
                                removestring(string,string);&lt;br /&gt;
removetiledefs oldstring;&lt;br /&gt;
                                removetiledefs(string);&lt;br /&gt;
replaceani oldstring, oldstring;&lt;br /&gt;
                                replaceani(string,string);&lt;br /&gt;
replacestring oldstring, float, oldstring;&lt;br /&gt;
                                replacestring(string,float,string);&lt;br /&gt;
resetfocus;&lt;br /&gt;
                                resetfocus();&lt;br /&gt;
savelog oldstring;&lt;br /&gt;
                                savelog(string);&lt;br /&gt;
savelog2 oldstring, oldstring;&lt;br /&gt;
                                savelog2(string,string);&lt;br /&gt;
say float;&lt;br /&gt;
                                say(float);&lt;br /&gt;
say2 oldstring;&lt;br /&gt;
                                say2(string);&lt;br /&gt;
sendrpgmessage oldstring;&lt;br /&gt;
                                sendrpgmessage(string);&lt;br /&gt;
sendpm oldstring;&lt;br /&gt;
                                sendpm(string);&lt;br /&gt;
sendtonc oldstring;&lt;br /&gt;
                                sendtonc(string);&lt;br /&gt;
sendtorc oldstring;&lt;br /&gt;
                                sendtorc(string);&lt;br /&gt;
serverwarp oldstring;&lt;br /&gt;
                                serverwarp(string);&lt;br /&gt;
set oldstring;&lt;br /&gt;
                                set(string);&lt;br /&gt;
setani oldstring, oldstring;&lt;br /&gt;
                                setani(string,string);&lt;br /&gt;
setarray float, float;&lt;br /&gt;
                                setarray(var,float);&lt;br /&gt;
setbeltcolor oldstring;&lt;br /&gt;
                                setbeltcolor(string);&lt;br /&gt;
setbow oldstring;&lt;br /&gt;
                                setbow(string);&lt;br /&gt;
setcharani oldstring, oldstring;&lt;br /&gt;
                                setcharani(string,string);&lt;br /&gt;
setchargender oldstring;&lt;br /&gt;
                                setchargender(string);&lt;br /&gt;
setcharprop oldstring, oldstring;&lt;br /&gt;
                                string = string;&lt;br /&gt;
setcoatcolor oldstring;&lt;br /&gt;
                                setcoatcolor(string);&lt;br /&gt;
setcoloreffect float, float, float, float;&lt;br /&gt;
                                setcoloreffect(float,float,float,float);&lt;br /&gt;
setcursor float;&lt;br /&gt;
                                setcursor(float);&lt;br /&gt;
setcurcor2 oldstring;&lt;br /&gt;
                                setcursor2(string);&lt;br /&gt;
seteffect float, float, float, float;&lt;br /&gt;
                                seteffect(float,float,float,float);&lt;br /&gt;
seteffectmode float;&lt;br /&gt;
                                seteffectmode(float);&lt;br /&gt;
setfocus float, float;&lt;br /&gt;
                                setfocus(float,float);&lt;br /&gt;
setgender oldstring;&lt;br /&gt;
                                setgender(string);&lt;br /&gt;
sethead oldstring;&lt;br /&gt;
                                sethead(string);&lt;br /&gt;
setlevel oldstring;&lt;br /&gt;
                                setlevel(string);&lt;br /&gt;
setlevel2 oldstring, float, float;&lt;br /&gt;
                                setlevel2(string,float,float);&lt;br /&gt;
setmap oldstring, oldstring, float, float;&lt;br /&gt;
                                setmap(string,string,float,float);&lt;br /&gt;
setminimap oldstring, oldstring, float, float;&lt;br /&gt;
                                setminimap(string,string,float,float);&lt;br /&gt;
setmusicvolume float, float;&lt;br /&gt;
                                setmusicvolume(float,float);&lt;br /&gt;
setimg oldstring;&lt;br /&gt;
                                setimg(string);&lt;br /&gt;
setimgpart oldstring, float, float, float, float;&lt;br /&gt;
                                setimgpart(string,float,float,float,float);&lt;br /&gt;
setletters oldstring;&lt;br /&gt;
                                setletters(string);&lt;br /&gt;
setplayerdir oldstring;&lt;br /&gt;
                                setplayerdir(string);&lt;br /&gt;
setplayerprop oldstring, oldstring;&lt;br /&gt;
                                string = string;&lt;br /&gt;
setpm oldstring;&lt;br /&gt;
                                setpm(string);&lt;br /&gt;
setshape float, float, float;&lt;br /&gt;
                                setshape(float,float,float);&lt;br /&gt;
setshape2 float, float, float;&lt;br /&gt;
                                setshape2(float,float,float);&lt;br /&gt;
setshield oldstring, float;&lt;br /&gt;
                                setshield(string,float);&lt;br /&gt;
setshoecolor oldstring;&lt;br /&gt;
                                setshoecolor(string);&lt;br /&gt;
setshootparams oldstring;&lt;br /&gt;
                                setshootparams(string);&lt;br /&gt;
setskincolor oldstring;&lt;br /&gt;
                                setskincolor(string);&lt;br /&gt;
setsleevecolor oldstring;&lt;br /&gt;
                                setsleevecolor(string);&lt;br /&gt;
setstring oldstring, oldstring;&lt;br /&gt;
                                setstring(string,string);&lt;br /&gt;
setsword oldstring, float;&lt;br /&gt;
                                setsword(string,float);&lt;br /&gt;
seturllevel oldstring;&lt;br /&gt;
                                seturllevel(string);&lt;br /&gt;
setz float, float, float, float, float, float, float, float;&lt;br /&gt;
                                setz(float,float,float,float,float,float,float,float);&lt;br /&gt;
setzoomeffect float;&lt;br /&gt;
                                setzoomeffect(float);&lt;br /&gt;
shoot float, float, float, float, float, float, oldstring, oldstring;&lt;br /&gt;
                                shoot(float,float,float,float,float,float,string,string);&lt;br /&gt;
shootarrow float;&lt;br /&gt;
                                shootarrow(float);&lt;br /&gt;
shootball;&lt;br /&gt;
                                shootball();&lt;br /&gt;
shootfireball float;&lt;br /&gt;
                                shootfireball(float);&lt;br /&gt;
shootfireblast float;&lt;br /&gt;
                                shootfireblast(float);&lt;br /&gt;
shootnuke float;&lt;br /&gt;
                                shootnuke(float);&lt;br /&gt;
show;&lt;br /&gt;
                                show();&lt;br /&gt;
showani float, float, float, float, oldstring;&lt;br /&gt;
                                showani(float,float,float,float,string);&lt;br /&gt;
showani2 float, float, float, float, float, oldstring;&lt;br /&gt;
                                showani2(float,float,float,float,float,string);&lt;br /&gt;
showcharacter;&lt;br /&gt;
                                showcharacter();&lt;br /&gt;
showfile oldstring;&lt;br /&gt;
                                showfile(string);&lt;br /&gt;
showimg float, oldstring, float, float;&lt;br /&gt;
                                showimg(float,string,float,float);&lt;br /&gt;
showimg2 float, oldstring, float, float, float;&lt;br /&gt;
                                showimg2(float,string,float,float,float);&lt;br /&gt;
showlocal;&lt;br /&gt;
                                showlocal();&lt;br /&gt;
&lt;br /&gt;
showpoly float, float;&lt;br /&gt;
                                showpoly(float,array);&lt;br /&gt;
showpoly2 float, float;&lt;br /&gt;
                                showpoly2(float,array);&lt;br /&gt;
showstats float;&lt;br /&gt;
                                showstats(float);&lt;br /&gt;
showtext float, float, float, oldstring, oldstring, oldstring;&lt;br /&gt;
                                showtext(float,float,float,string,string,string);&lt;br /&gt;
showtext2 float, float, float, float, oldstring, oldstring, oldstring;&lt;br /&gt;
                                showtext2(float,float,float,float,string,string,string);&lt;br /&gt;
sleep float;&lt;br /&gt;
                                sleep(float);&lt;br /&gt;
spyfire float, float;&lt;br /&gt;
                                spyfire(float,float);&lt;br /&gt;
stopmidi;&lt;br /&gt;
                                stopmidi();&lt;br /&gt;
stopsound oldstring;&lt;br /&gt;
                                stopsound(string);&lt;br /&gt;
take oldstring;&lt;br /&gt;
                                take(string);&lt;br /&gt;
take2 float;&lt;br /&gt;
                                take2(float);&lt;br /&gt;
takehorse float;&lt;br /&gt;
                                takehorse(float);&lt;br /&gt;
takeplayercarry;&lt;br /&gt;
                                takeplayercarry();&lt;br /&gt;
takeplayerhorse;&lt;br /&gt;
                                takeplayerhorse();&lt;br /&gt;
throwcarry;&lt;br /&gt;
                                throwcarry();&lt;br /&gt;
timereverywhere;&lt;br /&gt;
                                timereverywhere();&lt;br /&gt;
timershow;&lt;br /&gt;
                                timershow();&lt;br /&gt;
toinventory oldstring;&lt;br /&gt;
                                toinventory(string);&lt;br /&gt;
tokenize oldstring;&lt;br /&gt;
                                tokens = string.tokenize();&lt;br /&gt;
tokenize2 oldstring, oldstring;&lt;br /&gt;
                                tokens = string.tokenize(&amp;quot; ,&amp;quot; @ string);&lt;br /&gt;
toweapons oldstring;&lt;br /&gt;
                                toweapons(string);&lt;br /&gt;
triggeraction float, float, oldstring, oldstring;&lt;br /&gt;
                                triggeraction(float,float,string,string);&lt;br /&gt;
unfreezeplayer;&lt;br /&gt;
                                unfreezeplayer();&lt;br /&gt;
unset oldstring;&lt;br /&gt;
                                unset(string);&lt;br /&gt;
updateboard float, float, float, float;&lt;br /&gt;
                                updateboard(float,float,float,float);&lt;br /&gt;
updateterrain;&lt;br /&gt;
                                updateterrain();&lt;br /&gt;
wraptext float, oldstring, oldstring;&lt;br /&gt;
                                tokens = wraptext(float,&amp;quot; ,&amp;quot; @ string,string);&lt;br /&gt;
wraptext2 float, float, oldstring, oldstring;&lt;br /&gt;
                                tokens = wraptext2(float,float,&amp;quot; ,&amp;quot; @ string,string);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Supported old string operations ===&lt;br /&gt;
These old string operators can be used in string parameters&lt;br /&gt;
for the old commands, also you can use them directly as operators, e.g.&lt;br /&gt;
  #c = &amp;quot;hello&amp;quot;&lt;br /&gt;
is actually doing&lt;br /&gt;
  player.chat = &amp;quot;hello&amp;quot;&lt;br /&gt;
It is recommended to use the new scripting style though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#a            player.account&lt;br /&gt;
#a(float)     players[float].account&lt;br /&gt;
#m            player.ani&lt;br /&gt;
              ani&lt;br /&gt;
#m(float)     players[float].ani&lt;br /&gt;
#K(float)     char(float)&lt;br /&gt;
#8            player.bodyimg&lt;br /&gt;
              bodyimg&lt;br /&gt;
#8(float)     players[float].bodyimg&lt;br /&gt;
#c            player.chat&lt;br /&gt;
              chat&lt;br /&gt;
#c(float)     players[float].chat&lt;br /&gt;
#C0           player.colors[0]&lt;br /&gt;
              colors[0]&lt;br /&gt;
#C0(float)    players[float].colors[0]&lt;br /&gt;
#C1           player.colors[1]&lt;br /&gt;
              colors[1]&lt;br /&gt;
#C1(float)    players[float].colors[1]&lt;br /&gt;
#C2           player.colors[2]&lt;br /&gt;
              colors[2]&lt;br /&gt;
#C2(float)    players[float].colors[2]&lt;br /&gt;
#C3           player.colors[3]&lt;br /&gt;
              colors[3]&lt;br /&gt;
#C3(float)    players[float].colors[3]&lt;br /&gt;
#C4           player.colors[4]&lt;br /&gt;
              colors[4]&lt;br /&gt;
#C4(float)    players[float].colors[4]&lt;br /&gt;
#C5           player.colors[5]&lt;br /&gt;
              colors[5]&lt;br /&gt;
#C5(float)    players[float].colors[5]&lt;br /&gt;
#D            downloadfile()&lt;br /&gt;
#E            emoticonchar()&lt;br /&gt;
#e(float,float,oldstring)&lt;br /&gt;
              string.substring(float,float)&lt;br /&gt;
#g            player.guild&lt;br /&gt;
              guild&lt;br /&gt;
#g(float)     players[float].guild&lt;br /&gt;
#3            player.headimg&lt;br /&gt;
              headimg&lt;br /&gt;
#3(float)     players[float].headimg&lt;br /&gt;
#5            player.horseimg&lt;br /&gt;
              horseimg&lt;br /&gt;
#5(float)     players[float].horseimg&lt;br /&gt;
#k(float)     keyname(float)&lt;br /&gt;
#L            player.level&lt;br /&gt;
#I(oldstring,float)&lt;br /&gt;
              getstring(string)[float]&lt;br /&gt;
#n            player.nick&lt;br /&gt;
              nick&lt;br /&gt;
#n(float)     players[float].nick&lt;br /&gt;
#f            image&lt;br /&gt;
#f(float)     npcs[float].image&lt;br /&gt;
#F            level&lt;br /&gt;
#p(float)     params[float]&lt;br /&gt;
#P(float)     player.attr[float]&lt;br /&gt;
              attr[float]&lt;br /&gt;
#P(float_1,float_2)&lt;br /&gt;
              players[float_2].attr[float_1]&lt;br /&gt;
#P1           player.attr[1]&lt;br /&gt;
              attr[1]&lt;br /&gt;
#P1(float)    players[float].attr[1]&lt;br /&gt;
#P2           player.attr[2]&lt;br /&gt;
              attr[2]&lt;br /&gt;
#P2(float)    players[float].attr[2]&lt;br /&gt;
#P3           player.attr[3]&lt;br /&gt;
              attr[3]&lt;br /&gt;
#P3(float)    players[float].attr[3]&lt;br /&gt;
#P4           player.attr[4]&lt;br /&gt;
              attr[4]&lt;br /&gt;
#P4(float)    players[float].attr[4]&lt;br /&gt;
#P5           player.attr[5]&lt;br /&gt;
              attr[5]&lt;br /&gt;
#P5(float)    players[float].attr[5]&lt;br /&gt;
#P6           player.attr[6]&lt;br /&gt;
              attr[6]&lt;br /&gt;
#P6(float)    players[float].attr[6]&lt;br /&gt;
#P7           player.attr[7]&lt;br /&gt;
              attr[7]&lt;br /&gt;
#P7(float)    players[float].attr[7]&lt;br /&gt;
#P8           player.attr[8]&lt;br /&gt;
              attr[8]&lt;br /&gt;
#P8(float)    players[float].attr[8]&lt;br /&gt;
#P9           player.attr[9]&lt;br /&gt;
              attr[9]&lt;br /&gt;
#P9(float)    players[float].attr[9]&lt;br /&gt;
#R(oldstring) string.random()&lt;br /&gt;
#2            player.shieldimg&lt;br /&gt;
              shieldimg&lt;br /&gt;
#2(float)     players[float].shieldimg&lt;br /&gt;
#s(oldstring) getstring(string)&lt;br /&gt;
#1            player.swordimg&lt;br /&gt;
              swordimg&lt;br /&gt;
#1(float)     players[float].swordimg&lt;br /&gt;
#S            player.sword.script&lt;br /&gt;
#t(float)     tokens[float]&lt;br /&gt;
#T(oldstring) string.trim()&lt;br /&gt;
#v(float)     float&lt;br /&gt;
#W            player.weapon.image&lt;br /&gt;
#W(float)     weapons[float].image&lt;br /&gt;
#w            player.weapon.name&lt;br /&gt;
#w(float)     weapons[float].name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compatibility note:&lt;br /&gt;
When you use the command setcharprop then the first parameter&lt;br /&gt;
is handled differently: instead of changing 'player.chat' it&lt;br /&gt;
is changing 'chat', the chat text of the npc. So 'setcharprop #c,hello'&lt;br /&gt;
would be translated into&lt;br /&gt;
chat = &amp;quot;hello&amp;quot;&lt;br /&gt;
while 'setplayerprop #c,hello' is translated into&lt;br /&gt;
player.chat = &amp;quot;hello&amp;quot;&lt;br /&gt;
In the list above both possibilities are listed.&lt;/div&gt;</summary>
		<author><name>Trant</name></author>
	</entry>
	<entry>
		<id>https://graalonline.net/index.php?title=Creation/Dev/Script/Starting_Guide&amp;diff=15780</id>
		<title>Creation/Dev/Script/Starting Guide</title>
		<link rel="alternate" type="text/html" href="https://graalonline.net/index.php?title=Creation/Dev/Script/Starting_Guide&amp;diff=15780"/>
		<updated>2010-04-16T15:47:41Z</updated>

		<summary type="html">&lt;p&gt;Trant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Scripting Tutorials]][[Category:Scripting Reference]]&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== Why scripts ===&lt;br /&gt;
&lt;br /&gt;
Scripts bring life into objects and make it easy to &lt;br /&gt;
customize the game. Instead of just placing a stone&lt;br /&gt;
into your world, you can make it so that the stone&lt;br /&gt;
can be lifted or kicked. Instead of being limited to&lt;br /&gt;
some fixed player movement you can rescript it&lt;br /&gt;
to let the player jump, strafe and duck. To let the &lt;br /&gt;
player inspect and organize his/her items you can&lt;br /&gt;
create some dialogs and display those by script,&lt;br /&gt;
e.g. when the player presses a special key.&lt;br /&gt;
&lt;br /&gt;
In Graal the scripting is done in 'Graal Script',&lt;br /&gt;
it's looking like Java/C++, but brings some &lt;br /&gt;
additional features for making things easier&lt;br /&gt;
for game creators, while on the other hand&lt;br /&gt;
running in a sandbox and limiting access to&lt;br /&gt;
game-related stuff only.&lt;br /&gt;
&lt;br /&gt;
Graal Script is almost fully compatible to &lt;br /&gt;
the 'old' Graal script used in Graal v1.0 - 3.0,&lt;br /&gt;
and is partially compatible to Torque script. &lt;br /&gt;
&lt;br /&gt;
=== NPCs and 'weapons' ===&lt;br /&gt;
&lt;br /&gt;
There are generally two types of objects in Graal&lt;br /&gt;
which have scripts: The first type are the &lt;br /&gt;
non-player-characters (NPCs). The name 'NPC' is&lt;br /&gt;
actually used for all visible objects in the game: &lt;br /&gt;
monsters, stones, bushes, houses, ships, plants etc.&lt;br /&gt;
Scripts for npcs are most of the time containing&lt;br /&gt;
code for moving the npc or for reacting to &lt;br /&gt;
activities of the player, e.g. giving money to&lt;br /&gt;
the player when he/she grabs the npc.&lt;br /&gt;
The other type of script-holding objects are the&lt;br /&gt;
'weapons'. Those are items in the inventory of&lt;br /&gt;
the player, not necessary being weapons. Most of&lt;br /&gt;
the time they are actually just scripts which&lt;br /&gt;
control the movement of the player, display weapon&lt;br /&gt;
graphics, or display menus.&lt;br /&gt;
&lt;br /&gt;
So there are objects in the game which have &lt;br /&gt;
their own script, and players which have a set&lt;br /&gt;
of scripts in their invisible backpack.&lt;br /&gt;
&lt;br /&gt;
=== Server-side and client-side ===&lt;br /&gt;
&lt;br /&gt;
Graal is an online game, and there are differences&lt;br /&gt;
to standard scripting in offline games.&lt;br /&gt;
In offline programs you have access to everything,&lt;br /&gt;
anytime. In online games everything is divided&lt;br /&gt;
into two parts: the server-side which controls&lt;br /&gt;
most things in the game, and the client-side which&lt;br /&gt;
displays the game to the player.&lt;br /&gt;
Since the client only displays things, it is not&lt;br /&gt;
possible to cheat by hacking the client. On client-side&lt;br /&gt;
you mainly have code for displaying special effects,&lt;br /&gt;
for displaying the GUI (windows, status bars, item menus),&lt;br /&gt;
playing sound effects and music. Also the player &lt;br /&gt;
movement is done on client-side.&lt;br /&gt;
On the server-side scripts are used to do the more&lt;br /&gt;
secure parts of the game engine,&lt;br /&gt;
and things that are the same for all players -&lt;br /&gt;
npcs are added, moved, npcs interact with players,&lt;br /&gt;
the stats of the players are calculated, the&lt;br /&gt;
communication between players is handled.&lt;br /&gt;
&lt;br /&gt;
All scripts for npcs and weapons can contain&lt;br /&gt;
server-side code and client-side code. The server-side&lt;br /&gt;
code is executed directly on the server, the&lt;br /&gt;
client-side code is sent to the client when he/she&lt;br /&gt;
logins and executed separately for each player on&lt;br /&gt;
their own computer. Usually the two parts of the script&lt;br /&gt;
are divided by a line that only contains &amp;quot;//#CLIENTSIDE&amp;quot;,&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;// Server-side part which is setting the image&lt;br /&gt;
// of the npc when it is created&lt;br /&gt;
function onCreated() {&lt;br /&gt;
  setimg(&amp;quot;door.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//#CLIENTSIDE&lt;br /&gt;
&lt;br /&gt;
// Here follows the client-side part,&lt;br /&gt;
// which plays a sound effect when the player&lt;br /&gt;
// touchs the npc&lt;br /&gt;
function onPlayerTouchsme() {&lt;br /&gt;
  play(&amp;quot;chest.wav&amp;quot;);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also see [[clientside]] and [[serverside]].&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
&lt;br /&gt;
In general scripts are made for reacting to &lt;br /&gt;
events - when the npc is created then the script&lt;br /&gt;
initializes the attributes of the npc,&lt;br /&gt;
when the player says something then the npc is&lt;br /&gt;
moving to the player, when the player grabs the&lt;br /&gt;
npc then the npc is giving the player some money etc.&lt;br /&gt;
So the script is basicly a collection of actions&lt;br /&gt;
that are done when special events are happening.&lt;br /&gt;
Events can e.g. be the &amp;quot;created&amp;quot; event when the npc&lt;br /&gt;
is created, the &amp;quot;playertouchsme&amp;quot; event when the &lt;br /&gt;
player touchs the npc, or the &amp;quot;playerchats&amp;quot; event&lt;br /&gt;
when the player says something. To write code that reacts&lt;br /&gt;
to one of those event, you define an event&lt;br /&gt;
function like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onEVENTNAME() {&lt;br /&gt;
  // actions&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the event is happening, then Graal executes&lt;br /&gt;
that scripting function and all commands you &lt;br /&gt;
have added there.&lt;br /&gt;
Sometimes the event gives some parameters to the &lt;br /&gt;
event function, then change your function to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onEVENTNAME(parameter1, parameter2, ...) {&lt;br /&gt;
  // actions&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By accessing 'parameter1' etc. (you can name&lt;br /&gt;
them differently) you can react to the event more&lt;br /&gt;
exactly. &lt;br /&gt;
&lt;br /&gt;
Instead of reacting to events, the npcs and&lt;br /&gt;
weapons can also invoke new events. That way &lt;br /&gt;
you can let other npcs doing things. You also&lt;br /&gt;
need that if you want to coninuously doing things -&lt;br /&gt;
use timeout events for that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onCreated() {&lt;br /&gt;
  setTimer(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function onTimeout() {&lt;br /&gt;
  // actions&lt;br /&gt;
  setTimer(1);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the onCreated event function the script is&lt;br /&gt;
setting the timer to 1 second. When that second is&lt;br /&gt;
over, then the &amp;quot;timeout&amp;quot; event is invoked on the&lt;br /&gt;
npc and the onTimeout event function is executed.&lt;br /&gt;
Because it is setting the timer to 1 second&lt;br /&gt;
again, the onTimeout event will occur again after&lt;br /&gt;
one second, and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Compatibility note:&lt;br /&gt;
In older Graal scripts you will also find the&lt;br /&gt;
deprecated way of receiving events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if (EVENTNAME) {&lt;br /&gt;
  // actions&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is an if-command outside of any brackets. If&lt;br /&gt;
Graal sees that you use such an if-command, then&lt;br /&gt;
it will execute the whole script so that the actions&lt;br /&gt;
you have written inside the if-command will be&lt;br /&gt;
executed too.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== Accessing variables ===&lt;br /&gt;
&lt;br /&gt;
Graal Script variables are 'variant', that means they are objects&lt;br /&gt;
that hold values of different types.&lt;br /&gt;
When you assign a value to the variable then it automatically&lt;br /&gt;
switches to the right type:&lt;br /&gt;
&lt;br /&gt;
Numeric (floating point):&lt;br /&gt;
  var = 1;&lt;br /&gt;
String (text):&lt;br /&gt;
  var = &amp;quot;hello&amp;quot;;&lt;br /&gt;
Object link:&lt;br /&gt;
  var = player;&lt;br /&gt;
Array (list of objects):&lt;br /&gt;
  var = {1,2,3};&lt;br /&gt;
&lt;br /&gt;
You can check the current type with the&lt;br /&gt;
type()-function - obj.type() returns&lt;br /&gt;
0,1,2,3 for numeric, string, object or array.&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Addition                  a + b&lt;br /&gt;
Substraction              a - b&lt;br /&gt;
Mulitplication            a * b&lt;br /&gt;
Division                  a / b&lt;br /&gt;
Modulus                   a % b&lt;br /&gt;
Power                     a ^ b&lt;br /&gt;
String Concationation     a @ b&lt;br /&gt;
    with space            a SPC b&lt;br /&gt;
    with newline          a NL b&lt;br /&gt;
    with tabulator        a TAB b&lt;br /&gt;
Bool-And                  a &amp;amp;&amp;amp; b&lt;br /&gt;
Bool-Or                   a || b&lt;br /&gt;
Bool-Not                  !a&lt;br /&gt;
Negative                  -a&lt;br /&gt;
Equal                     a == b&lt;br /&gt;
Not-Equal                 a != b&lt;br /&gt;
Less                      a &amp;lt; b&lt;br /&gt;
Greater                   a &amp;gt; b&lt;br /&gt;
Less-Equal                a &amp;lt;= b,  a =&amp;lt; b&lt;br /&gt;
Greater-Equal             a &amp;gt;= b,  a =&amp;gt; b&lt;br /&gt;
In-Range                  a in &amp;lt;b,c&amp;gt;, a in |b,c&amp;gt;, a in &amp;lt;b,c|, a in |b,c|&lt;br /&gt;
In-Array                  a in {b,c,...}, {a,b,...} in {c,d,...}&lt;br /&gt;
Bitwise-Or                a | b&lt;br /&gt;
Bitwise-And               a &amp;amp; b&lt;br /&gt;
Bitwise-Shift left        a &amp;lt;&amp;lt; b&lt;br /&gt;
Bitwise-Shift right       a &amp;gt;&amp;gt; b&lt;br /&gt;
Bitwise-Invert            ~a&lt;br /&gt;
Bitwise-Xor               a xor b (operator ^ already used for power)&lt;br /&gt;
Array-Constructor         {a,b,...}&lt;br /&gt;
Empty Array               new [count], new[countdim1][countdim2]...&lt;br /&gt;
Array Member              a[index]&lt;br /&gt;
Function call             a(), a(b,c,...)&lt;br /&gt;
Object Attribute          a.b, a.(b)&lt;br /&gt;
Post Increment            a++&lt;br /&gt;
Post Decrement            a--&lt;br /&gt;
Pre Increment             ++a&lt;br /&gt;
Pre Decrement             --a&lt;br /&gt;
Old String Function       #a&lt;br /&gt;
Conditional               a? b : c&lt;br /&gt;
Assignment                a = b, a := b&lt;br /&gt;
Additive Assignment       a += b&lt;br /&gt;
Substractive Assignment   a -= b&lt;br /&gt;
Multiplicative Assignment a *= b&lt;br /&gt;
Division Assignment       a /= b&lt;br /&gt;
Modulus Assignment        a %= b&lt;br /&gt;
Power Assignment          a ^= b&lt;br /&gt;
Bitwise-Or Assignment     a |= b&lt;br /&gt;
Bitwise-And Assignment    a &amp;amp;= b&lt;br /&gt;
Shift Left Assignment     a &amp;lt;&amp;lt;= b&lt;br /&gt;
Shift Right Assignment    a &amp;gt;&amp;gt;= b&lt;br /&gt;
String Append             a @= b&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Standard object functions ===&lt;br /&gt;
&lt;br /&gt;
Here only some of the built-in functions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj.type()  - gets the type of the var (float 0, string 1, object 2, array 3)&lt;br /&gt;
obj.length() - string length&lt;br /&gt;
obj.trim() - removes spaces from the front and back of a string&lt;br /&gt;
obj.lower() - converts a string to lower case&lt;br /&gt;
obj.upper() - converts a string to upper case&lt;br /&gt;
obj.tokenize([delimiters]) - splits the string into an array wherever the delimiters occur&lt;br /&gt;
obj.charat(pos) - character at specified position&lt;br /&gt;
obj.pos(substring) - first position of the substring in the string&lt;br /&gt;
obj.positions(substring) - array of positions of the substring in the string&lt;br /&gt;
obj.starts(string) - does the string start with the specified string?&lt;br /&gt;
obj.ends(string) - does the string end with the specified string?&lt;br /&gt;
obj.substring(index[,length]) - returns the string starting at the index and ending after the length specified&lt;br /&gt;
obj.size() - array length&lt;br /&gt;
obj.add(obj2) - adds an object to an array&lt;br /&gt;
obj.delete(index) - deletes the object from an array at the specified index&lt;br /&gt;
obj.remove(obj2) - removes the first instance of the specified object from the array&lt;br /&gt;
obj.replace(index,obj2) - replace the object at the specified index&lt;br /&gt;
obj.insert(index,obj2) - insert the object at the index without replacing other indexes&lt;br /&gt;
obj.clear() - clear the array&lt;br /&gt;
obj.subarray(index[,length])&lt;br /&gt;
obj.addarray(obj2)&lt;br /&gt;
obj.insertarray(index,obj2)&lt;br /&gt;
obj.index(obj2) - position of obj2 in the array&lt;br /&gt;
obj.indices(obj2) - positions of obj2 in the array&lt;br /&gt;
obj.link() - used to pass an array to a function which&lt;br /&gt;
  can modify the array, also prevents copying of huge arrays&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also see [[Creation/Dev/Script/Client/TGraalVar|TGraalVar]] for more functions for objects.&lt;br /&gt;
&lt;br /&gt;
=== Standard functions ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
_(string) - translates a text on serverside &lt;br /&gt;
  to the language of the current player, &lt;br /&gt;
  if translations are enabled&lt;br /&gt;
abs(float) - returns absolute value of the float&lt;br /&gt;
arctan(float) - arcus tangens&lt;br /&gt;
char(ascii) - gets the character for an ascii code (char(65) returns 'A')&lt;br /&gt;
cos(angle) - cosinus of a radiant angle&lt;br /&gt;
exp(float)&lt;br /&gt;
float(string) - for explicitely converting a string &lt;br /&gt;
  to number (normally done automatically though&lt;br /&gt;
  when accessing a string with numeric operators)&lt;br /&gt;
format(format,parameters,...) - formats a &amp;quot;%s %d&amp;quot; string, &lt;br /&gt;
  inserts the parameters, and returns a string&lt;br /&gt;
getangle(delta x,delta y) - [http://en.wikipedia.org/wiki/Atan2 atan2]&lt;br /&gt;
getdir(delta x,delta y) - returns the direction for the delta x and y&lt;br /&gt;
int(a) - gets the integer part of a floating point number (truncates at the decimal)&lt;br /&gt;
log(base,a)&lt;br /&gt;
max(a,b) - returns the highest value between the two given&lt;br /&gt;
min(a,b) - returns the lowest value between the two given&lt;br /&gt;
printf(format,parameters,...) - same as &lt;br /&gt;
  echo(format(format,parameters,...))&lt;br /&gt;
random(rangestart,rangeend) - returns a random float between rangestart and rangeend&lt;br /&gt;
sin(angle) - sinus of a radiant angle&lt;br /&gt;
sleep(time) - suspends the current script for the time&lt;br /&gt;
vecx(direction 0..3) - direction to move x if dir is the specified direction&lt;br /&gt;
vecy(direction 0..3) - direction to move y if dir is the specified direction&lt;br /&gt;
waitfor(objectname,event[,timeout]) - suspends the current script&lt;br /&gt;
  and waits until an event is invoked on the specified object,&lt;br /&gt;
  returns false when the parameters are wrong or the event&lt;br /&gt;
  was not received before the timeout;&lt;br /&gt;
  only available in the latest versions of npcserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also see [[Creation/Dev/Script/Client#Functions|Client Functions]] for more functions.&lt;br /&gt;
&lt;br /&gt;
== Old script compatibility ==&lt;br /&gt;
&lt;br /&gt;
=== Removed functionality ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- toinventory&lt;br /&gt;
- followplayer&lt;br /&gt;
- playersays()&lt;br /&gt;
- setbackpal&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Supported old scripting commands and their mapping to new script ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addstring oldstring, oldstring;&lt;br /&gt;
                                list.add(string);&lt;br /&gt;
addtiledef oldstring, oldstring, float;&lt;br /&gt;
                                addtiledef(string,string,float);&lt;br /&gt;
addtiledef2 oldstring, oldstring, float, float;&lt;br /&gt;
                                addtiledef2(string,string,float,float);&lt;br /&gt;
attachplayertoobj float, float;&lt;br /&gt;
                                attachplayertoobj(float,float);&lt;br /&gt;
blockagain;&lt;br /&gt;
                                blockagain();&lt;br /&gt;
blockagainlocal;&lt;br /&gt;
                                blockagainlocal();&lt;br /&gt;
callnpc float, oldstring;&lt;br /&gt;
                                callnpc(float,string);&lt;br /&gt;
callweapon float, oldstring;&lt;br /&gt;
                                callweapon(float,string);&lt;br /&gt;
canbecarried;&lt;br /&gt;
                                canbecarried();&lt;br /&gt;
canbepulled;&lt;br /&gt;
                                canbepulled();&lt;br /&gt;
canbepushed;&lt;br /&gt;
                                canbepushed();&lt;br /&gt;
cannotbecarried;&lt;br /&gt;
                                cannotbecarried();&lt;br /&gt;
cannotbepulled;&lt;br /&gt;
                                cannotbepulled();&lt;br /&gt;
cannotbepushed;&lt;br /&gt;
                                cannotbepushed();&lt;br /&gt;
canwarp;&lt;br /&gt;
                                canwarp();&lt;br /&gt;
canwarp2;&lt;br /&gt;
                                canwarp2();&lt;br /&gt;
carryobject oldstring;&lt;br /&gt;
                                carryobject(string);&lt;br /&gt;
changeimgcolors float, float, float, float, float;&lt;br /&gt;
                                changeimgcolors(float,float,float,float,float);&lt;br /&gt;
changeimgmode float, float;&lt;br /&gt;
                                changeimgmode(float,float);&lt;br /&gt;
changeimgpart float, float, float, float, float;&lt;br /&gt;
                                changeimgpart(float,float,float,float,float);&lt;br /&gt;
changeimgvis float, float;&lt;br /&gt;
                                changeimgvis(float,float);&lt;br /&gt;
changeimgzoom float, float;&lt;br /&gt;
                                changeimgzoom(float,float);&lt;br /&gt;
deletestring oldstring, float;&lt;br /&gt;
                                deletestring(string,float);&lt;br /&gt;
destroy;&lt;br /&gt;
                                destroy();&lt;br /&gt;
detachplayer;&lt;br /&gt;
                                detachplayer();&lt;br /&gt;
disabledefmovement;&lt;br /&gt;
                                disabledefmovement();&lt;br /&gt;
disablemap;&lt;br /&gt;
                                disablemap();&lt;br /&gt;
disablepause;&lt;br /&gt;
                                disablepause();&lt;br /&gt;
disableselectweapons;&lt;br /&gt;
                                disableselectweapons();&lt;br /&gt;
disableweapons;&lt;br /&gt;
                                disableweapons();&lt;br /&gt;
dontblock;&lt;br /&gt;
                                dontblock();&lt;br /&gt;
dontblocklocal;&lt;br /&gt;
                                dontblocklocal();&lt;br /&gt;
drawaslight;&lt;br /&gt;
                                drawaslight();&lt;br /&gt;
drawoverplayer;&lt;br /&gt;
                                drawoverplayer();&lt;br /&gt;
drawunderplayer;&lt;br /&gt;
                                drawunderplayer();&lt;br /&gt;
enabledefmovement;&lt;br /&gt;
                                enabledefmovement();&lt;br /&gt;
enablefeatures float;&lt;br /&gt;
                                enablefeatures(float);&lt;br /&gt;
enablemap;&lt;br /&gt;
                                enablemap();&lt;br /&gt;
enablepause;&lt;br /&gt;
                                enablepause();&lt;br /&gt;
enableselectweapons;&lt;br /&gt;
                                enableselectweapons();&lt;br /&gt;
enableweapons;&lt;br /&gt;
                                enableweapons();&lt;br /&gt;
explodebomb float;&lt;br /&gt;
                                explodebomb(float);&lt;br /&gt;
followplayer;&lt;br /&gt;
                                followplayer();&lt;br /&gt;
freezeplayer float;&lt;br /&gt;
                                freezeplayer(float);&lt;br /&gt;
freezeplayer2;&lt;br /&gt;
                                freezeplayer2();&lt;br /&gt;
hide;&lt;br /&gt;
                                hide();&lt;br /&gt;
hideimg float;&lt;br /&gt;
                                hideimg(float);&lt;br /&gt;
hideimgs float, float;&lt;br /&gt;
                                hideimgs(float,float);&lt;br /&gt;
hidelocal;&lt;br /&gt;
                                hidelocal();&lt;br /&gt;
&lt;br /&gt;
hitcompu float, float, float, float;&lt;br /&gt;
                                hitcompu(float,float,float,float);&lt;br /&gt;
hitnpc float, float, float, float;&lt;br /&gt;
                                hitnpc(float,float,float,float);&lt;br /&gt;
hitobjects float, float, float;&lt;br /&gt;
                                hitobjects(float,float,float);&lt;br /&gt;
hideplayer float;&lt;br /&gt;
                                hideplayer(float);&lt;br /&gt;
hidesword float;&lt;br /&gt;
                                hidesword(float);&lt;br /&gt;
hitplayer float, float, float, float;&lt;br /&gt;
                                hitplayer(float,float,float,float);&lt;br /&gt;
hurt float;&lt;br /&gt;
                                hurt(float);&lt;br /&gt;
insertstring oldstring, float, oldstring;&lt;br /&gt;
                                insertstring(string,float,string);&lt;br /&gt;
join oldstring;&lt;br /&gt;
                                join(string);&lt;br /&gt;
lay oldstring;&lt;br /&gt;
                                lay(string);&lt;br /&gt;
lay2 oldstring, float, float;&lt;br /&gt;
                                lay2(string,float,float);&lt;br /&gt;
loadmap oldstring;&lt;br /&gt;
                                loadmap(string);&lt;br /&gt;
message oldstring;&lt;br /&gt;
                                message(string);&lt;br /&gt;
move float, float, float, float;&lt;br /&gt;
                                move(float,float,float,float);&lt;br /&gt;
noplayerkilling;&lt;br /&gt;
                                noplayerkilling();&lt;br /&gt;
openurl oldstring;&lt;br /&gt;
                                openurl(string);&lt;br /&gt;
openurl2 oldstring, float, float;&lt;br /&gt;
                                openurl2(string,float,float);&lt;br /&gt;
play oldstring;&lt;br /&gt;
                                play(string);&lt;br /&gt;
play2 oldstring, float, float, float;&lt;br /&gt;
                                play2(string,float,float,float);&lt;br /&gt;
playlooped oldstring;&lt;br /&gt;
                                playlooped(string);&lt;br /&gt;
putbomb float, float, float;&lt;br /&gt;
                                putbomb(float,float,float);&lt;br /&gt;
putcomp oldstring, float, float;&lt;br /&gt;
                                putcomp(string,float,float);&lt;br /&gt;
putexplosion float, float, float;&lt;br /&gt;
                                putexplosion(float,float,float);&lt;br /&gt;
putexplosion2 float, float, float, float;&lt;br /&gt;
                                putexplosion2(float,float,float,float);&lt;br /&gt;
puthorse oldstring, float, float;&lt;br /&gt;
                                puthorse(string,float,float);&lt;br /&gt;
putleaps float, float, float;&lt;br /&gt;
                                putleaps(float,float,float);&lt;br /&gt;
putnewcomp oldstring, float, float, oldstring, float;&lt;br /&gt;
                                putnewcomp(string,float,float,string,float);&lt;br /&gt;
putnpc oldstring, oldstring, float, float;&lt;br /&gt;
                                putnpc(string,string,float,float);&lt;br /&gt;
putnpc2 float, float, oldstring;&lt;br /&gt;
                                putnpc2(float,float,string);&lt;br /&gt;
reflectarrow float;&lt;br /&gt;
                                reflectarrow(float);&lt;br /&gt;
removearrow float;&lt;br /&gt;
                                removearrow(float);&lt;br /&gt;
removebomb float;&lt;br /&gt;
                                removebomb(float);&lt;br /&gt;
removecompus;&lt;br /&gt;
                                removecompus();&lt;br /&gt;
removeexplo float;&lt;br /&gt;
                                removeexplo(float);&lt;br /&gt;
removehorse float;&lt;br /&gt;
                                removehorse(float);&lt;br /&gt;
rmeoveitem float;&lt;br /&gt;
                                removeitem(float)&lt;br /&gt;
removestring oldstring, oldstring;&lt;br /&gt;
                                removestring(string,string);&lt;br /&gt;
removetiledefs oldstring;&lt;br /&gt;
                                removetiledefs(string);&lt;br /&gt;
replaceani oldstring, oldstring;&lt;br /&gt;
                                replaceani(string,string);&lt;br /&gt;
replacestring oldstring, float, oldstring;&lt;br /&gt;
                                replacestring(string,float,string);&lt;br /&gt;
resetfocus;&lt;br /&gt;
                                resetfocus();&lt;br /&gt;
savelog oldstring;&lt;br /&gt;
                                savelog(string);&lt;br /&gt;
savelog2 oldstring, oldstring;&lt;br /&gt;
                                savelog2(string,string);&lt;br /&gt;
say float;&lt;br /&gt;
                                say(float);&lt;br /&gt;
say2 oldstring;&lt;br /&gt;
                                say2(string);&lt;br /&gt;
sendrpgmessage oldstring;&lt;br /&gt;
                                sendrpgmessage(string);&lt;br /&gt;
sendpm oldstring;&lt;br /&gt;
                                sendpm(string);&lt;br /&gt;
sendtonc oldstring;&lt;br /&gt;
                                sendtonc(string);&lt;br /&gt;
sendtorc oldstring;&lt;br /&gt;
                                sendtorc(string);&lt;br /&gt;
serverwarp oldstring;&lt;br /&gt;
                                serverwarp(string);&lt;br /&gt;
set oldstring;&lt;br /&gt;
                                set(string);&lt;br /&gt;
setani oldstring, oldstring;&lt;br /&gt;
                                setani(string,string);&lt;br /&gt;
setarray float, float;&lt;br /&gt;
                                setarray(var,float);&lt;br /&gt;
setbeltcolor oldstring;&lt;br /&gt;
                                setbeltcolor(string);&lt;br /&gt;
setbow oldstring;&lt;br /&gt;
                                setbow(string);&lt;br /&gt;
setcharani oldstring, oldstring;&lt;br /&gt;
                                setcharani(string,string);&lt;br /&gt;
setchargender oldstring;&lt;br /&gt;
                                setchargender(string);&lt;br /&gt;
setcharprop oldstring, oldstring;&lt;br /&gt;
                                string = string;&lt;br /&gt;
setcoatcolor oldstring;&lt;br /&gt;
                                setcoatcolor(string);&lt;br /&gt;
setcoloreffect float, float, float, float;&lt;br /&gt;
                                setcoloreffect(float,float,float,float);&lt;br /&gt;
setcursor float;&lt;br /&gt;
                                setcursor(float);&lt;br /&gt;
setcurcor2 oldstring;&lt;br /&gt;
                                setcursor2(string);&lt;br /&gt;
seteffect float, float, float, float;&lt;br /&gt;
                                seteffect(float,float,float,float);&lt;br /&gt;
seteffectmode float;&lt;br /&gt;
                                seteffectmode(float);&lt;br /&gt;
setfocus float, float;&lt;br /&gt;
                                setfocus(float,float);&lt;br /&gt;
setgender oldstring;&lt;br /&gt;
                                setgender(string);&lt;br /&gt;
sethead oldstring;&lt;br /&gt;
                                sethead(string);&lt;br /&gt;
setlevel oldstring;&lt;br /&gt;
                                setlevel(string);&lt;br /&gt;
setlevel2 oldstring, float, float;&lt;br /&gt;
                                setlevel2(string,float,float);&lt;br /&gt;
setmap oldstring, oldstring, float, float;&lt;br /&gt;
                                setmap(string,string,float,float);&lt;br /&gt;
setminimap oldstring, oldstring, float, float;&lt;br /&gt;
                                setminimap(string,string,float,float);&lt;br /&gt;
setmusicvolume float, float;&lt;br /&gt;
                                setmusicvolume(float,float);&lt;br /&gt;
setimg oldstring;&lt;br /&gt;
                                setimg(string);&lt;br /&gt;
setimgpart oldstring, float, float, float, float;&lt;br /&gt;
                                setimgpart(string,float,float,float,float);&lt;br /&gt;
setletters oldstring;&lt;br /&gt;
                                setletters(string);&lt;br /&gt;
setplayerdir oldstring;&lt;br /&gt;
                                setplayerdir(string);&lt;br /&gt;
setplayerprop oldstring, oldstring;&lt;br /&gt;
                                string = string;&lt;br /&gt;
setpm oldstring;&lt;br /&gt;
                                setpm(string);&lt;br /&gt;
setshape float, float, float;&lt;br /&gt;
                                setshape(float,float,float);&lt;br /&gt;
setshape2 float, float, float;&lt;br /&gt;
                                setshape2(float,float,float);&lt;br /&gt;
setshield oldstring, float;&lt;br /&gt;
                                setshield(string,float);&lt;br /&gt;
setshoecolor oldstring;&lt;br /&gt;
                                setshoecolor(string);&lt;br /&gt;
setshootparams oldstring;&lt;br /&gt;
                                setshootparams(string);&lt;br /&gt;
setskincolor oldstring;&lt;br /&gt;
                                setskincolor(string);&lt;br /&gt;
setsleevecolor oldstring;&lt;br /&gt;
                                setsleevecolor(string);&lt;br /&gt;
setstring oldstring, oldstring;&lt;br /&gt;
                                setstring(string,string);&lt;br /&gt;
setsword oldstring, float;&lt;br /&gt;
                                setsword(string,float);&lt;br /&gt;
seturllevel oldstring;&lt;br /&gt;
                                seturllevel(string);&lt;br /&gt;
setz float, float, float, float, float, float, float, float;&lt;br /&gt;
                                setz(float,float,float,float,float,float,float,float);&lt;br /&gt;
setzoomeffect float;&lt;br /&gt;
                                setzoomeffect(float);&lt;br /&gt;
shoot float, float, float, float, float, float, oldstring, oldstring;&lt;br /&gt;
                                shoot(float,float,float,float,float,float,string,string);&lt;br /&gt;
shootarrow float;&lt;br /&gt;
                                shootarrow(float);&lt;br /&gt;
shootball;&lt;br /&gt;
                                shootball();&lt;br /&gt;
shootfireball float;&lt;br /&gt;
                                shootfireball(float);&lt;br /&gt;
shootfireblast float;&lt;br /&gt;
                                shootfireblast(float);&lt;br /&gt;
shootnuke float;&lt;br /&gt;
                                shootnuke(float);&lt;br /&gt;
show;&lt;br /&gt;
                                show();&lt;br /&gt;
showani float, float, float, float, oldstring;&lt;br /&gt;
                                showani(float,float,float,float,string);&lt;br /&gt;
showani2 float, float, float, float, float, oldstring;&lt;br /&gt;
                                showani2(float,float,float,float,float,string);&lt;br /&gt;
showcharacter;&lt;br /&gt;
                                showcharacter();&lt;br /&gt;
showfile oldstring;&lt;br /&gt;
                                showfile(string);&lt;br /&gt;
showimg float, oldstring, float, float;&lt;br /&gt;
                                showimg(float,string,float,float);&lt;br /&gt;
showimg2 float, oldstring, float, float, float;&lt;br /&gt;
                                showimg2(float,string,float,float,float);&lt;br /&gt;
showlocal;&lt;br /&gt;
                                showlocal();&lt;br /&gt;
&lt;br /&gt;
showpoly float, float;&lt;br /&gt;
                                showpoly(float,array);&lt;br /&gt;
showpoly2 float, float;&lt;br /&gt;
                                showpoly2(float,array);&lt;br /&gt;
showstats float;&lt;br /&gt;
                                showstats(float);&lt;br /&gt;
showtext float, float, float, oldstring, oldstring, oldstring;&lt;br /&gt;
                                showtext(float,float,float,string,string,string);&lt;br /&gt;
showtext2 float, float, float, float, oldstring, oldstring, oldstring;&lt;br /&gt;
                                showtext2(float,float,float,float,string,string,string);&lt;br /&gt;
sleep float;&lt;br /&gt;
                                sleep(float);&lt;br /&gt;
spyfire float, float;&lt;br /&gt;
                                spyfire(float,float);&lt;br /&gt;
stopmidi;&lt;br /&gt;
                                stopmidi();&lt;br /&gt;
stopsound oldstring;&lt;br /&gt;
                                stopsound(string);&lt;br /&gt;
take oldstring;&lt;br /&gt;
                                take(string);&lt;br /&gt;
take2 float;&lt;br /&gt;
                                take2(float);&lt;br /&gt;
takehorse float;&lt;br /&gt;
                                takehorse(float);&lt;br /&gt;
takeplayercarry;&lt;br /&gt;
                                takeplayercarry();&lt;br /&gt;
takeplayerhorse;&lt;br /&gt;
                                takeplayerhorse();&lt;br /&gt;
throwcarry;&lt;br /&gt;
                                throwcarry();&lt;br /&gt;
timereverywhere;&lt;br /&gt;
                                timereverywhere();&lt;br /&gt;
timershow;&lt;br /&gt;
                                timershow();&lt;br /&gt;
toinventory oldstring;&lt;br /&gt;
                                toinventory(string);&lt;br /&gt;
tokenize oldstring;&lt;br /&gt;
                                tokens = string.tokenize();&lt;br /&gt;
tokenize2 oldstring, oldstring;&lt;br /&gt;
                                tokens = string.tokenize(&amp;quot; ,&amp;quot; @ string);&lt;br /&gt;
toweapons oldstring;&lt;br /&gt;
                                toweapons(string);&lt;br /&gt;
triggeraction float, float, oldstring, oldstring;&lt;br /&gt;
                                triggeraction(float,float,string,string);&lt;br /&gt;
unfreezeplayer;&lt;br /&gt;
                                unfreezeplayer();&lt;br /&gt;
unset oldstring;&lt;br /&gt;
                                unset(string);&lt;br /&gt;
updateboard float, float, float, float;&lt;br /&gt;
                                updateboard(float,float,float,float);&lt;br /&gt;
updateterrain;&lt;br /&gt;
                                updateterrain();&lt;br /&gt;
wraptext float, oldstring, oldstring;&lt;br /&gt;
                                tokens = wraptext(float,&amp;quot; ,&amp;quot; @ string,string);&lt;br /&gt;
wraptext2 float, float, oldstring, oldstring;&lt;br /&gt;
                                tokens = wraptext2(float,float,&amp;quot; ,&amp;quot; @ string,string);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Supported old string operations ===&lt;br /&gt;
These old string operators can be used in string parameters&lt;br /&gt;
for the old commands, also you can use them directly as operators, e.g.&lt;br /&gt;
  #c = &amp;quot;hello&amp;quot;&lt;br /&gt;
is actually doing&lt;br /&gt;
  player.chat = &amp;quot;hello&amp;quot;&lt;br /&gt;
It is recommended to use the new scripting style though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#a            player.account&lt;br /&gt;
#a(float)     players[float].account&lt;br /&gt;
#m            player.ani&lt;br /&gt;
              ani&lt;br /&gt;
#m(float)     players[float].ani&lt;br /&gt;
#K(float)     char(float)&lt;br /&gt;
#8            player.bodyimg&lt;br /&gt;
              bodyimg&lt;br /&gt;
#8(float)     players[float].bodyimg&lt;br /&gt;
#c            player.chat&lt;br /&gt;
              chat&lt;br /&gt;
#c(float)     players[float].chat&lt;br /&gt;
#C0           player.colors[0]&lt;br /&gt;
              colors[0]&lt;br /&gt;
#C0(float)    players[float].colors[0]&lt;br /&gt;
#C1           player.colors[1]&lt;br /&gt;
              colors[1]&lt;br /&gt;
#C1(float)    players[float].colors[1]&lt;br /&gt;
#C2           player.colors[2]&lt;br /&gt;
              colors[2]&lt;br /&gt;
#C2(float)    players[float].colors[2]&lt;br /&gt;
#C3           player.colors[3]&lt;br /&gt;
              colors[3]&lt;br /&gt;
#C3(float)    players[float].colors[3]&lt;br /&gt;
#C4           player.colors[4]&lt;br /&gt;
              colors[4]&lt;br /&gt;
#C4(float)    players[float].colors[4]&lt;br /&gt;
#C5           player.colors[5]&lt;br /&gt;
              colors[5]&lt;br /&gt;
#C5(float)    players[float].colors[5]&lt;br /&gt;
#D            downloadfile()&lt;br /&gt;
#E            emoticonchar()&lt;br /&gt;
#e(float,float,oldstring)&lt;br /&gt;
              string.substring(float,float)&lt;br /&gt;
#g            player.guild&lt;br /&gt;
              guild&lt;br /&gt;
#g(float)     players[float].guild&lt;br /&gt;
#3            player.headimg&lt;br /&gt;
              headimg&lt;br /&gt;
#3(float)     players[float].headimg&lt;br /&gt;
#5            player.horseimg&lt;br /&gt;
              horseimg&lt;br /&gt;
#5(float)     players[float].horseimg&lt;br /&gt;
#k(float)     keyname(float)&lt;br /&gt;
#L            player.level&lt;br /&gt;
#I(oldstring,float)&lt;br /&gt;
              getstring(string)[float]&lt;br /&gt;
#n            player.nick&lt;br /&gt;
              nick&lt;br /&gt;
#n(float)     players[float].nick&lt;br /&gt;
#f            image&lt;br /&gt;
#f(float)     npcs[float].image&lt;br /&gt;
#F            level&lt;br /&gt;
#p(float)     params[float]&lt;br /&gt;
#P(float)     player.attr[float]&lt;br /&gt;
              attr[float]&lt;br /&gt;
#P(float_1,float_2)&lt;br /&gt;
              players[float_2].attr[float_1]&lt;br /&gt;
#P1           player.attr[1]&lt;br /&gt;
              attr[1]&lt;br /&gt;
#P1(float)    players[float].attr[1]&lt;br /&gt;
#P2           player.attr[2]&lt;br /&gt;
              attr[2]&lt;br /&gt;
#P2(float)    players[float].attr[2]&lt;br /&gt;
#P3           player.attr[3]&lt;br /&gt;
              attr[3]&lt;br /&gt;
#P3(float)    players[float].attr[3]&lt;br /&gt;
#P4           player.attr[4]&lt;br /&gt;
              attr[4]&lt;br /&gt;
#P4(float)    players[float].attr[4]&lt;br /&gt;
#P5           player.attr[5]&lt;br /&gt;
              attr[5]&lt;br /&gt;
#P5(float)    players[float].attr[5]&lt;br /&gt;
#P6           player.attr[6]&lt;br /&gt;
              attr[6]&lt;br /&gt;
#P6(float)    players[float].attr[6]&lt;br /&gt;
#P7           player.attr[7]&lt;br /&gt;
              attr[7]&lt;br /&gt;
#P7(float)    players[float].attr[7]&lt;br /&gt;
#P8           player.attr[8]&lt;br /&gt;
              attr[8]&lt;br /&gt;
#P8(float)    players[float].attr[8]&lt;br /&gt;
#P9           player.attr[9]&lt;br /&gt;
              attr[9]&lt;br /&gt;
#P9(float)    players[float].attr[9]&lt;br /&gt;
#R(oldstring) string.random()&lt;br /&gt;
#2            player.shieldimg&lt;br /&gt;
              shieldimg&lt;br /&gt;
#2(float)     players[float].shieldimg&lt;br /&gt;
#s(oldstring) getstring(string)&lt;br /&gt;
#1            player.swordimg&lt;br /&gt;
              swordimg&lt;br /&gt;
#1(float)     players[float].swordimg&lt;br /&gt;
#S            player.sword.script&lt;br /&gt;
#t(float)     tokens[float]&lt;br /&gt;
#T(oldstring) string.trim()&lt;br /&gt;
#v(float)     float&lt;br /&gt;
#W            player.weapon.image&lt;br /&gt;
#W(float)     weapons[float].image&lt;br /&gt;
#w            player.weapon.name&lt;br /&gt;
#w(float)     weapons[float].name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compatibility note:&lt;br /&gt;
When you use the command setcharprop then the first parameter&lt;br /&gt;
is handled differently: instead of changing 'player.chat' it&lt;br /&gt;
is changing 'chat', the chat text of the npc. So 'setcharprop #c,hello'&lt;br /&gt;
would be translated into&lt;br /&gt;
chat = &amp;quot;hello&amp;quot;&lt;br /&gt;
while 'setplayerprop #c,hello' is translated into&lt;br /&gt;
player.chat = &amp;quot;hello&amp;quot;&lt;br /&gt;
In the list above both possibilities are listed.&lt;/div&gt;</summary>
		<author><name>Trant</name></author>
	</entry>
</feed>