Jump to content
RudyRedTop

(Solved) How to have multiple functions with addActions

Recommended Posts

Hi there, I'm trying to set up a script that will both change the state of a task and also display a separate hint for the players. If it's possible to have an addAction activate two functions I'm unable to figure out the syntax. Here's what I'm working with so far;
 

this addAction ["Try Elevator Controls",{["EscapeCargo", "FAILED", True] call BIS_fnc_taskSetState}];

This function seems to work just fine with the task modules I've already set down with 3den editor. However I also want the same addAction to activate this;
 

[hint "The Elevator Controls don't seemn to have any power"]

I'm still working to try to wrap my ADHD brain around the code syntax for all of this but would greatly appreciate anyone's help on this.

Edit:
got the syntax sorted out now and definitely going to be reading up more on SQF syntax now as this seems like an incredibly newb question.

ended up going with this;
 

this addAction[ "Try Elevator Controls", { 
 [ "EscapeCargo", "FAILED", true ] call BIS_fnc_taskSetState; 
 hint "The Elevator Controls don't seemn to have any power"; 
 sleep 15;
 hintSilent "";
}];

Many thanks!

Edited by RudyRedTop
resolution

Share this post


Link to post
Share on other sites
this addAction[ "Try Elevator Controls", {
	[ "EscapeCargo", "FAILED", true ] call BIS_fnc_taskSetState;
	hint "The Elevator Controls don't seemn to have any power";
}];

 

Share this post


Link to post
Share on other sites
7 hours ago, Larrow said:

this addAction[ "Try Elevator Controls", {
	[ "EscapeCargo", "FAILED", true ] call BIS_fnc_taskSetState;
	hint "The Elevator Controls don't seemn to have any power";
}];

 

That did the trick! I didn't realize you could add a second command within the { } brackets simply separated with ;

 

Much appreciated!
 

On a side note, do you have any good resources or cheat sheets for SQF syntax? My google-fu isn't coming up with much.

Share this post


Link to post
Share on other sites

See links in my signature.

 

Curly brackets simply designate code, so you can fill 'er up. Expanding your code vertically and following a standard indentation protocol, as @Larrow has done, helps to visualize this and other structures.

Share this post


Link to post
Share on other sites
1 minute ago, Harzach said:

See links in my signature.

 

Curly brackets simply designate code, so you can fill 'er up. Expanding your code vertically and following a standard indentation protocol, as @Larrow has done, helps to visualize this and other structures.

I'm amazed that the SQF syntax page didn't come up when I googled "SQF Syntax". But many thanks!!!

Share this post


Link to post
Share on other sites

It's the first hit for me, but that may be due to my search history!

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

×