Jump to content
Sign in to follow this  
unidad2pete

variable title addActions

Recommended Posts

How I add the player's name, to the title of the action the player creates?

_myname = name player; // get name of player

_amo = createVehicle ["B_supplyCrate_F", position player, [], 0, "None"]; // creates an amo box called " amo "

_addaction = amo addAction ["REARM!","scripts\rearm.sqf"]; // add action to amo, with title REARM!! calling rearm.sqf

I want change REARM to _myname, ( name of player )

I tried with;

_addaction = amo addAction ["_myname","scripts\rearm.sqf"];

and

_addaction = amo addAction [""_myname"","scripts\rearm.sqf"];

this not working, Im not a profesional scripter.

How I do?

Share this post


Link to post
Share on other sites
How I add the player's name, to the title of the action the player creates?

_myname = name player; // get name of player

_amo = createVehicle ["B_supplyCrate_F", position player, [], 0, "None"]; // creates an amo box called " amo "

_addaction = amo addAction ["REARM!","scripts\rearm.sqf"]; // add action to amo, with title REARM!! calling rearm.sqf

I want change REARM to _myname, ( name of player )

I tried with;

_addaction = amo addAction ["_myname","scripts\rearm.sqf"];

and

_addaction = amo addAction [""_myname"","scripts\rearm.sqf"];

this not working, Im not a profesional scripter.

How I do?

_addaction = amo addAction [_myname,"scripts\rearm.sqf"];

no quotes... its variable... with the quotes its string...

Share this post


Link to post
Share on other sites

OHH!! thanks for your quick response. Works fine!!

And if I want to add text in front of the name?

_addaction = amo addAction ["box of "_myname,"scripts\rearm.sqf"]

this not works

Im genius!! xD i solved

_myname = name player;

_mynamebox = " box of" _myname;

_addaction = amo addAction [_mynamebox,"scripts\rearm.sqf"]

THANK YOU !!

Edited by unidad2pete

Share this post


Link to post
Share on other sites

some basics....

hi

Properly defined private variable:

private "_myPrivateVariableName";

_myPrivateVariableName = something;

Properly defined global variable:

TAG_myPrivateVariableName = something;

Diference:

script1.sqf

private "_myPrivateVariableName";

_myPrivateVariableName = something;

TAG_myGlobalVariableName = something;

execVM "script2.sqf";

script2.sqf

private "_anotherPrivateVariableName";

[color="#FF0000"]_anotherPrivateVariableName = _myPrivateVariableName;[/color] // error, _myPrivateVariableName was private variable of script1
[color="#008000"]_anotherPrivateVariableName = TAG_myGlobalVariableName;[/color] // works, because TAG_myGlobalVariableName is global variable

[color="#FF0000"]TAG_anotherGlobalVariableName = _myPrivateVariableName;[/color] // error, _myPrivateVariableName was private variable of script1
[color="#008000"]TAG_anotherGlobalVariableName = TAG_myGlobalVariableName;[/color] // works, because TAG_myGlobalVariableName is global variable

add 1

variable = variable + 1; 

string + string

string = "something";
add = " something else";

string = string + add;

string + number

string = "something";

string2 = string + str 1;

if without additional brackets

if (myVar1 > 0 && myVar2 >2) then

myVar3 = true;

if myVar3 then

Share this post


Link to post
Share on other sites

Im genius!! xD i solved

That made me laugh buddy, well done for working stuff out btw :)

Share this post


Link to post
Share on other sites

I can't seem to get mine to work...

private "_vehCost";
_vehCost = _this select 2;
hint format ["_vehCost: %1",_vehCost]; // RESULT _vehCost: 100
_addaction = _tank addAction [_vehCost, "DisplayRepair.sqf", [_vehCost], 5, true, true, "", "player distance _target < 5 && !(player in _target)"];   

...but yet the addAction does not even appear for the _tank???

SO, then why does it only work with a global variable tank

Edited by BEAKSBY
only work for global variable tank

Share this post


Link to post
Share on other sites

where do you define _tank?

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  

×