Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-07-2009, 04:05 PM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Epic fail.

I am trying to learn gscript, (I fail, I know.) and I was just trying something that LOOKS like it should work, but doesn't.

NPC Code:

if (created) {
setstring player.hp,10;
sleep 2;
if (player.hp == 10){
message Roger that!;
}
if (player.hp != 10){
message Fail!;
}
}



Code produces Fail!. :/ Help?
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
  #2  
Old 04-07-2009, 04:11 PM
fragman85 fragman85 is offline
Banned
Join Date: Mar 2009
Location: Switzerland
Posts: 261
fragman85 is on a distinguished road
Use PHP tags please...

btw. try:

PHP Code:
//#CLIENTSIDE
if (created) {
  
player.hp 10;
  
sleep 2;
  if (
player.hp == 10){
    
message Roger that!;
  }
  else {
    
message Fail!;
  }

Not sure tho, since it's GS1...
Reply With Quote
  #3  
Old 04-07-2009, 04:25 PM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by fragman85 View Post
Use PHP tags please...

btw. try:

PHP Code:
... 
Not sure tho, since it's GS1...
Ahh, that worked, thank you.
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
  #4  
Old 04-07-2009, 05:01 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Raelyn View Post
Ahh, that worked, thank you.
I think it'd be much more appropriate to change it all to GS2.

PHP Code:
function onCreated() {
  
player.hp 10;
  
  
sleep(2);
  
  if (
player.hp == 10) {
    
message("Roger that!");
  } 

  else {
    
message("Fail!");
  }

However, I don't know where you're testing this.
Reply With Quote
  #5  
Old 04-08-2009, 01:46 AM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by Codein View Post
I think it'd be much more appropriate to change it all to GS2.

PHP Code:
... 
However, I don't know where you're testing this.
Where can I get the commands.rtf for GS2? I only have the same old one...

I might as well learn GS2 I guess since I am starting pretty much from scratch.
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
  #6  
Old 04-08-2009, 02:26 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 Raelyn View Post
Where can I get the commands.rtf for GS2? I only have the same old one...

I might as well learn GS2 I guess since I am starting pretty much from scratch.
There isn't one for GS2, but if you haven't checked out the wiki, it's worth taking a look.

http://wiki.graal.net/index.php/Gscript
__________________
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
  #7  
Old 04-08-2009, 09:59 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Raelyn View Post
I might as well learn GS2 I guess since I am starting pretty much from scratch.
Indeed, it's not worth your time to learn GS1 - it's confusing/makes no sense, and has none of the new features that are being added to GS2.
__________________
Reply With Quote
  #8  
Old 04-09-2009, 12:17 PM
fragman85 fragman85 is offline
Banned
Join Date: Mar 2009
Location: Switzerland
Posts: 261
fragman85 is on a distinguished road
You can use /scripthelp on RC :o

Also try wiki.graal.net.

Oh and most of the functions in GS1 and GS2 are very similar :o
Reply With Quote
  #9  
Old 04-09-2009, 12:22 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
Quote:
Originally Posted by fragman85 View Post
You can use /scripthelp on RC :o
That doesnt give the answers to all.

Quote:
Originally Posted by fragman85 View Post
Also try wiki.graal.net.
Until I found

Quote:
Originally Posted by fragman85 View Post
Oh and most of the functions in GS1 and GS2 are very similar :o
just 1 () missing and all nag me about I dont use GS2
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #10  
Old 04-09-2009, 12:27 PM
fragman85 fragman85 is offline
Banned
Join Date: Mar 2009
Location: Switzerland
Posts: 261
fragman85 is on a distinguished road
Quote:
Originally Posted by Schetti View Post
That doesnt give the answers to all.
Yes it does, there are VERY few functions not listed.

Quote:
Originally Posted by Schetti View Post
Until I found
??!!?!¨

Quote:
Originally Posted by Schetti View Post
just 1 () missing and all nag me about I dont use GS2
1 ";" missing and your whole script doesn't work.
Reply With Quote
  #11  
Old 04-09-2009, 12:49 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
commands.rtf -> ./Graal.exe -listscriptfunctions

The /scripthelp command shows all functions and built-in variables, although there are some which don't have a description yet. Also the events are not displayed right now although they have been added to -listscriptfunctions in the recent months.

Update: added description of server-side object events to /scripthelp to the next npcserver release.

Last edited by Admins; 04-09-2009 at 01:20 PM..
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 10:52 AM.


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