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, 03:00 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 napo_p2p View Post
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
I just tried that GS2 version of the code I was trying to do, and it doesn't work in the editor...
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
  #8  
Old 04-08-2009, 03:01 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Raelyn View Post
I just tried that GS2 version of the code I was trying to do, and it doesn't work in the editor...
Editor doesn't support GS2.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #9  
Old 04-08-2009, 07:50 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 Tigairius View Post
Editor doesn't support GS2.
So then how do I test my code?
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
  #10  
Old 04-08-2009, 08:29 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
So then how do I test my code?
You would need to do that on a server. If you don't have a server to test things on, there's a server called Testbed Server that's open for anyone to experiment with scripts.
__________________
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
  #11  
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
  #12  
Old 04-09-2009, 10:58 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 cbk1994 View Post
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.
The only thing annoying me about GS2 is the inability to test it offline and the lack of a simple commands.rtf outlining all the commands and their use.
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
  #13  
Old 04-09-2009, 11:51 AM
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 Raelyn View Post
The only thing annoying me about GS2 is the inability to test it offline and the lack of a simple commands.rtf outlining all the commands and their use.

yea so true ... it always finds a fail and I dont have all in GS2(because I dont know all commands) Its pretty annyoning to find the mistake
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #14  
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
  #15  
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
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 03:57 AM.


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