Jump to content
Sign in to follow this  
Tankbuster

game says "missing ]" but can't see where.

Recommended Posts

But squint doesn't generate any such error.

This line of code, and a few others from this script is dynamically generated using call compile format. I know would be better advised to use missionNamespace and I will in the future, but I found call compile format easier to understand. In addition to compiling the line, the exact same code is used to diag_log it.

Anyway, here's the line. Hopefully, it's self explanatory.

t_iedtrigger5 setTriggerStatements ["vehicle player in thisList && player selectionPosition "Neck" select 2 > 0.5 && !(vehicle player isKindOf "air")", "tankyied5 = createVehicle ["SEK_TR_GUE_smallbomb", [4368.13,3254.38], [], 0, "NONE"]", ""]

I've been peering at this line all day and Squint doesn't complain about a bad bracket count, but the game does. Error below.

Error in expression <class, [_t_xpos, _t_ypos], [], 0, "NONE">
 Error position: <>
 Error Missing ]
Error in expression <n thisList && player selectionPosition "Neck" select 2 > 0.5 && !(vehicle player>
 Error position: <Neck" select 2 > 0.5 && !(vehicle player>
 Error Missing ]

Share this post


Link to post
Share on other sites

I cant say for sure but I bet the problem is strings with strings. SetTriggerStatements takes three strings as arguments. So, if you use strings inside strings you need to use double double quotes or single quotes like ""neck"" or 'neck'. You have strings inside strings for condition and on activation.

Share this post


Link to post
Share on other sites

Yep, Loyalguard is right I think. I've been puzzled at this sort of thing before also.

Share this post


Link to post
Share on other sites

t_iedtrigger5 setTriggerStatements ["vehicle player in thisList && player selectionPosition 'Neck' select 2 > 0.5 && !(vehicle player isKindOf 'air')", "tankyied5 = createVehicle ['SEK_TR_GUE_smallbomb', [4368.13,3254.38], [], 0, 'NONE']", ""]

;)

Share this post


Link to post
Share on other sites

I too suspected the quotes and I'm pretty sure I've tried many combinations.

t_iedtrigger5 setTriggerStatements ["vehicle player in thisList && player selectionPosition 'Neck' select 2 > 0.5 && !(vehicle player isKindOf 'air')", "tankyied5 = createVehicle ['SEK_TR_GUE_smallbomb', [4279.38,3203.13], [], 0, 'NONE']", ""]

gave

Error in expression <class, [_t_xpos, _t_ypos], [], 0, "NONE">
 Error position: <>
 Error Missing ]

The error doesn't give a line number, which is odd. The createVehicle command is built using format in the previous line, but as the output appears to be good, I'm at a bit of a loss. I mean, usually, with a weird bracket or quote mark mismatch, I'd look earlier in the code for an error, but the outputed line doesn't seem wrong to me.

Edited by Tankbuster

Share this post


Link to post
Share on other sites
I too suspected the quotes and I'm pretty sure I've tried many combinations.

t_iedtrigger5 setTriggerStatements ["vehicle player in thisList && player selectionPosition 'Neck' select 2 > 0.5 && !(vehicle player isKindOf 'air')", "tankyied5 = createVehicle ['SEK_TR_GUE_smallbomb', [4279.38,3203.13], [], 0, 'NONE']", ""]

gave

Error in expression <class, [_t_xpos, _t_ypos], [], 0, "NONE">
 Error position: <>
 Error Missing ]

The error doesn't give a line number, which is odd. The createVehicle command is built using format in the previous line, but as the output appears to be good, I'm at a bit of a loss.

Changing your code as you did, fixes the 2nd error

Error in expression <n thisList && player selectionPosition "Neck" select 2 > 0.5 && !(vehicle player>
 Error position: <Neck" select 2 > 0.5 && !(vehicle player>
 Error Missing ]

The first error still stands, and has nothing to do with the code bit you posted:

Error in expression <class, [_t_xpos, _t_ypos], [], 0, "NONE">
 Error position: <>
 Error Missing ]

it comes from somewhere else.

Search your files for e.g: [_t_xpos, _t_ypos], [], 0

Share this post


Link to post
Share on other sites

I'm going through the code right now. I must say that I was suspecting an error in code somewhere other than that triggerstatements line, expecially when the RPT didn't quote a line number.

Edited by Tankbuster

Share this post


Link to post
Share on other sites

There was a number of errors in the code. :)

From misplaced brackets in the createVehicle, to forgetting how format works. Duh. :)

Anyway, other than debug, the RPT is now clean. Thanks guys.

So, a huge thanks to everyone who helped out. It's really very appreciated.

Share this post


Link to post
Share on other sites

Glad you tracked them down..btw, the reason why you may not have had lines numbers for some of the errors is that if you use call compile (I think you said you did) I don't think you get line numbers if there are errors in it.

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  

×