Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-31-2004, 04:51 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Flag problems?

Ok, here's my problem, there is osbviously something wrong with how i set up the flag in the following script, but i cant figure out what (I know it's the flag because i ran several tests to check for the problem). It only does this once, even if the player has a lot of the string, acting like i have it set as if, instead of while. changing it to a for loop didnt help either.
NPC Code:


while (strtofloat(#s(clientr.#t(1)))>=1) {
freezeplayer .75;
setcharani ek_mine,;
setstring clientr.#t(1)dust,#v(strtofloat(#s(clientr.#t(1)du st))+1);
setstring clientr.#t(1),#v(strtofloat(#s(clientr.#t(1)))-1);
message #s(clientr.#t(1));
sleep .75;
setcharani idle,;
}



I have tried figuring it out myself, and i only put in part of the script, so i dont expect this thread to be closed/deleted before i solve this prob.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
  #2  
Old 10-31-2004, 05:40 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by falco10291029
Ok, here's my problem, there is osbviously something wrong with how i set up the flag in the following script, but i cant figure out what (I know it's the flag because i ran several tests to check for the problem). It only does this once, even if the player has a lot of the string, acting like i have it set as if, instead of while. changing it to a for loop didnt help either.
NPC Code:

some code


I have tried figuring it out myself, and i only put in part of the script, so i dont expect this thread to be closed/deleted before i solve this prob.
I suggest a timeout instead of while
is there anything using tokenize so #t(1) works?
  #3  
Old 10-31-2004, 05:44 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Quote:
Originally Posted by SlashP2P
I suggest a timeout instead of while
is there anything using tokenize so #t(1) works?
A timeout will not work in the script i have (i dont feel like posting the whole thing, just trust me), and yes, i am not stupid, it does tokenize it beforehand.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
  #4  
Old 10-31-2004, 05:49 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by falco10291029
A timeout will not work in the script i have (i dont feel like posting the whole thing, just trust me), and yes, i am not stupid, it does tokenize it beforehand.
Try putting the tokenize in the while loop and keep it wherever it is now too.
  #5  
Old 10-31-2004, 07:02 PM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
1. That's not a flag, it's a string.

2. clientr. strings can only be set SERVERSIDE.

3. I do not think a 'while' loop is the best thing to do here. But don't kill me if I'm wrong, but from what I see, other things might be better.
__________________
-Kjetil Valen
  #6  
Old 10-31-2004, 07:07 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by VeX_RaT_Boy
2. clientr. strings can only be set SERVERSIDE.
I looked at the whole script and it is serverside.
  #7  
Old 10-31-2004, 07:11 PM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
Is a player active in the serverside script?
__________________
-Kjetil Valen
  #8  
Old 10-31-2004, 08:05 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by VeX_RaT_Boy
Is a player active in the serverside script?
Its under if (playerchats)
  #9  
Old 10-31-2004, 09:04 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Yeah i tried a timeout loop but it doesnt even set the timeout if it;s serverside for some reason which is crap.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
  #10  
Old 10-31-2004, 10:50 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by falco10291029
Yeah i tried a timeout loop but it doesnt even set the timeout if it;s serverside for some reason which is crap.
I don't know what timeout you used, but you cant have anything less than .1 for a serverside timeout.
  #11  
Old 10-31-2004, 11:09 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally Posted by falco10291029
I have tried figuring it out myself, and i only put in part of the script, so i dont expect this thread to be closed/deleted before i solve this prob.
It's against the rules to post full code to solve someone's problem, not just post full code...

Quote:
A timeout will not work in the script i have
I'm sure it would, regardless of how much you'd need to change.


try taking out all of that unnecessary code first then find the problem.
PHP Code:
while (strtofloat(#s(clientr.#t(1)))>=1) {
  
setstring clientr.#t(1),#v(strtofloat(#s(clientr.#t(1)))-1); 
  
message clientr.#t(1) = #s(clientr.#t(1));
  
sleep .75;

PHP Code:
if (playerchats) {
  
tokenize #c;
  
setstring test#t(0),5;
  
timeout .1;
}
if (
timeout) {
  if (
strtofloat(#s(test#t(0)))>=1) {
    
setstring test#t(0),#v(strtofloat(test#t(0))-1);
    
message test#t(0) = #s(test#t(0));
  
}
  
timeout .1;

__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
  #12  
Old 11-01-2004, 12:01 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
I just tried using a timeout, it works fine offline meaning it's an online problem.. here's the new code:

PHP Code:
if (playerchats&&startswith(crush,#c)) {
  
tokenize #c;
  
if (strtofloat(#s(clientr.#t(1)))>0) {
    
playerx=x;
    
playery=y+5;
    
playerdir=0;
    
timeout=1;
  } else {
    
insertstring client.messages,0,You don't have any #t(1) gems.;
  }
}
if (timeout) {
  setcharani idle,;
  freezeplayer 1;
  setcharani ek_mine,;
  setstring clientr.#t(1)dust,#v(strtofloat(#s(clientr.#t(1)dust))+1);
  setstring clientr.#t(1),#v(strtofloat(#s(clientr.#t(1)))-1);
  setplayerprop #c,#s(clientr.#t(1));
  if (strtofloat(#s(clientr.#t(1)))<=0) {
    setcharani idle,;
    message Your crushing is completed;
  }
  else  {
    timeout=1;
  }

__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
  #13  
Old 11-01-2004, 04:29 AM
Andares Andares is offline
Scr1pt3r-ish
Andares's Avatar
Join Date: Mar 2004
Posts: 55
Andares is on a distinguished road
Send a message via AIM to Andares
Quote:
Originally Posted by Slash-P2P
I suggest a timeout instead of while
is there anything using tokenize so #t(1) works?
I wasn't even aware the while command existed on gscript.
I use timeouts. Timeouts own all.
__________________
Quote:
<Wan> Can I have a poll? Do people mind if I talk about sexual intercourse between two human beings?
<Kai> Wan, I think the problem is that it's basically ALL you talk about
<Wan> Ahhhhhh
Aim: AtariTandy | Job: Sanstrata)
  #14  
Old 11-01-2004, 11:52 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Andares
I wasn't even aware the while command existed on gscript.
I use timeouts. Timeouts own all.
I never new about insertstring :o
__________________
  #15  
Old 11-02-2004, 01:16 AM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
Quote:
Originally Posted by falco10291029
I just tried using a timeout, it works fine offline meaning it's an online problem.. here's the new code:

PHP Code:
//MY SCRIPT 
Is this a weapon, or what?
__________________
-Kjetil Valen
Closed Thread


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 09:24 PM.


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