frag 0 Posted September 28, 2009 I am almost pulling my hair out. I am playing around with an If-Then-Else condition for an hour now and cannot make it works. I made few test and I can’t even make the simplest one to work. (In a sqf file) Entance1 being a building, if I do this it works correctly _d = getdammage entrance1; hint format ["%1",_d]; if (_d<1) then{hint "not dead"} else {titletext["Dead","Plain"]}; But if I do it this way (different indentation), it behaves really strangely (I receive both the hint and the title cut, meaning that both the If and the Else parts are executed. _d = getdammage entrance1; hint format ["%1",_d]; if (_d<1) then { hint "not dead" } else { titletext["Dead","Plain"] }; I tried to put ; at the end of both the hint and the titletext lines …resulting in the same effect. Am I stupid or I am missing something? I looked at many scripts without understanding what I am doing badly. ps: I am using Arma Edit 1.3 as the editor Share this post Link to post Share on other sites
mr_centipede 31 Posted September 28, 2009 Try this: _d = getdammage entrance1; hint format ["%1",_d]; if (_d<1) then { hint "not dead"; } else { titletext["Dead","Plain"]; }; incase you didn't notice a difference, its semicolon ( ; ) in the bolded part Share this post Link to post Share on other sites
frag 0 Posted September 28, 2009 Try this:_d = getdammage entrance1; hint format ["%1",_d]; if (_d<1) then { hint "not dead"; } else { titletext["Dead","Plain"]; }; incase you didn't notice a difference, its semicolon ( ; ) in the bolded part I tried it also (look at the end of my original message). I wonder if it could not be a bug with the "hint" call or such. I will make further testing tonight, but I have to say that I am really tired playing around a simple if. I wonder if one of you guys could try this out for me and tell me if you have the same result. Share this post Link to post Share on other sites
shuko 59 Posted September 28, 2009 When you say you get both hint and titletext, do you mean you see the damage or the "not dead" text? _d = getdammage entrance1; if (_d < 1) then { hint "not dead"; } else { titletext["Dead","Plain"]; }; Share this post Link to post Share on other sites
Mike84 1 Posted September 28, 2009 You use exec or execVM? Share this post Link to post Share on other sites
frag 0 Posted September 28, 2009 You use exec or execVM? [] exec "scripts\test.sqf" ---------- Post added at 05:10 PM ---------- Previous post was at 05:09 PM ---------- When you say you get both hint and titletext, do you mean you see the damage or the "not dead" text? _d = getdammage entrance1; if (_d < 1) then { hint "not dead"; } else { titletext["Dead","Plain"]; }; I see the hint"Not dead" appearing and the title text as well. Considering it is an If-Then-Else condition, I should see only one. Share this post Link to post Share on other sites
Mike84 1 Posted September 28, 2009 [] exec "scripts\test.sqf" That's your problem. Use execVM next time. Share this post Link to post Share on other sites
Big_Daddy 10 Posted September 28, 2009 use execVM exec thinks your running a SQS script, even if it's called sqf. sqs has a different format. which is why when in a single line it worked. Share this post Link to post Share on other sites
frag 0 Posted September 28, 2009 That's your problem. Use execVM next time. use execVMexec thinks your running a SQS script, even if it's called sqf. sqs has a different format. which is why when in a single line it worked. You are the dudes! Thanks a lot! It makes sense! I will try it on later on tonight. But is the execVM will run asynchronously? I guess that if I have to keep the thing synchronous I will have to change my syntax in the script to use exec instead of execvm. Thanks again guys, this forum is a bless. Share this post Link to post Share on other sites
shuko 59 Posted September 28, 2009 You can just use call to run it in the same thread if you need to make sure something is done asap. Or you can start a new one with execvm and add a waituntil at the start to wait whatever is needed. Share this post Link to post Share on other sites
frag 0 Posted September 29, 2009 You are the dudes! Thanks a lot! It makes sense! I will try it on later on tonight. But is the execVM will run asynchronously? I guess that if I have to keep the thing synchronous I will have to change my syntax in the script to use exec instead of execvm. Thanks again guys, this forum is a bless. By the way I tested it yesterday night and it was in fact my problem. Share this post Link to post Share on other sites