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 05-24-2012, 04:27 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
Serverside Sleeping

How can I make a working sleep/Timer in a script with out using Timeouts/schedule events to change a value you twice in a script?

PHP Code:
function onActionServerside()
{
 
blah
 blah
 player
.clientr.testvalue 0
blah
sleep
(5);   <--I thought this would work but no :(
 
player.clientr.testvalue 1
Reply With Quote
  #2  
Old 05-24-2012, 04:35 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Why can't you use schedule event?

PHP Code:
function onActionServerSide() {
  
blah();
  
blah();
  
clientr.testvalue 0;
  
this.scheduleevent(5"ChangeTestValue"player.account);
}

function 
onChangeTestValue(pl) {
  
pl findplayer(pl);
  if (
pl != NULL) { 
    
pl.clientr.testvalue 1;
  }

__________________
Quote:
Reply With Quote
  #3  
Old 05-24-2012, 10:48 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 fowlplay4 View Post
Why can't you use schedule event?

PHP Code:
function onActionServerSide() {
  
blah();
  
blah();
  
clientr.testvalue 0;
  
this.scheduleevent(5"ChangeTestValue"player.account);
}

function 
onChangeTestValue(pl) {
  
pl findplayer(pl);
  if (
pl != NULL) { 
    
pl.clientr.testvalue 1;
  }

Even better:

PHP Code:
function onActionServerSide() { 
  
blah(); 
  
blah(); 
  
clientr.testvalue 0
  
this.scheduleevent(5"ChangeTestValue"player); // send the player object instead of the account


function 
onChangeTestValue(pl) { 
  if (
pl != NULL) {  
    
pl.clientr.testvalue 1
  } 

__________________
Reply With Quote
  #4  
Old 05-24-2012, 10:55 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
Even better:
I had that originally I didn't know if objects would be sent properly.
__________________
Quote:
Reply With Quote
  #5  
Old 05-24-2012, 11:14 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 fowlplay4 View Post
I had that originally I didn't know if objects would be sent properly.
Indeed they are .
__________________
Reply With Quote
  #6  
Old 05-25-2012, 04:07 AM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
Thanks all! works good :0
Reply With Quote
  #7  
Old 05-25-2012, 04:20 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
Quote:
Originally Posted by blackbeltben View Post
Thanks all! works good :0
But do you know why it works well?
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:24 PM.


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