Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   string problem (https://forums.graalonline.com/forums/showthread.php?t=22903)

darkriders_p2p 02-03-2002 07:13 AM

string problem
 
When I make a string to equal something and then I reenter the level how come the string will appear twice in the flag menu?

joseyisleet 02-03-2002 08:05 PM

This aint josey
 
Try using a Variable #v
turns it into a number :D

darkriders_p2p 02-03-2002 10:48 PM

example
 
If I made something initilize with a client.variable then reloaded it would repeat flag in the flag menu,like
if (playerenters) setstring client.durbies,0;
When I reload it will put client.durbies=0,client.durbies=0 in the flag menu.I don't want to post the script cause its for mining,and people are looking for it.

royce 02-04-2002 01:29 AM

what you mean is why does it repeat setting their durbies to 0 after they re-enter the level it will reset the script back to setting the durbies to 0.....spilt that 1 part then use destroy to penilize that seciton.

darkriders_p2p 02-04-2002 02:54 AM

thanx,I fixed it,I made the script a bit better so it doesn't lag :P

Saga2001 02-04-2002 11:41 PM

It was doing that I believe because of a bug. I noticed that about a week ago also, I believe if you redownload it is fixed...

Gohan43331 02-05-2002 05:26 AM

I'm also having a problem with strings...
NPC Code:

// Example:
if (playertouchsme) {
if (strequals(balance,#c)) {
say2 Greetings. Your balance is: #v(strtofloat(brbank));
}
tokenize #c;
if (strequals(deposit,#t(0))&&playerrupees>=strtofloa t(#t(1))) {
this.brbanktemp=brbank+strtofloat(#t(1));
playerrupees-=strtofloat(#t(1));
setstring brbank,#v(this.brbanktemp);
say2 Deposited #t(1) gralats.#bBalance is now #v(strtofloat(brbank));
}
}



When i deposit, say...1 gralat...it always says the ammount deposited, but never resets the brbank string... And every time i check the balance...no matter what the this.brbanktemp or str(brbank) is...IT"S ALWAYS 00000000000000... :( :( :(
:grrr: :grrr: :grrr:

(Irritated) Gohan

Lomgren 02-05-2002 07:46 AM

Gohan,when reading the value of a string, you have to do this;
#v(strtofloat(#s(string))

not sure why, but it works

TDK_RC6 02-05-2002 08:16 AM

Quote:

Originally posted by Gohan43331
I'm also having a problem with strings...
NPC Code:

// Example:
if (playertouchsme) {
if (strequals(balance,#c)) {
say2 Greetings. Your balance is: #v(strtofloat(brbank));
}
tokenize #c;
if (strequals(deposit,#t(0))&&playerrupees>=strtofloa t(#t(1))) {
this.brbanktemp=brbank+strtofloat(#t(1));
playerrupees-=strtofloat(#t(1));
setstring brbank,#v(this.brbanktemp);
say2 Deposited #t(1) gralats.#bBalance is now #v(strtofloat(brbank));
}
}



When i deposit, say...1 gralat...it always says the ammount deposited, but never resets the brbank string... And every time i check the balance...no matter what the this.brbanktemp or str(brbank) is...IT"S ALWAYS 00000000000000... :( :( :(
:grrr: :grrr: :grrr:

(Irritated) Gohan

you shouldn't do strequals(balance,#c), well atleast i dont think so, you should do strequals(#c,balance)

TDK_RC6 02-05-2002 08:20 AM

try thisGohan43331

NPC Code:

// Example:
if (playertouchsme) {
if (strequals(#c,balance)) {
say2 Greetings. Your balance is: #v(strtofloat(brbank));
}
tokenize #c;
if (tokenscount==2&&strequals(#t(0),deposit)&&playerr upees>=strtofloat(#t(1))&&strtofloat(#t(1))>0) {
this.brbanktemp=strtofloat(#s(brbank))+strtofloat( #t(1));
playerrupees-=strtofloat(#t(1));
setstring brbank,#v(this.brbanktemp);
say2 Deposited #t(1) gralats.#bBalance is now #v(strtofloat(#s(brbank)));
}
}


Saga2001 02-05-2002 01:15 PM

Quote:

Originally posted by TDK_RC6


you shouldn't do strequals(balance,#c), well atleast i dont think so, you should do strequals(#c,balance)

if its checking to see if the strings are equal, why would it matter?...


All times are GMT +2. The time now is 10:29 AM.

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