Jump to content
Sign in to follow this  
Deadfast

Is a car locked?

Recommended Posts

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

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

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 rofl.gif

Thanks a lot for your help! xmas_o.gif

Share this post


Link to post
Share on other sites

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:

blbost_error.gif

Now seriously, what the hell am I doing wrong? banghead.gif

Is this some kind of a bug?

Share this post


Link to post
Share on other sites

The syntax looks fine. But there must be something else going on, that you're not telling us... wink_o.gif

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

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

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 wink_o.gif.

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

<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

Thanks, but I would need to have stringtable with the variable in the middle wink_o.gif.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×