![]() |
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: |
There is a mistake in your script.
|
if you post part of the script that gives you problems it would be easier to see how to fix it.
|
then you probably have like:
NPC Code: 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 |
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.
|
Quote:
Preferably he would use if (playerchats).......... |
Quote:
|
bear with me, i suck at scripting:
NPC Code: not sure if that is correct, but oh well. |
NPC Code: A little fix to that. |
Quote:
|
Quote:
Another little fix to that.. if(playerchats && strequals(#c,hi)){ message Blah; } |
Quote:
|
Why?
|
Using braces tends to make the code more legible.
|
Quote:
Quote:
|
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)
|
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.