Jump to content
Sign in to follow this  
James Grimm

How to add veriable in to AddAction?

Recommended Posts

What I want to do is add an action that updates for a sign every sec to display how long time is left for the cooldown.

In the while loop, i want the %1 to be _1. 

_tele = _this select 0;
_caller = _this select 1;

_sign = TestSign;

_Cash = score _caller;
_i = 5;
hint format["you have %1 in cash",_Cash];




while {_i>0} do {
removeAllActions _sign;
_sign addAction ["Cooldown %1",""];

sleep 1;

_i = _i-1;
}else {
removeAllActions _sign;
_sign addAction ["Buy scope WIP","PengarFraga.sqf"];
};

 

Share this post


Link to post
Share on other sites

I don't understand where in this command(TestSign addAction ["Cooldown %1",""];) to I put the format [Cooldown %1, _i]; @Schatten

Share this post


Link to post
Share on other sites

I've got closer it needs to be like this I think TestSign addAction format["Cooldown %1",]; but I don't know where to put the variable for _i

 

Share this post


Link to post
Share on other sites

@James Grimm,

#define START_TIME 5

_formatString = "Cooldown %1";

_id = _sign addAction [format [_formatString, START_TIME], ""];

for "_i" from (START_TIME - 1) to 1 step -1 do {
	sleep 1;

	_sign setUserActionText [_id, format [_formatString, _i]];
};

_sign removeAction _id;

_sign addAction ["Buy scope WIP", "PengarFraga.sqf"];

 

Share this post


Link to post
Share on other sites

Thank you it works now. as you can tell I'm new to this. So thank you for your patience. 

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  

×