Graal Forums

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

Googi 04-13-2002 05:48 AM

Flag problem thing
 
NPC Code:

else if (playerchats&&strequals(#c,rent mine 1)&&playergralats=>5&&mine.onea=0&&ownsmine){
say2 You already have a mine!;
}



The bolded part is a flag. The only problem is that even when the flag is set, it won't give the message "You already have a mine!"

Spanko 04-13-2002 05:49 AM

You've got the playergralats thing again.

Googi 04-13-2002 05:52 AM

Quote:

Originally posted by Spanko
You've got the playergralats thing again.
Oh, thanks, I fixed that, but that didn't fix the problem.

Gohan43331 04-13-2002 10:04 AM

Go in at each point and check the variables:

1. Do you have 5 gralats?
2. Is mine.onea == 0 ?
3. Did you type 'rent mine 1' correctly?

These may seem like quite stupid questions, but usually that's how I would debug something :P

Googi 04-13-2002 10:27 AM

Yes
Yes
Yes

My guess is that for some reason it doesn't check for the flag x_x

Oh well...

*Waits for a 1337 scripter like Kai or Archaon to show up*

Kadar 04-13-2002 11:36 AM

if (playerchats&&strequals(#c,rent mine 1)){
if (playerrupees=>5 && mine.onea=0 && ownsmine){
say2 You already have a mine!;
}
}

make sure mine.onea=0 and that you have more then 5 rupees and ownsmine is set..

Googi 04-13-2002 11:55 AM

Quote:

Originally posted by Kadar
if (playerchats&&strequals(#c,rent mine 1)){
if (playerrupees=>5 && mine.onea=0 && ownsmine){
say2 You already have a mine!;
}
}

make sure mine.onea=0 and that you have more then 5 rupees and ownsmine is set..

Gah, nope, still lets me rent more then one mine x_x

Dustey 04-13-2002 12:17 PM

lets see the first if that comes before that that actually rents out the mine if it isnt ownsmine:D

Googi 04-13-2002 08:25 PM

Thanks, still have the flag problem though x_x

Slaktmaster 04-13-2002 09:02 PM

Quote:

Originally posted by Kaimetsu
"playergralats=>5"

No sir!

"playergralats>=5" is your friend.

And Archaon is a LAT more than he is a NAT :-/

I'm quite good at scripting clientside stuff. :cool:

mhermher 04-13-2002 11:26 PM

Quote:

Originally posted by Googi
Yes
Yes
Yes

My guess is that for some reason it doesn't check for the flag x_x

Oh well...

*Waits for a 1337 scripter like Kai or Archaon to show up*

dont use flags, they suck
use


client.mineowned=1;
and if (client.mineowned==1) {

}

Googi 04-14-2002 02:03 AM

You mean like this?

NPC Code:

else if (playerchats&&strequals(#c,rent mine 1)){
if (playerrupees>=5){
if (ownsmine){
if (mine.onea=0){
say2 You already have a mine!;
}
}
}
}



Because that still doesn't work x_x

Googi 04-14-2002 02:26 AM

Quote:

Originally posted by Kaimetsu
place breakpoints
Umm...how?

konidias 04-14-2002 04:07 AM

NPC Code:

set ownsmine;
if (playerchats && strequals(#c,rent mine 1) && playerrupees>=5) {
if (mine.onea==0 && ownsmine){
say2 You already have a mine!;
}
}



Tada, this works.. just need to put "else" in front of the if and remove the set ownsmine; line.

Googi 04-14-2002 07:04 AM

Quote:

Originally posted by konidias
NPC Code:

set ownsmine;
if (playerchats && strequals(#c,rent mine 1) && playerrupees>=5) {
if (mine.onea==0 && ownsmine){
say2 You already have a mine!;
}
}



Tada, this works.. just need to put "else" in front of the if and remove the set ownsmine; line.

Nope, doesn't work.

As for the debugger, I used Koni's script, put it into the debugger, put the breaks beside them and then here's what happened.

Well, first it pauses the game, then in the dubugger it had the first line blue, I hit next, and the 2nd line turned blue, then I hit next again and the 5th line turned blue.

mhermher 04-14-2002 03:54 PM

Quote:

Originally posted by Kaimetsu


Uh...? No such thing as client variables, and even if there were, flags work perfectly fine.

ya but vars is better

Saga2001 04-14-2002 06:27 PM

I have a few things to say, one to googi:
The best way to get better with scripting is to start with smaller things, like for example, do bars and menus. Also I would suggest trying to have some more advanced scripters give you their showoffs, perhaps search the Scripting Forum for some showoffs. Another things to experiment with would be things like string manipulation, try playing with things like strlen, startswith, and stuff like that, my favorite is #e().
The next thing to Kai:
Debugger owns... I cannot tell you how many times debugger has saved me from countless hours of playing "find the error". Also wouldn't it be cool if there were a online debugger...woah...*goes to Future Improvements Forum even tho none of the improvements actually ever happen*.

mhermher 04-14-2002 06:53 PM

Quote:

Originally posted by Kaimetsu


Except that there's no such thing as a client.var, and they're not better.

for me they work better

Zelgadis_Geywords 04-14-2002 07:26 PM

Quote:

Originally posted by Kaimetsu


THEY DON'T EXIST.

Trying to get that point across seems as pointless as talking to a wall. :(

mhermher 04-14-2002 07:49 PM

Quote:

Originally posted by Kaimetsu


THEY DON'T EXIST.

ehh... you mean you cant use

client.ownsmine=1;
and if (client.ownsmine==1) {
}

then youre wrong
:/

Googi 04-14-2002 09:59 PM

Quote:

Originally posted by Saga2001
Also I would suggest trying to have some more advanced scripters give you their showoffs.
Unless someone decides to "showoff" the crafting table, gralat crafting table, or Glyco script (Which I have already searched the forums for), then that's not much use.

Googi 04-14-2002 10:01 PM

Quote:

Originally posted by Kaimetsu


When they turn blue, it means that the engine has reached that line. If it didn't go to the third line then it must mean that the if statement on the second line wasn't evaluating true. Which line is that?

The second line was...
NPC Code:

if (mine.onea==0 && ownsmine){


Googi 04-15-2002 01:56 AM

Quote:

Originally posted by Googi


Unless someone decides to "showoff" the crafting table, gralat crafting table, or Glyco script (Which I have already searched the forums for), then that's not much use.

...The irony of this is that someone did O_o

Googi 04-15-2002 06:09 AM

Well, now the script is this...
NPC Code:

else if (playerchats&&strequals(#c,rent mine 1)) {
if (ownsmine) {
say2 You already own a mine
}
}



And of course, it doesn't work

On the debugger, all the red lines turn blue (in sequence with the hitting of the run button of course)

Googi 04-15-2002 06:12 AM

Quote:

Originally posted by Kaimetsu


Summary: ownsmine is not set.

Gah, I made a mistake in the debugger thing. As I just edited the post to say, all the lines turn blue.

Googi 04-15-2002 06:15 AM

Quote:

Originally posted by Kaimetsu


On the code that you posted, you didn't put a semi-colon at the end of the say2 command.

Oh

*checks script*

It's there on the script, just not on the post x_x

EDIT: Just noticed this, but when I try to rent the SAME mine TWICE it comes up with the message "you already own a mine"

Googi 04-15-2002 07:58 AM

No, I want it to stop you from renting more then one mine.

Googi 04-15-2002 08:20 AM

Yeah, it doesn't do that.

Googi 04-15-2002 08:28 AM

Quote:

Originally posted by Kaimetsu


When you rent a mine twice, you get the message. That's the scenario I described.

Umm..no, it's like this.

The player says "rent mine 1"

They get the mine

THe player says "rent mine 1" again (while they still own the mine)

The message comes up "You already have a mine!"

But if they say "rent mine 1"

They get the mine

Then they say "rent mine 2"

They get mine 2 aswell.

Googi 04-15-2002 08:39 AM

Done

Gohan43331 04-17-2002 03:46 AM

Quote:

Originally posted by Kaimetsu


Uh...? No such thing as client variables, and even if there were, flags work perfectly fine.

So let me get this straight:
- Client.blah = 100
- setstring client.blah,Muahah;

So the first one won't stay with the player, and the second one will...

Good...now all i have to do is go through 100000 lines of code and fix them :grrr: :grrr: :grrr: :rolleyes:


All times are GMT +2. The time now is 12:50 AM.

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