Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-31-2006, 12:47 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Talking noobie scripting guide!

http://wiki.graal.net/index.php/Worl...cripting_Guide
When I ws trying to learn how to script, guides helped more if they had many examples, and a lot of explanations. Since none really had this, I learned from looking at scripts, and beraking them down. This guide makes it easier to start learning scripting. It's no where near done, but as of now it's quite long, and has many examples. Graal needs more scripters, so I hope this is taken seriously. I made this originally so that my staff could know some scripting, but anyone could learn from it. So enjoy!
Reply With Quote
  #2  
Old 03-31-2006, 09:19 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
A few things need to be touched up, but overall, a good try.
Quote:
triggeraction (x,y,"params[0]","params[1]");
Variable names should not be inside "quotes".
Quote:
addweapon Fire Ball;
setshape 1,32,32;
if (playerrupees>=100)
PHP Code:
addweapon("Fire Ball");
setshape(13232);
if (
player.rupees >= 100
Quote:
function onPlayertouchesme()
PHP Code:
function onPlayerTouchsMe() 
... spelling error.
Quote:
triggeraction (x,y,"Touched","Touched");
... will produce
PHP Code:
function onActionTouched() 
... not
PHP Code:
function onTouched() 
Quote:
function onCreated()
{
setshape 1,32,32;
//setshape is needed for all level NPCs triggeractions
//this setsit to a square of tiles 32 pix by 32 pix
}
function onActiontime()
{
server.time+=1;
//no need for incredible accuracy
}
//#CLIENTSIDE
function onCreated()
{
settimer(1);
}
function onTimeout()
{
triggeraction(x,y,"time","time");
settimer(1);
}
A better version:
PHP Code:
function onCreated()
{
  
onTimeout();
}

function 
onTimeout()
{
  
server.time ++;
  
setTimer(1);

Although, note that a server. string can only be read serverside.
__________________
Skyld
Reply With Quote
  #3  
Old 03-31-2006, 10:50 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Skyld
PHP Code:
function onPlayerTouchsMe() 
... spelling error.
Of a spelling error!
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #4  
Old 03-31-2006, 03:54 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by napo_p2p
Of a spelling error!
Stefan didn't want the language to sound so dirty!
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 03-31-2006, 06:20 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by napo_p2p
Of a spelling error!
Which is, of course, ironic.
__________________
Skyld
Reply With Quote
  #6  
Old 03-31-2006, 10:44 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
thanks if you havn't already, i'll fix the errors. Thats one of the reasons I chose to do this on the wiki, any user can access it or fix errors, or even add to it.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.