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 10-03-2010, 08:09 AM
LordOfPi13 LordOfPi13 is offline
Classic iPhone LAT
LordOfPi13's Avatar
Join Date: Jul 2010
Location: California
Posts: 45
LordOfPi13 is an unknown quantity at this point
Send a message via AIM to LordOfPi13
scheduleevent

Hey guys, been playing with scripting lately and noticed scheduleevent. I've read the descriptions on the wiki, but it doesn't seem to come to me. It would be awesome if someone could write a quick example using scheduleevent in action
Reply With Quote
  #2  
Old 10-03-2010, 08:26 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Sure

PHP Code:
function onCreated()
{

  
this.var = "foo";
  
scheduleEvent3"change""bar");
  
onTimeout();

}

function 
onTimeout()
{

  
this.chat this.foo;

  
setTimer0.05);

}

function 
onChangetemp.var)
{

  
this.foo temp.var;

  if ( 
temp.var == "bar")
    
scheduleEvent3"change""baz");


When created it will show 'foo' for three seconds then 'bar', then after another three seconds 'baz'. ScheduleEvent does not interupt the current script, which can come in very handy when using a timeout loop.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #3  
Old 10-03-2010, 05:28 PM
MrDumbledore MrDumbledore is offline
Headmaster of Hogwarts
MrDumbledore's Avatar
Join Date: Oct 2010
Location: The Leaky Cauldron
Posts: 31
MrDumbledore is on a distinguished road
scheduleEvent just waits x number of seconds to do something.

PHP Code:
function onCreated() {
  
this.scheduleEvent(5"onMyEvent"null); // the last parameter isn't needed on v6 and above, or on serverside
}

function 
onMyEvent() {
  echo(
"event!");

"event!" would be echoed 5 seconds after the script ran.

e: also, MrOmega, you should avoid using variables with the name 'var' as they don't work on clientside (might just be this.var, I don't remember) due to some stupid Flash thing Stefan implemented. Avoiding the use of it altogether is best to avoid confusion.
__________________
It is our choices, Harry, that show what we truly are, far more than our abilities.
Reply With Quote
  #4  
Old 10-04-2010, 05:35 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by MrDumbledore View Post
e: also, MrOmega, you should avoid using variables with the name 'var' as they don't work on clientside (might just be this.var, I don't remember) due to some stupid Flash thing Stefan implemented. Avoiding the use of it altogether is best to avoid confusion.
I know, just my bad, just using a random variable name in general, although that is good advice for beggining scripters.

Also, what are some past accounts? You're very wise and knowledgable about gScript2, so I assume you do.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #5  
Old 10-04-2010, 05:42 AM
MrDumbledore MrDumbledore is offline
Headmaster of Hogwarts
MrDumbledore's Avatar
Join Date: Oct 2010
Location: The Leaky Cauldron
Posts: 31
MrDumbledore is on a distinguished road
Quote:
Originally Posted by MrOmega View Post
Also, what are some past accounts? You're very wise and knowledgable about gScript2, so I assume you do.
I'm a wizard.
__________________
It is our choices, Harry, that show what we truly are, far more than our abilities.
Reply With Quote
  #6  
Old 10-04-2010, 05:46 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Well you act a lot like an old scripting teacher/friend of mine from AE.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #7  
Old 10-04-2010, 06:50 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by MrOmega View Post
Well you act a lot like an old scripting teacher/friend of mine from AE.
Been starting to think more and more that he's Chris Vimes who magically stopped posting around the same time as this fellow showed up.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #8  
Old 10-04-2010, 08:56 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
I was thinking Invern, but I can see it being Chris too.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #9  
Old 10-04-2010, 09:05 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by MrOmega View Post
I was thinking Invern, but I can see it being Chris too.
I'd say that THIS post proves that it's Chris, not to mention how he's using him as example in more or less every post.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #10  
Old 10-04-2010, 09:15 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
And the mystery is solved 8-)
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
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 02:02 AM.


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