Jump to content
Sign in to follow this  
Nicolas Eymerich

Two Fast questions

Recommended Posts

smile_o.gif

Okay, I've done a long search but I didn't find a toturial function. Now that Opfec is down is there someone who can send me one?

I've a problem with add-action

In my mission I've:

P_g = Alpha addaction ["","script to execute"]

I was wondering if this line will be good at the same time too:

P_g = Alpha addaction ["",{"script to execute"; _alfa = true; [_alfa] exec "script to execute"}]

Share this post


Link to post
Share on other sites

unit addAction action

Operand types:

unit: Object

action: Array

Compatibility:

Version 1.1 required.

Type of returned value:

Nothing

Description:

Create an action. Action ID should be returned, but due to bug it is not. Action ID should be returned, but due to bug it is not. To determine action ID use following algorithm: first action added to given vehicle has ID zero, next has ID one, etc.

Example:

player addAction ["Hello", "hello.sqs"]

Is this a singleplayer or multiplayer mission?

Share this post


Link to post
Share on other sites

Don't understand your reply crazy_o.gif

I was wondering if is possible to use the {} even in addaction statment. wink_o.gif

Btw: It is a single player mission

smile_o.gif

Share this post


Link to post
Share on other sites

I just copied from my comref. It shows how to use addaction.

Share this post


Link to post
Share on other sites

@pazuzu --> Thanks you. I already knew it...  wink_o.gif

Quote[/b] ]

Why don't you just try it.

Because it is an idea come to my mind yesterday evening and at the moment can't try to test it 'cause I'm at work  wink_o.gif

Quote[/b] ]

And no, it doesn't work like that.

Okay. So: is there a way to realize it?  smile_o.gif

Share this post


Link to post
Share on other sites

Of course there is a way to have alf set to true and have another script executed...

just put it into the script you execute by the action...

Share this post


Link to post
Share on other sites

Yes, do that code in the script.

No.

Tht's useless for me but I can suppose it's quite hard for you to give the proper solution(s) without knowing the back stage.

In the first one script You have over 5 action.

It's sounds like this:

? condition > 100 : Alfa addaction ["Scout","script to be executed"]

? condition > 200 : Beta addaction ["Patrol","script to be executed"]

? condition > 300 : Gamma addaction ["Assault","script to be executed"]

(and so on)

(Consider "condition" as useless to solve my problem. It is represented by different globals variables.

"Script to be executed" is a Move script. it says to unit to reach a position defined by statement "onmapsingleclick")

Okay. Let's stop here. Now, I can have 3 differents scripts wich are all equal to them except for a global array (The global array is different because of any team [in our case: Scout team, Patrol Team and Assault Team]). In other words, I can have three differents scripts wich are equal each one to other expect for a bit different (The Global Array).

I've already realized it. It is not a problem (except in having  different folders and having a lot of script wich are almost equal beetwen them).

Instead I was asking to you if there is a way to store inside the addaction statement a variable and then pass that variable to a general move script. This is what I have in mind:

? condition : Alfa addaction ["scout", { [] exec "script to be executed; Alfa1 = true}

? condition : Beta addaction ["Patrol", { [] exec "script to be executed; Beta1 = true}

and in the (general and only) "Script move" have someting like

if (alfa) then {_team = TeaminfantryScout; goto "Main part of the script [this is the common part wich is equal in every different script]"}

if (beta) then {goto "Main part of the script [this is the common part wich is equal in every different script]"; _team = TeaminfantryPatrol}

and so on.

#Main part of the script

? ...

exit

Any idea to perform such results?

Keep in my mind that I'm not interested in having the Golabal variable Alfa1 setted by the following statement

? condition : Alfa addaction ["scout", [] exec "script to be executed"]

where "script to be executed" set true the global Variable "Alfa1".

It's a bit complicated. I hope you understand what I'm planning to do...

smile_o.gif

Share this post


Link to post
Share on other sites

that is, again, not a problem.

just add three small scripts:

scout (set global variable and array acording to scout stuff and execute second script)

patrol (set global variable and array acording to patrol stuff and execute second script)

assault (set global variable and array acording to assault stuff and execute second script)

run these scripts by the action commands.

2nd script:

the parts of the initial script you had which are equal for all three types.

Share this post


Link to post
Share on other sites

Yes, do that code in the script.

No.

Tht's useless for me but I can suppose... [cut cut cut]

As I said... Do that code in the script. So you have alpha.sqs, bravo.sqs, charlie.sqs...

alpha.sqs:

[0] exec "veryverybigscript.sqs";

bravo.sqs:

[1] exec "veryverybigscript.sqs";

charlie.sqs:

[2] exec "veryverybigscript.sqs";

Share this post


Link to post
Share on other sites
So you have alpha.sqs, bravo.sqs, charlie.sqs...

alpha.sqs:

[0] exec "veryverybigscript.sqs";

bravo.sqs:

[1] exec "veryverybigscript.sqs";

charlie.sqs:

[2] exec "veryverybigscript.sqs";

Thanks Metal hearth but.... that's was right the thing I would to be avoided wink_o.gif

Share this post


Link to post
Share on other sites

Yes but it's still better than having the same script three times. And you can put them to folders like actions\act1.sqs. With radio triggers (radio alpha, radio bravo...) you can have that like {x=2;y=4;z=8;[x,y,z] exec "script.sqs";hint "script run with parameters x,y,z";} and you can set the titles with "0" SetRadioMsg "Scout"; "1" SetRadioMsg "Patrol"...

Share this post


Link to post
Share on other sites
Yes but it's still better than having the same script three times. And you can put them to folders like actions\act1.sqs. With radio triggers (radio alpha, radio bravo...) you can have that like {x=2;y=4;z=8;[x,y,z] exec "script.sqs";hint "script run with parameters x,y,z";} and you can set the titles with "0" SetRadioMsg "Scout"; "1" SetRadioMsg "Patrol"...

Using a trigger to obtain what I can't by the action statement?

Mmmm... I haven't thinked about it.

It could sounds nice...

Thanks again 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  

×