OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gadolinite on 20 Jun 2003, 05:16:58
-
how do you display the contents of a variable on the screen in hint text?
-
Hi Ben ;D
If the variable has a small number of possible values, you could have it display a different hint for each one
example:
?(a == 3):hint "blah blah is 3"
?(a == 2):hint "blah blah is 2"
?(a == 1):hint "blah blah is 1"
hope that helps
-
i cant remember exactly what it is, it something like this tho:
titletext [FORMAT["Variable 1 is %1",_var1],"plaindown"]
or something like that, i know u can put it in a hint box, but im not sure how.
I have never debuged anything in my life, its kinda strange, really
::)
-
Use the FORMAT function like HAMMY says. It is very powerful.
_a=4
_b=12
hint format ["I have %1 fingers and %2 toes!!",_a,_b]
will produce "I have 4 fingers and 12 toes!!"
Use %1 for the first variable, %2 for the second and so on..
-
what if im trying this:
_randomnumber = _this select 0
_randomnumber = random 6
hint format ["random number is 1%",_randomnumber]
it keeps showing me "random number is 1", but it never generates (or at least reports) any random numbers
-
1%
Reverse these to make %1.
:)
-
sorry, i wrote that wrong in the post. i have been using %1. its seems to be the _randnum = random 6 not working, because i use the %1 in the hint format all the time for generating x,y,z coordinates (via a trigger and whatnot), and the syntax:
hint format ["%1",_whatever] has been working for me in the past. im not sure what is happening here
-
what if im trying this:
_randomnumber = _this select 0
_randomnumber = random 6
hint format ["random number is 1%",_randomnumber]
One question: why do you: _randomnumber = _this select 0
What is _this select 0?
If you say: _randomnumber = random 6, then you assign
any value between 0.000000 to 4.999999 to _randomnumber.
So why do you predefine it with _this select 0
Try leaving this line out.
As i don't know, what you have passed during your
exec statement to the script i can only asume that the error
goes there.
~S~ CD
-
any value between 0.000000 to 4.999999 to _randomnumber.
nah ;D
any value between 0.000000 to 5.999999 to _randomnumber.
LCD OUT
-
ya, the line is unnecessary ive noticed, but it was a typing error i found that was getting me (doh!)
my fault, it is fixed, thx for help (i cant close post tho, it wasnt mine originally)
-
any value between 0.000000 to 4.999999 to _randomnumber.
nah
any value between 0.000000 to 5.999999 to _randomnumber.
LCD OUT
:-[ DOH - we're talking about 6 not 5 :o
cheers 4 da correction - bin alrdy in da next thread wif ma head
;D
~S~ CD
-
rofl ;D
its kool u helpin ppl ;D
no need 2 tank me (but im only sain dat cuz u did tank me ::) ;))
LCD OUT
-
just like C++ formating, makes perfect sense
-
solve da topic :D
LCD OUT