Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Oldbie's Newb Scripting (https://forums.graalonline.com/forums/showthread.php?t=73720)

oinknessx 04-28-2007 06:58 PM

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. :cool:

Chandler 04-28-2007 07:02 PM

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

oinknessx 04-28-2007 07:08 PM

And those 'if' deals from gs1 will work in GS2?

xXziroXx 04-28-2007 07:09 PM

Quote:

Originally Posted by oinknessx (Post 1303917)
And those 'if' deals from gs1 will work in GS2?

Will work, yes. Depricated? Yes. Stay away from them.

DustyPorViva 04-28-2007 07:35 PM

How are "if's" deprecated?

Chandler 04-28-2007 07:38 PM

Quote:

Originally Posted by DustyPorViva (Post 1303928)
How are "if's" deprecated?

I think they were referring towards the \\if\\ created/playerenters/timeout.

xXziroXx 04-28-2007 07:48 PM

Quote:

Originally Posted by Chandler (Post 1303929)
I think they were referring towards the \\if\\ created/playerenters/timeout.

Correct. Sorry for not making that clear.

oinknessx 04-28-2007 08:56 PM

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

Skyld 04-28-2007 09:23 PM

Quote:

Originally Posted by oinknessx (Post 1303917)
And those 'if' deals from gs1 will work in GS2?

http://skyld.vip.graal.net/wikka.php?wakka=if

oinknessx 04-28-2007 09:28 PM

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

Skyld 04-28-2007 09:29 PM

Quote:

Originally Posted by oinknessx (Post 1303941)
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.

DustyPorViva 04-29-2007 03:04 AM

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?

JkWhoSaysNi 04-29-2007 03:08 AM

Different checks but you can do:

PHP Code:

function onCreated() {
onPlayerEnters();
}

function 
onPlayerEnters() {
//do whatever



ff7chocoboknight 04-29-2007 03:39 AM

:oo: teaching an old dog new tricks (not to call u a dog or anything)


All times are GMT +2. The time now is 01:55 PM.

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