Graal Reborn Scripting Guide

Graal Reborn GS1 Scripting Guide BETA VERSION 0.2

first comments:
this guide is explained on basic knowledge of mine, i will explain the main commands
but only the features i know will be explained, if you have knowledge of the ones i dont, please (if your staff) edit this post. or
if your no staff member private Message me
also i explain some easy commands, wich is a must for LATs and beginning NATs
also try experimenting! its okay if you make mistakes, keep trying, and if you cant figure it out,
there are always people on the forum wich will help you out
post any questions in the forum of Development > NPCs

also…
this guide is made for anyone who has problems or who wants to learn scripting
im trying to do my best on this guide so please no flaming!

also a few notes:
X = horizontal line
Y = vertical line
a timeout max limit is 0.05, after that it freezes. so dont use 0.01 to 0.04 because those wont work.

you can see the X/Y coordinates in editor when you put your mouse anywhere
its in the leftright corner of the screen.

Explanation how to get into editor, and where you can put/write scripts.



The Guide PT. 0 ~ few explanation of how to start scripting and basic information
the number one priority is that you can do a little of math, and you got a good commands.rtf file
i uploaded mine in this post, but the one ill upload is the one downloaded of this forums.
first i want to explain how to start a script

first a few note’s:

  1. a command mostly starts with a if, but can also start with: else,elseif, for,with, or while

