OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Surdus Priest on 24 Oct 2007, 17:14:37
-
say you have: []exec "blah.sqs"
and in the script i says: _argh = _this select 0
since there is no value to define _argh, not even 0, my question is
what is the condition for when there is nothing in the parameters to define _argh.
basically what does an undefined variable equal? and how would you represent it?
-
_argh = _this select 0
?isnull _argh : _noparams = true
That might do it?
An undefined variable is null I believe.
-
isnull... lol, why didnt i see that one :D
-
isNil
-
Baddo is correct, isNil refers to variables, isNull refers to objects, groups, displays and controls.
Planck
-
if (count _this > 0) then
{
_argh = _this select 0;
}
else
{
_argh = your desired default value;
};
-
thanks, however it seems that it causes the second parameter o become null. it was only incase the editor didnt use parameters anyway.
i have another questions however;
my script includes an optional feature where numbers being updated constantly in the hint.
i cant figure out how to set the number of decimal points that appear next to the number.
for example, rather than 34.5004242
i want 34.50
surdus
edit: i also need to know how to modify an added action. because its no good if the action ID goes up every
time the same action is deleted and replaced. especially if the mission involves many other important actions that
shouldnt be deleted.
-
_value = _value - (_value % 0.01)
-
is there a way of doing that inside the hint format, because i dont want the value to change, i only want it to "appear" as 2 decimal points on the hint.
for example
_value = 34.5004242;
hint format ["Answer - %1",_value]
then the decimal change would make the hint say:
Answer - 34.50
i can think of a way to do it the way you said, but that would mean modifying a lot of variables then changing them back.
is there an easier way?
-
What about to copy the value into another variable and edit this, something like:
_showvalue = _value - (_value % 0.01)
hint format ["Answer - %1",_showvalue]
This way the original _value wouldn't be touched.
Myke out
-
that looks good, thanks :D
edit:
is there a way of doing that, but without changing the value?
because that makes teh value appear 0.01 less than what it actually is, so how to i change it to the
real value, but still keep it at 2 decimal points?