Deadfast 43 Posted June 30, 2008 Hello all. I'm in a need of some help. I'm trying to do a simple if condition based on whether a car is locked or not. I have figured out that locked is the command I'm looking for. But whatever I type into the condition the script ends up yelling various errors (missing brackets, etc.). What am I doing wrong? PS, I did a search, but nothing relevant came out (as usual)... Share this post Link to post Share on other sites
squeeze 22 Posted June 30, 2008 for a simple trigger just NAME a vehicle car: place it within the trigger area. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">locked car in the condition and something like hint "locked" in the On Act if the car is locked you will see the hint if its not then no hint. Share this post Link to post Share on other sites
Deadfast 43 Posted June 30, 2008 Ah damn it! Looks like I was complicating things. It couldn't be any simpler. I've got a script of 70 lines, countless conditions and yet I get stuck on such stupidity Thanks a lot for your help! Share this post Link to post Share on other sites
Deadfast 43 Posted June 30, 2008 Alright, disregard whatever I said above. It just doesn't work... Well, it worked alright for few hours. But now, when I decided to continue with the code it just doesn't work. It was still b*tching about lines containing the locked condition. Removing them restored the script's functionality. I even went so far to create a script file containing nothing but: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (locked car) then { hint "Locked"; }; Car's init line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> this addAction ["test", "test2.sqf"] The result: Now seriously, what the hell am I doing wrong? Is this some kind of a bug? Share this post Link to post Share on other sites
kronzky 5 Posted June 30, 2008 The syntax looks fine. But there must be something else going on, that you're not telling us... I tried the same code you listed, and it worked as expected (demo mission). I also expanded the test script a bit, to check for different cars, and that worked fine as well: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_car = _this select 0; if (locked _car) then { Â Â hint "Locked"; } else { Â Â hint "Unlocked"; }; Share this post Link to post Share on other sites
benreeper 0 Posted July 1, 2008 Did he name the car? --Ben Share this post Link to post Share on other sites
poweruser 10 Posted July 1, 2008 Somewhere in your mission, you must have overwritten the script command locked with something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">locked = true; That's the only way I could reproduce this error message. If there were anything wrong with the parameter car: 1: not set, command "locked" returns bool (neither true, nor false; no error message) 2: some other type (bool, number, string, ... ), you get a meaningful error message Share this post Link to post Share on other sites
Deadfast 43 Posted July 1, 2008 Thank you all so much for your help. Deng figured it out in the end. Looks like I forgot a trigger on the other side of a map. Bah... So thanks again, finally I can return to my work . Ah, BTW, since I have a topic open: How can you display a variable in the middle of localized text in stringtable? To give you an example: The driver is <variable> at the moment. Share this post Link to post Share on other sites
squeeze 22 Posted July 1, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player sidechat format["The driver is %1 at the moment",name driver vehicle _car]; Share this post Link to post Share on other sites
Deadfast 43 Posted July 1, 2008 Thanks, but I would need to have stringtable with the variable in the middle . Share this post Link to post Share on other sites