~ else { //is a command that triggers, if none of the script is correct.
for example:
if (playertouchsme) {
if (carriesbush) {
setplayerprop #c, Yay you win; }
else {
setplayerprop #c, wtf you have no bush!;
}
}

~ elseif //a command that is used to give functions more then 1 option, and can give restrictions to the else command.
for example: [b]
if (playertouchsme) {
if (isleader) {
setplayerprop #c, you are the first one to enter this level!;
}
elseif (!playertouchsme&&isleader) {
message touch me!;
}
}
~ for //i got no decent explenation for this
~ with //i got no decent explenation for this
~ while //this is a special one, it will response when a flag stays on true
for example:
if (playertouchsme) {
while (carriesbush) {
hide;
sleep 1;
show;
}
}

//while the player carries a bush and is touching the NPC, the NPC will hide sleep for 1 second and then show


  1. always when making a trigger, put a open “(” icon and close it with the “)” icon
  2. after you made the trigger for example: if (playertouchsme) open it with brackets
    brackets are these “{” “}” icons, always open AND close them or the script will fail.
    so if im right you now have if (playertouchsme) { }
    and between the brackets comes the script
  3. also know that the // in a line of script wont be readed.
    // is used for comments in scripts.
    you can also if you have allot of lines
    put something like this
    /*
    made by: example
    for: example
    playerworld: example
    copyrighted by: example
    /
    this is just a example but to show you that you can post a big line of words without letting the script read it
    you can insert personal info and stuff anything you like, but do it with “//” or with " /
    " " */ " if its not the a part of the script.

this is a sample of a script i will explain every line:
NOTE: if you want to see how it works, you can just copy it in your offline editor
(see the picture tutorial for details, its in the post.)
5. you can put a trigger inside of a trigger.
but there are 2 ways to do that:

way 1: if (playertouchsme&&carriesbush) { this will put them together in one line, but only works when the NPC is touched
and is carrying a bush.

way2:
if (playertouchsme) {
if (carriesbush) {
}
elseif (!carriesbush) {
}
}

this way, you can do a multiple command, you leave playertouchsme open, so the playertouchsme rule counts always.
but then you can put carriesbush inside, so the script will respond when the player carries a bush.
and then i putted a extra trigger with elseif(!carriesbush) this means if the player DOES NOT carry a bush.
and then i close with 2 brackets, because first i close of the (!carriesbush) but if (playertouchsme) { was still open!
so i needed to close that one off! i hope you understand that. :smiley:
[php]
if (playertouchsme) { //if is the start, so if the NPC is touched
toweapons Explosion Test; //this will add the weapon Explosion Test to the weapons;
} // bracket end
if (weaponfired) { //if is the start, so if the weapon is fired
if (!extriggerd) { //this is a set/unset option to see if the weapon is already fired. in this case its not.
setplayerprop #c, Explosions On!; //will set the players chat to explosions on!
set extriggerd; //now it will set that the weapon is fired
timeout = 0.05; //here starts a loop
} //bracket end
elseif (extriggerd) { //here is what to do if the weapon is currently fired, when it was already triggerd
setplayerprop #c, Explosions Off!; //the playerchat will go back to explosions off;
unset extriggerd; //now the weapon is put off;
} //bracket end
} //another bracket end because i have a trigger inside a trigger, wich needs to be closed by 2 brackets
if (timeout&&extriggerd) { //this is a double command, the timeout has to be triggerd, but the weapon has to be triggerd too!
this.iyrand = (random(-5,5)); //this puts a variable, in a random ammount between -5 and 5 so this can be anything.
this.ixrand = (random(-5,5)); //same as above
this.iplx = playerx; //puts the variable this.iplx to the playerx (the player’s X coordinates)
this.iply = playery; //puts the variable this.iply to the playery (the player’s Y coordinates)
putexplosion 1,this.iplx+this.ixrand, this.iply+this.iyrand; //puts an explosion with the power of one, at the playery + the random number
//so actuelly it can put it anywhere between the playerx -5 and 5. and the playery -5 and 5. see it in offline editor to get what im saying.
timeout = 0.05;
}
[/php]
if you have any questions please PM me, ill be happy to explain
and i hope you understand for so far.

now i want to talk about the symbols.
symbols are icons that can put different triggers together.
i put them in a list below, but theyre also in the commands.rtf
ill add a sample after it ~
[php]
! not ~ if (!playertouchsme) { //responses when the player doesnt touch the NPC
&& and ~ if (playertouchsme && carriesbush) { //response when the player touches the NPC WITH a bush
|| or ~ if (playertouchsme || playerenters) { //response if the player touches the NPC or if the player enters the level
== equals ~ if (this.variable == server.variable) { //response when this.variable is equal to server.variable
!= does not equal ~ if (this.variable != server.variable) { //response when this.variable and server.variable are not the same

  • addition ~ if (playertouchsme) { this.variable + this.variable2 //counts these 2 variables up
  • substraction ~ if (playertouchsme) { this.variable - this.variable2 //this.variable minus this.variable2
  • multiplication ~ if (playertouchsme) {this.variable * this.variable2 //multiplies this.variable times this.variable2
    / division ~ if (playertouchsme) { this.variable / this.variable2 //devides this.variable trough this.variable2;
    % mod; a%b = a - int(a/b)*b; ~ { this.variable //mod takes (a) and devides it by B then does it times B.
    ^ power; a^0.5 = squareroot(a) ~ //power is taking the squareroot of (a).
    in tests if an array/range contains a variable (e.g. 2 in {1,2,3}; x,y in |0,64|) ~ if (playery in |0,30|) { //response when the playery is between 0 and 30
    = assigment ~ if (playertouchsme) { this.variable = 3; } //sets this.variable to 3;
    a += b a = a+b ~ if (playertouchsme) { this.variable += 3; //adds 3 to this.variable
    a -= b a = a-b ~ if (playertouchsme) { this.variable -= 3; //takes 3 from this.variable
    a = b a = ab ~ if (playertouchsme) { this.variable *= 2; //multiplys this.variable times 2
    a ++ a = a+1 ~ if (playertouchsme) { this.variable++ //+1 to this.variable
    a – a = a-1 ~ if (playertouchsme) { this.variable-- //-1 to this.variable
    this. variables starting with this. is only for this NPC
    [/php]

The Guide PT. I

the first i want to explain are the basic physic triggers wich happen to trigger up a script when you do something
for example if you enter a level wich is named by
if (playerenters) { //dostuff }
try to learn the scripting language, most words in english are pushed together as one
so for example if you take playerenters, it actually says if the player enters the level then do stuff
these are all basic commands for the people who know the basic,
but newbies will make allot of mistakes if they dont understand what they are doing.
these are all the physic triggers in graal (also known as build in flags):
[php]
playerenters triggers when the player enters the current level
playertouchsme triggers when the player touch this NPC
playertouchsother triggers when the player touches any other NPC in the current room
playerlaysitem triggers when the player drops any item on the ground.
playerchats triggers when the player chats something

NOTE: uploaded a new commands.rtf

Eh. Stuff I already know…

– this command is used for allot of things you can use different further commands
for example:
if (playerchats) { //dostuff } will trigger when the player chats anything
if (playerchats&&strequals(/bla,#c)) { //dostuff } will trigger when the player chats /bla
if (playerchats&&startswith(#c,/bla)) { //dostuff } will trigger when the player chats /bla and anything else
Example: “/bla no i like this guide very much”, it will still trigger the script.

[php]
isleader triggers when the player was the first in the level (of all players)
isweapon triggers when the current NPC is a weapon
isonmap triggers if the player is on the overworld or GMAP
weaponfired triggers when the weapon is fired (first press Q, select the weapon and press D)
firedonhorse triggers when the current NPC is fired (as weapon) on a horse
compusdied triggers when all the baddys are dead
playerendsreading triggers when the player stops reading
exploded triggers when the NPC is exploded by a bomb (lay a bomb on it, and let it explode)
timeout triggers when the NPCs timeout counter runs to 0
NOTE: this command can also be looped
[b] if (playerenters) { timeout = 0.05; }
if (timeout) { //dostuff ; timeout = 0.05; } then it will keep looping. because it will keep going back to the same trigger.

washit triggers when the NPC got slashed with a sword or axe
wasshot triggers when the NPC got hit by arrows
shotbyplayer triggers when the player shoots the NPC
shotbybaddy triggers when the NPC is shot by a Baddy
waspelt triggers when the NPC is pelt by anything (bush,pot/vase,sign,stone,b.stone,NPC)
peltwithbush triggers when the NPC is pelt with a bush, only bush works
peltwithsign triggers when the NPC is pelt with a sign, only sign works
peltwithvase triggers when the NPC is pelt with a pot/vase, only sign works
peltwithstone triggers when the NPC is pelt with a stone, only stone works
peltwithblackstone triggers when the NPC is pelt with a blackstone, only blackstone works
peltwithnpc triggers when the NPC is pelt with a NPC, only other NPCs work.
wasthrown triggers when you pick up the NPC and then throw it away
carrying triggers when the player carries anything (bush,pot/vase,etc.)
carriesbush triggers when the player carries a bush, only a bush works
carriessign triggers when the player carries a sign, only a sign works
carriesvase triggers when the player carries a vase, only a vase works
carriesstone triggers when the player carries a stone, only a stone works
carriesblackstone triggers when the player carries a blackstone, only a blackstone works
weaponsenabled triggers when the players weapons are enabled
visible triggers when the NPC is visible to players
followsplayer triggers when the NPC is following the player
onwall( x, y ) the specified field (x to y) is walls
onwater( x, y ) the specified field (x to y) is water
compsdead triggers when all the baddys are dead
playeronhorse triggers when the player is on a horse/boat
playerswimming triggers when the player is swimming
playerismale triggers when the player is male (specified in headsconfig.txt)
playerisfemale triggers when the player is female (specified in headsconfig.txt)
hasweapon( name ) triggers when the player has the weapon ‘name’
canspin triggers when the player has spinpower
strequals( str1, str2 ) str1=str2 (both strings can contain message codes)
strcontains( str1, str2 ) string 1 contains string2
keydown( key ) triggers when these keys are pressed (0 to 10: up,left,down,right,S,A,D,M,tab,Q,P)
keydown(keycode(key),false/true)) triggers when ‘key’ is pressed, false is for without ctrl/alt and true is with ctrl/alt
this is how it would look like: if (keydown2(keycode(f),false)) {
[/php]
and these are the most needed triggers for basic scripting
in pt. II i will explain what to do AFTER the triggers.

The Guide PT. II - Section A - After triggers…
in part one you readed about triggers, now its time to do whatever next.
so for now you know the basic commands like
if (playertouchsme) { dostuff }
and you learned how to combine stuff
if (playertouchsme&&carriesbush) { dostuff }

now its time to focus on the dostuff

there are ALLOT of options you can do with your NPC
you can make it disappear you can make it move, you can let it teleport
ill describe all of the functions wich you can add after the trigger with explenation

[php]
//NOTE:
//Index is just a number so the script can recognize it.
//if you need to set a index by yourself just put index 1, then 2 then 3 etc.
Set flagname //sets a flag to true
Unset flagname //sets a flag to false
sleep “seconds” //let the script hold for “seconds” ammount of time.
timereverywhere //keeps running the script even if the player is not in the level where the NPC is at.
setgif/setimg “filename” //changes the NPCs image
setgifpart/setimgpart “filename”,x,y,width,height; //takes a part of a image and shows it.
hide; //hides the NPC
show; //shows the NPC
dontblock; //the NPC wont block the player, without this command it will always block the player
drawoverplayer; //this will let the NPC show above the player
drawunderplayer; //this will let the NPC show under the player
blockagain; //the NPC will block again
canbecarried; //the NPC can be carried
cannotbecarried; //the NPC cannot be carried
canbepushed; //the NPC can be pushed
cannotbepushed; //the NPC cannot be pushed
canbepulled; //the NPC can be pulled
cannotbepulled; //the NPC cannot be pulled

say signindex; //display a sign with a number, you need to use the sign index.
lay itemname; //lays an item where the NPCs at
lay2 itemname,x,y; //lays the item at the X, Y coordinates
take itemname; //takes a item on the ground
take2 index; //takes the item with the specified index
message text; //displays text above the NPC
timershow; //shows the NPCs timeout
showcharacter; //displays a player character instead of the npc image
setcharprop messagecode,string; //sets the characters string. (see stringlist)
putnpc imgname,scriptname,x,y; //creates a NPC at the X,Y coordinates, Scriptname is the textfile containing the script.
callnpc index,eventflag; //calls the script of another npc (not immediatelly)
destroy; //deletes the NPC
carryobject object; //the character carries an object (only when 23<=sprite<=32)
throwcarry; //throws the carried object
followplayer; //The NPC will keep following the player
toinventory flag ; //The NPC will be put in the players inventory until the flag is unset
toweapons wep; //adds ‘wep’ to the weaponfolder
showimg index,filename,x,y; //shows an image at the given
hideimg index; //removes the image with the specified index
changeimgpart index,x,y,width,height; //changes the visible part of the showimg
changeimgvis index,drawingheight; //changes the drawing height of the showimg (0,1,2,4)
shootarrow direction; //shoots an arrow
shootfireball direction; //shoots a fireball
shootfireblast direction; //shoots a fireblast
shootnuke direction; //shoots an nukeshot
shootball; //shoots a ball to playerx,playery
hitplayer index,halfhearts,fromx,fromy; //hurts a player
hurt halfhearts; //hurts a player
hitnpc index,halfhearts,fromx,fromy; //hurts an npc (changes hearts, hurtdx, hurtdy)
hidelocal; //hides the npc (only for the current player)
showlocal; //shows an hidden npc (only for the current player)
dontblocklocal; //lets the npc don’t block the player anymore (only for the current player)
blockagainlocal; //turns off the three block flags (only for the current player)
takehorse index; //takehorse, only works with ‘showcharacter’
setfocus x,y; //sets the focus to X Y coordinates
resetfocus //turns focus off

setlevel filename; //sets the player to a other level with same X and Y, Filename is levelname+.nw
setlevel2 filename,x,y; //warps a player to a other level, to the X and Y coordinates,
seturllevel URL; //warps the player to an URL (without http://)
setbody filename; //changes the playersbody into ‘filename’
sethead filename; //changes the playershead into ‘filename’
setsword imgname,power; //changes the players sword (-20 to 20 is possible in power)
setshield imgname,power; //changes the players shield (0 to 10 is possible in power)
setbow imgname; //Changes the preset bow when firing a bow,(also known as sprite 33)
setplayerdir direction; //Changes player’s Direction
setskincolor colorname; //Changes player’s Skin Color
setcoatcolor colorname; //Changes player’s Coat Color
setsleevecolor colorname; //Changes player’s Sleeves Color
setshoecolor colorname; //Changes player’s Shoes Color
setbeltcolor colorname; //Changes player’s Belt Color
setplayerprop messagecode,string; //Sets the players string. (see stringlist)
takeplayercarry; //takes away the item that the player is carrying
takeplayerhorse; //takes the horse of the player
disableweapons; //players q-menu and sword is disabled.
enableweapons; //players q-menu and sword is enabled
freezeplayer seconds; //the player can’t move for ‘seconds’ time
hideplayer seconds; //hides the player for ‘seconds’ time
hidesword seconds; //hides the players sword for ‘seconds’ time
updateboard x,y,width,height; //??
putobject objectname,x,y; //puts ‘objectname’ at the X Y coordinates
putbomb power,x,y; //puts a bomb with 1 to 3 power at the X Y coordinates
putexplosion radius,x,y; //puts an explosion at the X Y coordinates w/radius
[/php]

[php]
putexplosion2 power,radius,x,y; //puts explosion (1 to 3 power) at the X Y coordinates with selected radius
putleaps leaptype,x,y; //puts a leap at the X Y coordinates (0-bush,1-swamp,2-stone,3-sign,4-ball,5-water)
puthorse imgname,x,y; //puts a horse at the X Y, you need to use a imagename of a horse (ride,ride1,ride2)
setbackpal filename; //the background gets the color palette of the specified image
setletters filename; //sign will display with a custom letter design
setmap imgname,levelnamesfile,x,y; //changes the map, the player will be placed on (x,y)
setminimap imgname,levelnamesfile,x,y; //changes the minimap, the player will be placed on (x,y)
showstats bitflag; //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)
noplayerkilling; //disables playerkilling in the current level.

putcomp baddyname,x,y; //puts a baddy at the X Y coordinates
putnewcomp baddyname,x,y,imgname,power; //puts a baddy with the power, image at the X and Y coordinates
hitcompu index,decrpower,fromx,fromy; //hurts a baddy
removecompus; //deletes all baddys from the level
play filename; //plays music/filenames but can also play radio stations.
playlooped filename; //plays a sound file (.wav) looped
stopsound filename; //stops playing a sound file (.wav)
stopmidi; //stops playing the currently running music.
openurl URL; //brings up a menu, wich ask to open the website (without leading HTTP://)
showfile filename; //opens the file with the program if it can be run with the file extension

playerx //the X coordination
playery //the Y coordination
playerrupees //the rupees of the player
playerbombs //the player bombs
playerdarts //the darts(arrows) of the player
playerhearts //the hearts of the player
playerfullhearts //the fullhearts of the player (heartlimit)
playerdir //the direction of the player
playersprite //the sprite of the player
playerap //the AP of the player
playermp //the MP of the player
[/php]
guide PT. II section B - Variables
i wanted to create a section only for variables because you can do allot of stuff with variables
why? because you can store information in them for later to read it out, or do anything else with it
there are 2 maintypes of storages
a string ~ //stores text/characters in a variable (but now called string), wich later can be used in other scripts.
a variable ~ //stores numbers in a variable.
there are 3 types of variables
a server variable wich goes as: server.“variablename” //example: server.lottery
a client variable wich only goes for the players client wich goes as: client.“variablename” //example: server.lotterytickets
a this variable wich only goes for the current NPC its used in wich goes as: this.“variablename” //example: server.lotteryticketsleft

guide PT. II section C - Stringlist
[php]
#a //the accountname of the player/NPC/Character
#n //the nickname of the player/NPC/Character
#g //the guildname of the player/NPC/Character
#c //the chat of the player
#v(var) //the stored data inside the variable ‘var’
#s(var) //the stored data inside the string ‘var’
#L //the levelname where the player/NPC is at
#f //the image filename of the NPC
#w //the name of the weapon equiped by a player
#1, #1(index) //the sword image filename of the player
#2, #2(index) //the shield image filename of the player
#3, #3(index) //the head image filename of the player
#5, #5(index) //the image filename of the player’s horse
#6, #6(index) //the image filename of the npc that is carried by the player
#7, #7(index) //the bow image filename of the player
#8, #8(index) //the body image filename of the player
#C0, #C0(index) //the skin color
#C1, #C1(index) //the coat color
#C2, #C2(index) //the sleeves color
#C3, #C3(index) //the shoes color
#C4, #C4(index) //the belt color
[/php]
guide PT. II section D - Functions
functions are triggers that can be used if you making a tool or anything else
a function can be used as a extension of a script and can also be used to loop.
a function is this: function Example(); {
and can be triggerd by example();
try this in editor:
[php]
function example() {
timeout = 0.05;
}
if (playerenters) {
example();
}
if (timeout) {
this.rand = (random(-1,1));
this.rand2 = (random(-1,1));
setfocus playerx+this.rand,playery+this.rand2;
timeout = 0.05;
}
[/php]


The end of the guide


well… this was my guide i hope i explained some stuff to let you see how scripting looks like and how to start.
this is just a beta version of the Graal Reborn Scripting Guide.
if you have anything else needed to be explained please let me know.
i did some basic explanations but if you have ANY suggestions or you see ANY error, please notify me
and i hope its not worthless :stuck_out_tongue:

also a note:
never give up, if something doesnt work just let it rest for a day, and take a new shot the next day
also try being experimental. just try some commands to check out what you can do.

Good luck :slight_smile:

Guide PT III - Section Playersuggestions
i had a few suggestions from players. so this section is for adding stuff
and forgotten commands.
Forgotten stuff - Update 1 - String Update commands
[php]
insertstring name,index,text; //adds a string with a index to the stringlist the date stored is ‘text’;
replacestring name,index,text; //replaces the string with index, with ‘text’
removestring name,text; //removes a string;
deletestring name,index; //deletes string ‘name’ with the specified index.
[/php]
Forgotten stuff - Update 2 - Triggers;
[php]
playeronline //response when the player is online
isfocused //response when the player is focussing
issparringzone //response when the level is a sparring zone
lighteffectsenabled //response when the player has lighteffect enabled
playerdies //response when playerhearts reaches 0(Zero)
playermap //response when the player is viewing the map
nopkzone //response when the player can’t hurt other players
[/php]
Forgotten Stuff - Update 3 - After Triggers
some commands after the triggers wich i forgot:
[php]
seteffect red,green,blue,alpha; //will set the screen to a color try to mix some colors and see what the outcome is. (default 0,0,0,0)
disabledefmovement; //the player can not move
enabledefmovement; //the player can move again
disableselectweapons; //disables Q Menu
enableselectweapons; //enables Q Menu
disablepause; //if player presses P, he won’t be paused
enablepause; //if player presses P, he will go on pause like normal again
disablemap; //players map doesn’t work anymore
enablemap; //players map works again
enablefeatures flag; //enables only the features specified
replaceani ani,newani; //changes a Gani, to a other Gani
attachplayertoobj type,id; //set the player stuck to the NPC (type = 0)
detachplayer; //unset the player stuck to the NPC;
setgender gender; //changes the gender to male/female

tokenize str; //takes seperate data and splits them by space, wich can be readed by #t(‘tokennumber’); example:
if (playerchats) { tokenize #c; setplayerprop #c, the 3rd word you typed was: #t(2); }
//NOTE: its #t(2), because #t(0) counts as the first word.
tokenize2 delims,str; //same as tokenize, only with added delimiters

hitplayer index,halfhearts,fromx,fromy; //hits the player, hurts halfhearts, and will hit from the given X Y coordinates so the player will fall back
hitnpc index,halfhearts,fromx,fromy;//hits the NPC in halfhearts, when hit he will fly back.

Spyfire lenght, power;//this is a secret added command, it puts a firebreath
from the players X Y coordinates, (1 - normal power, 3 - jolt power)

showtext index,x,y,font,style,text; //shows text at X Y
showtext2 index,x,y,z,font,style,text; //shows text at X Y and the Z position is the high/low index.
changeimgcolors index,red,green,blue,alpha; //changes the colors of a light.
alpha is the deepness, 1 is normal, (1,1,1,1) to show the image regular
changeimgzoom index,zoomfactor; //sets the zoom for a img/text
changeimgmode index,mode; //changes view mode(0 - img as light 1 - img transparency 2 - img holes)

showimg index,@font@style@text,x,y; //shows text at X Y, can be combined with allot of other commands like changeimgzoom and changeimgcolors
showimg2 index,filename,x,y,z; //shows a image at 3D position
//small tip: (X * Y * Z = 3D)
[/php]
Forgotten Stuff - Update 4 - Custom Tileset;
getting bored of the regular tileset? create your own one!;
its possible to edit your own tileset by replacing the pics1
and this is how you do it:
first, make the tileset, then go into a script and use the tileset commands.
[php]
addtiledef image,levelstart,type; //replaces the tileset, with the tileset image, what name the level starts with, and what type (use 1 for type)
//example: addtiledef Greborn_tiles.gif,Greborn_Gmap,1
//but you can only upload 64KB, and thats not much.
//so you can use this script to upload it ill explain what it does:
for(this.i = 0; this.i < 8; this.i++) addtiledef2 YourTiles.gif_#v(this.i).png,LEVELSTARTSWITH,256 * this.i, 0; //the first rule loads up all the different parts, you need to split the tileset in 7 pieces, 512 high, 256 in length. and it will load yourtiles.gif_1.png until yourtiles.gif_7.png
//then it checks what level it startswith, and the 256 is the lengt, so it can keep pasting them in the shape of a tileset.
removetiledefs; //this is for getting back to the original tileset if you loaded a other tileset.
NOTE: if you want the tileset to appear in every level, delete LEVELSTARTSWITH out of the line.
[/php]

** READ FURTHER DOWN **

rofl I never said it was made for me xD I just like fucking around with people.

Section - Forgotten Commands - Mousecontrols

[php]
leftmousebutton //response when the leftmouse button is pressed
rightmousebutton //response when the rightmouse button is pressed
middlemousebutton //response when the middlemouse button is pressed
mousedown //response when any mousekey is hold
mouseup //response when any mousekey was released
mousewheel //response when the mousewheel is moved up or down
actionleftmouse //response when the NPC is clicked with leftmouse button
actionrightmouse //response when the NPC is clicked with rightmouse button
actionmiddlemouse //response when the NPC is clicked with the middlemouse button
actiondoublemouse //response when the NPC is doubleclicked
[/php]

this was the end of the guide :slight_smile:

:expressionless:

Great Guide I hope it helps players who are new to scripting, and maybe some who just need a brush up too :D.

thank you negitar :slight_smile:
and nalin, thank you very much

so
[php]
% mod; a%b = a - int(a/b) * b; //is 5 - (a/b) * b, so 5 - (5/10) * 10 = 45, am i right?
[/php]
and power…
[php]
^ power; a^0.5 = squareroot(a) //is actually just takin the sqrt of (a)
[/php]

thanks nalin ill put it in the guide :slight_smile:

5 - int(5/10) * 10
5 - int(0.5) * 10
5 - 1 * 10
5 - 10
5

even if you remove the int it’s still not 45

5 - (5/10) * 10
5 - (0.5) * 10
5 - 5
0

Hello, awesome job! I’ll be referring several people I know who are trying to figure out scripting for the first time to this, it’s a very good reference. One thing though, your commands.rtf seems to be lacking some commands so heres one with quite a few more.

Also something you might want to add is current limitations.
The ones I know of, and found out the hard way is;
13kb limit for npc scripts
64kb size limit for images/sounds/anything that needs dloaded
64x64 pixels for a showimg command functioning as a weapon, for everyone else to see it. E.g. if U make a lantern npc like I did, that uses showimg for the light, if its above 64x64 pixels no one else can see the light.

Thanks again, keep up the good work! :stuck_out_tongue:

Actually my commands.rtf is not NEARLY as upto date as the one Nalin just gave me, here use this instead.

P.S. he warned some commands require npc-server so be careful.

Thanks again man!

thank you for your add on msg, ill edit it and thanks for the upgraded commands.rtf ill add it in right away! :slight_smile:

EDIT: the guide is now upgraded, its now BETA V0.2

Ah. I was going by the one he supplied. Which I’m guessing is incorrect.

then create a good example for me,
and how can i give my name a color

Nalin gave you an example.

bump*

hey quick question idk if it goes in this section but whats the command to join an npc to a bush making it show up as a bush in client as a tile online but actually an npc

setimgpart pics1.png,32,0,32,32;

Other than that, what you’re probably asking for isn’t practical or entirely possible.

Easy scripting guide -

  1. Go here: http://forums.graal.in/forums/forumdisplay.php?f=19
  2. Start a new thread
  3. Put [REQUEST] in the thread topic name, followed by the name of the NPC you want to create
  4. Include any details on how you’d like the script to function, and end it with a please.