Jump to content
Sign in to follow this  
Nicolai

script troubleshoot

Recommended Posts

Hi all,

I'm making my first, relatively simple, camera script.

All was going well so far, but now I have stumbled upon a problem. May I ask you to look at the following code:

;=== 10:52:27
_camera camPrepareTarget harrier
_camera camPreparePos [5972.01,11561.92,23.83]
_camera camPrepareFOV 0.900
_camera camCommitPrepared 8
@camCommitted _camera

~4

#loop

;=== 10:52:27
_camera camprepareTarget a10
_camera camsetTarget a10
_camera camSetRelPos [0,7,3]
_camera camPrepareFOV 0.900
_camera camCommitPrepared 0
@camCommitted _camera

if (triggerActivated a10trigger1) then {
goto "nextscene"} else {goto "loop"};



#nextscene

;=== 10:52:27
_camera camsetTarget a10
_camera camSetRelPos [4,-4,2]
_camera camPrepareFOV 0.900
_camera camCommitPrepared 0
@camCommitted _camera


goto "nextscene"

As you can see, the camera first tracks a harrier taking off for 4 seconds and then it should give a front view of an a-10 taking off. When that a-10 comes in a trigger area (a10trigger1), it should go to another view of the a-10.

It doesn't do that, instead it goes instantly from the harrier to the second view of the a-10. I think my problem is with the If and Else. Either that or I have a trigger that's always activated:confused:

If you want me to upload the full mission, just say so.

Thanks in advance,

Nicolai

Share this post


Link to post
Share on other sites

Binding rules:

* Statements are seperated by line breaks and semicolons (;) and commas (,). This means that a statement must not span over multiple lines.

* Curled braces ({ }) group code to blocks. A block is considered a single statement, thus may not span over multiple lines.

The control structures listed in the article Control Structures may also be used in SQS syntax. Note that they must be written within a single line due to the above rules.

Example:

if (_value==1) then {hint "Value is 1"} else {hint "Value is not 1"}

There exist also special structures limited to SQS syntax.

Try:

if (triggerActivated a10trigger1) then {goto "nextscene"} else {goto "loop"}

Share this post


Link to post
Share on other sites

That's brilliant, it worked!

I thought it was ok to leave it in multiple lines, I guess it isn't

Thanks a lot!

Nicolai

Share this post


Link to post
Share on other sites

In SQF it is, but most camera scripts are written in SQS which has slightly different formatting rules.

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  

×