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-28-2007, 06:58 PM
oinknessx oinknessx is offline
Banned
oinknessx's Avatar
Join Date: Apr 2004
Location: United States
Posts: 646
oinknessx is on a distinguished road
Send a message via AIM to oinknessx
Red face Oldbie's Newb Scripting

At first I thought it would be impossible for me to upgrade to GS2. Here's what scripting looked like to me before, and it's still the easiest way for me to comprehend at the moment.

Quote:
if (playerenters){
shootball;
}
But now that everything is scripted in GS2, the script would look something more along the lines of.....

Quote:
function onPlayerEnters(){
shootball();
}
I guess it's not really TOO different or impossible for me to upgrade. It's just odd. But with the help of the Graal wiki, it's going to be a lot easier. However I still haven't figured out how to do a script so that if the player chats, and the chat equals certain words, it will perform a command.... I tried function onPlayerChats("and what they would chat in here") but that didn't work. o_o

I'd have to say basically, I just know how to call events... I don't know how to edit events, like with a created&&timeout, or playerchats&&wordsare.... or playerhit&&hp=2.....

I talked to Hell Raven, he basically taught me how to call basic events and told me about the wiki.
Reply With Quote
  #2  
Old 04-28-2007, 07:02 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
HTML Code:
function onPlayerChats()
  {
  if (player.chat == "heyllo") //if (strequals(#c, heyllo))
    this.chat = "Heyllo";  //message hi;
  else if (player.chat.starts("hi")) //if (startswith(hi, #c))
    this.chat = "Oh heyllo there!";   
  }
Some tiny things, hehe
Reply With Quote
  #3  
Old 04-28-2007, 07:08 PM
oinknessx oinknessx is offline
Banned
oinknessx's Avatar
Join Date: Apr 2004
Location: United States
Posts: 646
oinknessx is on a distinguished road
Send a message via AIM to oinknessx
And those 'if' deals from gs1 will work in GS2?
Reply With Quote
  #4  
Old 04-28-2007, 07:09 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by oinknessx View Post
And those 'if' deals from gs1 will work in GS2?
Will work, yes. Depricated? Yes. Stay away from them.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #5  
Old 04-28-2007, 09:23 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 oinknessx View Post
And those 'if' deals from gs1 will work in GS2?
http://skyld.vip.graal.net/wikka.php?wakka=if
__________________
Skyld
Reply With Quote
  #6  
Old 04-28-2007, 09:28 PM
oinknessx oinknessx is offline
Banned
oinknessx's Avatar
Join Date: Apr 2004
Location: United States
Posts: 646
oinknessx is on a distinguished road
Send a message via AIM to oinknessx
I know how to do THOSE, I was asking about how to do it in GScript2.. you know, the scripting system for Graal now. :x Surely it's not the same thing. o_O
Reply With Quote
  #7  
Old 04-28-2007, 09:29 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 oinknessx View Post
I know how to do THOSE, I was asking about how to do it in GScript2.. you know, the scripting system for Graal now. :x Surely it's not the same thing. o_O
Essentially everything on skyld.vip.graal.net is written as the new engine, so what you see on that page works in the new engine.
__________________
Skyld
Reply With Quote
  #8  
Old 04-28-2007, 07:35 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
How are "if's" deprecated?
Reply With Quote
  #9  
Old 04-28-2007, 07:38 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by DustyPorViva View Post
How are "if's" deprecated?
I think they were referring towards the \\if\\ created/playerenters/timeout.
Reply With Quote
  #10  
Old 04-28-2007, 07:48 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Chandler View Post
I think they were referring towards the \\if\\ created/playerenters/timeout.
Correct. Sorry for not making that clear.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #11  
Old 04-28-2007, 08:56 PM
oinknessx oinknessx is offline
Banned
oinknessx's Avatar
Join Date: Apr 2004
Location: United States
Posts: 646
oinknessx is on a distinguished road
Send a message via AIM to oinknessx
In the playerchats script that guy posted, it had those 'if' sections. I was just wondering if that was the right way to do it in GS2, because I thought if was from gs1. o.o
Reply With Quote
  #12  
Old 04-29-2007, 03:04 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
My question is before in GS1 you could do...
if (created||playerenters) ...

How would you do that in GS2, if possible, or would you have to do different checks?
Reply With Quote
  #13  
Old 04-29-2007, 03:08 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Different checks but you can do:

PHP Code:
function onCreated() {
onPlayerEnters();
}

function 
onPlayerEnters() {
//do whatever

__________________

Coming soon (Hopefully:P)
Reply With Quote
  #14  
Old 04-29-2007, 03:39 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
teaching an old dog new tricks (not to call u a dog or anything)
__________________
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:20 PM.


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