OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gadolinite on 20 Jun 2003, 05:16:58

Title: displaying variable contents in hint
Post by: gadolinite on 20 Jun 2003, 05:16:58
how do you display the contents of a variable on the screen in hint text?
Title: Re:displaying variable contents in hint
Post by: _Ross_ on 20 Jun 2003, 05:24:43
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
Title: Re:displaying variable contents in hint
Post by: _hammy_ on 20 Jun 2003, 05:33:22
i cant remember exactly what it is, it something like this tho:

Code: [Select]
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
 ::)
Title: Re:displaying variable contents in hint
Post by: deaddog on 20 Jun 2003, 06:22:41
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..
Title: Re:displaying variable contents in hint
Post by: borrowed soap on 20 Jun 2003, 12:38:54
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
Title: Re:displaying variable contents in hint
Post by: deaddog on 20 Jun 2003, 14:19:59
Quote
1%

Reverse these to make %1.


 :)
Title: Re:displaying variable contents in hint
Post by: borrowed soap on 20 Jun 2003, 17:35:57
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
Title: Re:displaying variable contents in hint
Post by: Chris Death on 20 Jun 2003, 18:16:51
Quote
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
Title: Re:displaying variable contents in hint
Post by: LCD on 20 Jun 2003, 18:28:46
Quote
any value between 0.000000 to 4.999999 to _randomnumber.

nah ;D

any value between 0.000000 to 5.999999 to _randomnumber.

LCD OUT
Title: Re:displaying variable contents in hint
Post by: borrowed soap on 20 Jun 2003, 18:49:49
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)
Title: Re:displaying variable contents in hint
Post by: Chris Death on 20 Jun 2003, 18:51:33
Quote
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
Title: Re:displaying variable contents in hint
Post by: LCD on 20 Jun 2003, 18:55:40
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
Title: Re:displaying variable contents in hint
Post by: gadolinite on 20 Jun 2003, 20:31:16
just like C++ formating, makes perfect sense
Title: Re:displaying variable contents in hint
Post by: LCD on 20 Jun 2003, 21:55:06
solve da topic :D

LCD OUT