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 01-08-2002, 08:15 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
...stumped...

I think its a glitch with graal now, but look. I have this loop, when I use variables it works perfect, but when I use strings (and I have to use strings because regular variables will go to 0 when you leave levels) the while loop doesn't work. Heh, it may be a n00b question, but I don't care. Here it is:

while (!strequals(#v(this.on),#s(mapf))) {
this.on=strtofloat(#s(mapf));
}

Heh...I'm not going to show the whole script because of the genius calulations and script...but anywho go ahead and make fun of me for not knowing how to fix this simple problem -_-. Tell me how to fix it first though
__________________
This account is no longer is use.

Last edited by BlKnight; 01-08-2002 at 11:05 AM..
Reply With Quote
  #2  
Old 01-08-2002, 11:05 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Heh forgot to make that blue...
__________________
This account is no longer is use.
Reply With Quote
  #3  
Old 01-08-2002, 12:31 PM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
if the mapf or whatever is a non-numerical string ur code wont work since vars are numerical..
else u can just use what ur using but switch the 2 and dont use #s()
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #4  
Old 01-08-2002, 02:27 PM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Quote:
Originally posted by LiquidIce00
if the mapf or whatever is a non-numerical string ur code wont work since vars are numerical..
else u can just use what ur using but switch the 2 and dont use #s()

The only reason I'm using a string is because normal variables are reset when changing levels. Basicly I have a key-combo NPC, this checks which keys are pressed, what order they are pressed, and how long they are pressed. Then you press A, then D it sets a string called mapf, which is basicly on or not. But, for some reason the while loop isn't working, and I can't use timeout for a few reasons.
__________________
This account is no longer is use.
Reply With Quote
  #5  
Old 01-08-2002, 04:17 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
i think what you should do, is...

NPC Code:

this.uther = strtofloat(#s(mapf));
while (this.on!=this.uther) {
this.on=strtofloat(#s(mapf));
}



simple fix...right? for some reason, if you did this:
NPC Code:

while (this.on!=strtofloat(#s(mapf))) {
this.on=strtofloat(#s(mapf));
}



it wouldn't work, i think because in order to test something, it has to be a 1 or 0 not a string, strpings always equal 0. i learned that when i jailed every player on doomsday with my jailing system...bad news bear...
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #6  
Old 01-08-2002, 04:18 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
299
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #7  
Old 01-08-2002, 04:20 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
300

sorry, had to post 300 so i could go to bed....thanks...
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #8  
Old 01-08-2002, 06:26 PM
mhermher mhermher is offline
galase galase!
mhermher's Avatar
Join Date: Jun 2001
Location: Sweden, Stockholm.
Posts: 2,012
mhermher is on a distinguished road
Send a message via ICQ to mhermher Send a message via AIM to mhermher Send a message via Yahoo to mhermher
Re: ...stumped...

Quote:
Originally posted by BlKnight
I think its a glitch with graal now, but look. I have this loop, when I use variables it works perfect, but when I use strings (and I have to use strings because regular variables will go to 0 when you leave levels) the while loop doesn't work. Heh, it may be a n00b question, but I don't care. Here it is:

while (!strequals(#v(this.on),#s(mapf))) {
this.on=strtofloat(#s(mapf));
}

Heh...I'm not going to show the whole script because of the genius calulations and script...but anywho go ahead and make fun of me for not knowing how to fix this simple problem -_-. Tell me how to fix it first though
I think u have to change the this.on=strtofloat(#s(mapf));
to
setstring this.on,strtofloat(#s(mapf));
__________________
Donate money for my trip to Germany

Adiarde Manager
Reply With Quote
  #9  
Old 01-08-2002, 06:28 PM
mhermher mhermher is offline
galase galase!
mhermher's Avatar
Join Date: Jun 2001
Location: Sweden, Stockholm.
Posts: 2,012
mhermher is on a distinguished road
Send a message via ICQ to mhermher Send a message via AIM to mhermher Send a message via Yahoo to mhermher
Re: Re: ...stumped...

Quote:
Originally posted by mhermher


I think u have to change the this.on=strtofloat(#s(mapf));
to
setstring this.on,strtofloat(#s(mapf));

I hope it work
__________________
Donate money for my trip to Germany

Adiarde Manager
Reply With Quote
  #10  
Old 01-08-2002, 11:26 PM
Xaviar Xaviar is offline
Registered User
Join Date: Aug 2001
Location: Fairyland
Posts: 463
Xaviar is on a distinguished road
Send a message via ICQ to Xaviar Send a message via AIM to Xaviar
Wait, so why a while? It'll only run once anyways, so just use an if..
__________________
One by one, the penguins steal my sanity.

*cookie for Xaviar* --Originally posted by Tyhm

--Xaviar

A m e r i c a
Reply With Quote
  #11  
Old 01-09-2002, 06:15 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Quote:
Originally posted by Xaviar
Wait, so why a while? It'll only run once anyways, so just use an if..

What do you mean only once? If's run only once or if in a loop, Whiles run as long as the flag=true.
__________________
This account is no longer is use.
Reply With Quote
  #12  
Old 01-09-2002, 06:36 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Re: ...stumped...

Quote:
Originally posted by BlKnight
I think its a glitch with graal now, but look. I have this loop, when I use variables it works perfect, but when I use strings (and I have to use strings because regular variables will go to 0 when you leave levels) the while loop doesn't work. Heh, it may be a n00b question, but I don't care. Here it is:

while (!strequals(#v(this.on),#s(mapf))) {
this.on=strtofloat(#s(mapf));
}

Heh...I'm not going to show the whole script because of the genius calulations and script...but anywho go ahead and make fun of me for not knowing how to fix this simple problem -_-. Tell me how to fix it first though
while's which have run once and have no reason to run again (E.G. no "trigger" flag like timeout), won't run again. Putting it in a timeout loop will probably fix your problem.
__________________

Reply With Quote
  #13  
Old 01-09-2002, 10:14 PM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Try using #v also it may help I dont know why
Reply With Quote
  #14  
Old 01-09-2002, 11:12 PM
Xaviar Xaviar is offline
Registered User
Join Date: Aug 2001
Location: Fairyland
Posts: 463
Xaviar is on a distinguished road
Send a message via ICQ to Xaviar Send a message via AIM to Xaviar
Quote:
Originally posted by BlKnight



What do you mean only once? If's run only once or if in a loop, Whiles run as long as the flag=true.
It'll only run once because you're making the condition false inside the loop, as soon as it runs:

while (!strequals(#v(this.on),#s(mapf))) {
this.on=strtofloat(#s(mapf));
}

after it runs once, this.on gets the value of mapf, and !strequals(#v(this.on),#s(mapf)) becomes false
__________________
One by one, the penguins steal my sanity.

*cookie for Xaviar* --Originally posted by Tyhm

--Xaviar

A m e r i c a
Reply With Quote
  #15  
Old 01-10-2002, 07:00 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
But since the value of mapf changes, it becomes true again, in which case the while loop SHOULD continue.
__________________
This account is no longer is use.
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 06:19 AM.


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