Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Some Trouble with Flags (https://forums.graalonline.com/forums/showthread.php?t=44327)

slimchance11 04-17-2003 10:48 PM

Some Trouble with Flags
 
I'm having some trouble with flags... once I set them (or unset them) they aren't really set or unset until I press F4 and run the level again.

Like lets say when I said hi then the guy would say "Hello There!" and if I said bye then he would say "See you later!"

Except for me, if i was to say hi nothing would happen, i would have to press f4 and play the level again then he would be saying "Hello There!" The same goes for unsetting flags.

Is this normal? What's wrong?:confused:

Loriel 04-17-2003 11:12 PM

There is a mistake in your script.

Pokilty 04-17-2003 11:22 PM

if you post part of the script that gives you problems it would be easier to see how to fix it.

Projectshifter 04-18-2003 04:34 AM

then you probably have like:
NPC Code:

if (flag)
{ action;}


but because that is not an event in itself, it only calls when it reads the script for the first time (if created basically);
---Shifter

Spark910 04-20-2003 01:52 PM

It depends what you trying to do, but you could either run a loop to check for the flag, so the action happenes when you get the flag. Or you could set the timeout in the NPC you recive the flag from.

adam 04-20-2003 02:29 PM

Quote:

Originally posted by Spark910
It depends what you trying to do, but you could either run a loop to check for the flag, so the action happenes when you get the flag. Or you could set the timeout in the NPC you recive the flag from.

Preferably he would use if (playerchats)..........

Spark910 04-20-2003 04:41 PM

Quote:

Originally posted by adam



Preferably he would use if (playerchats)..........

ahh. yes! I only read title and other peoples comments.

Mykel 04-20-2003 05:14 PM

bear with me, i suck at scripting:

NPC Code:
if (playerchats && strequals{#c,hi})
message Hello There!;



not sure if that is correct, but oh well.

Neoreno 04-20-2003 05:16 PM

NPC Code:

if (playerchats && strequals(#c,hi))
message Blah;



A little fix to that.

Mykel 04-20-2003 05:19 PM

Quote:

Originally posted by Neoreno
NPC Code:

if (playerchats && strequals(#c,hi))
message Blah;



A little fix to that.

ahh, wasnt sure if it was )('s or }{'s around the #c,hi

osrs 04-20-2003 07:44 PM

Quote:

Originally posted by Neoreno
NPC Code:

if (playerchats && strequals(#c,hi))
message Blah;



A little fix to that.


Another little fix to that..

if(playerchats && strequals(#c,hi)){
message Blah;
}

Neoreno 04-21-2003 12:44 AM

Quote:

Originally posted by osrs



Another little fix to that..

if(playerchats && strequals(#c,hi)){
message Blah;
}

You don't have to put the {} down if there is only one command after the event.

PrinceDark 04-21-2003 01:22 AM

Why?

Jeff 04-21-2003 02:04 AM

Using braces tends to make the code more legible.

osrs 04-21-2003 08:58 AM

Quote:

Originally posted by Neoreno


You don't have to put the {} down if there is only one command after the event.

Listen to what Jeff said..

Quote:

Originally posted by Jeff
Using braces tends to make the code more legible.

Falados 04-21-2003 04:35 PM

Its a matter of preference, I myself like to put things in braces, but only if they are legitimately complex commands. Braces are just grouping a series of commands together so a conditional statement knows it needs to execute all of the following commands, instead of just the one that follows it. Putting a brace around 1 command is legitimate, but it’s like making an array with 1 element, I don’t think it makes the script more legible (unless you start wildly using white space, or the reverse, lack white space)

Dude6252000 04-21-2003 05:21 PM

braces 4 lyf

I honestly didn't know you didn't need them for one command since about a week ago. o.o They're still my friend.


All times are GMT +2. The time now is 03:44 PM.

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