Jump to content
Sign in to follow this  
hridaysabz

Help with variables

Recommended Posts

Hey all, I was trying to work out the variables for a little script i'm writing.

So two questions, how do I apply %1, and how do I use veh_name?

I also would like to find somewhere that has variables like these documented.

Thanks.

Share this post


Link to post
Share on other sites

%1 is used for formatting a string; it is a placeholder that gets replaced by the value of a variable. The is used in the format command.

For example

_var1 = 2;
_var2 = 5;
_string = format ["Var1 is equal to %1 and var 2 is equal to %2", _var1, _var2];

%1 is a placeholder that get replaced with the value of the first parameter following the format string. %2 gets replaced with the second parameter after the format string. The resulting variable _string will look like "Var1 is equal to 2 and var 2 is equal to 5".

As far as veh_name, that just looks like an ordinary variable, presumably storing the name of a vehicle. Where did you come across this variable?

Share this post


Link to post
Share on other sites

Oh thanks, I was looking for a variable that would replace the %1 with the name of the vehicle. For example, I have a vehicle named hazler and a vehicle named typhoon. I want it to be so that when one dies in a notification it shows, "hazler is dead!" or "typhoon is dead!" but is there is a quick way of doing so?

Share this post


Link to post
Share on other sites

To keep it simple, make a trigger with the

condition: !alive hazler

activation : hint format["%1 is dead",hazler];

Make another one and replace hazler with typhoon.

Edited by Johnson11B2P
Thanks semiconductor forgot the most important thing.

Share this post


Link to post
Share on other sites
condition: alive hazler

activation : hint format["%1 is dead",hazler];

I think there shoud be "!alive" instead of "alive" in condition to make trigger fire when vehicle isn't alive. :) Edited by Semiconductor

Share this post


Link to post
Share on other sites

Alright, thanks guys.

---------- Post added at 15:00 ---------- Previous post was at 14:59 ----------

To keep it simple, make a trigger with the

condition: !alive hazler

activation : hint format["%1 is dead",hazler];

Make another one and replace hazler with typhoon.

That would completely defeat the purpose of writing %1.

Share this post


Link to post
Share on other sites
vehicleVarName is the command you were looking for Hridaysabz.

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  

×