Jump to content
Sign in to follow this  
Coding_Camel

Generic Expression Error with if statement

Recommended Posts

Hi, so I have a script where you walk up to a safe and try to rob it.

Only problem is I want it to display differently for each bank you rob.

_safe is defined at the top, given in a parameter when an action is selected. I've done hints with %1 variables and they display safe1, safe2, and safe3 as they should. Although when I use an if statement to check which safe it is it doesn't work.

if (_safe == "safe1") then
{
hint "safe 1";
};

Either gives "Zero Divisor Error" or "Generic Error in Expression"

Could it be that that if statement is inside another if statement?

Share this post


Link to post
Share on other sites

We need more info, there is nothing wrong with the script how it posted

How are you calling the script , do you have the right calls?

If not it can give odd errors even though the code is correct.

example

null=[] execvm "script.sqf"

or

[] exec "script.sqs"

Share this post


Link to post
Share on other sites

Well, it's a life mission;

So heres how it's executed from an action.

action4 =	_role addaction ["Rob safe","bankrob.sqf", ["ausrauben", safe1],1,false,true,"","player distance safe1 <= 3 and isciv"];

Share this post


Link to post
Share on other sites

Well it's not the way it's being called then.

I'm seeing "safe1" in the if statement and safe1 in the addaction are they supposed to be the same?

as one is a string and the other a variable or object

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  

×