Jump to content
Sign in to follow this  
LizardX

"init" parameter question

Recommended Posts

Good afternoon,

is there anyone who could help me? I'd like to know how I can use the "caller unit" of the "init" EH in a script. What I mean:

config.cpp:

init = "(_this select 0) exec ""\blabla\script.sqs""";

It works, calls the script. But if try this:

script.sqs:

_vehicle = _this select 0

...

there will be an error, I think because the "init" has no returning variable, it could only be "false" or "true". (???) How could I define the caller unit in the script?

thx

Share this post


Link to post
Share on other sites

You want to do one of this:

Either:

config.cpp:

init = "(_this select 0) exec ""\blabla\script.sqs""";

script.sqs:

_vehicle = _this

or:

config.cpp:

init = "_this exec ""\blabla\script.sqs""";

script.sqs:

_vehicle = (_this select 0)

The explanation why is left to the reader. wink.gif

Share this post


Link to post
Share on other sites

Whoa, thanks, Suma, for the real fast answer. The first one already works (in 95%)! Just one word: have to apply

if () then {} <= look for the different signs!

My shame, it was in the comref, I wasn't smart enough. Holy syntax errors!

Thx again.

Share this post


Link to post
Share on other sites
Guest BratZ

Here's some I use:

init="[_this select 0] exec ""\iegf4u\manager.sqs""";

gear = "if (_this Select 1) then {[_this select 0] exec ""\iegf4u\geardn.sqs""} else {[_this select 0] exec ""\iegf4u\gearup.sqs""}";

getin="this animate [""corcanopy"", 1]";

getout="this animate [""corcanopy"", 0]";

They all work

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  

×