OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MONOLITH on 08 Oct 2003, 19:17:42

Title: Displaying variables in strings
Post by: MONOLITH on 08 Oct 2003, 19:17:42
Just a quick question.

Does anyone know how to display a variable in a string e.g hint box. For example i want to display the score of a side in a hint box.

I know in visual basic you do it like this msgbox "blah" & variable name

Anyone know how to do it in flashpoint?

Thanks.
Title: Re:Displaying variables in strings
Post by: dmakatra on 08 Oct 2003, 19:23:21
hint format ["%1", variable]

Something like that.

:beat: *Gets Shot* :beat:
Title: Re:Displaying variables in strings
Post by: KTottE on 08 Oct 2003, 19:41:49
Yes.

hint format["Health: %1",getDammage player]

For instance.
Title: Re:Displaying variables in strings
Post by: LCD on 08 Oct 2003, 21:22:39
@ KTotte nd armsy - next taam leave dis Qs 2 me- itll help me boost ma post count :P i lead only in 2 above macca  :-X  :o ::)

@ Mono

or in titletext u can use

titeltext [format["Health: %1",getDammage player],"plain down"] ;D

LCD OUT
Title: Re:Displaying variables in strings
Post by: Chris Death on 08 Oct 2003, 21:59:11
k - gonna have to top that then  ;D

hint format ["%1\n2", var1,var2]

would even let you display 2 variables

%1 is the placeholder for the first variable after the output-string, %2 for the second one.

You can also go on, using such placeholders - e.g: %1 %2 %3
and so on.

hint format ["%1 %2 %1", var1, var2]

would also be possible and result in:

var1 var2 var1

~S~ CD
Title: Re:Displaying variables in strings
Post by: LCD on 08 Oct 2003, 22:04:49
k - gonna have to top that then  ;D

hint format ["%1\n2", var1,var2]

lol ;D

just 1 thing

u forgot 2 put da % dere :P ::)

it shud b

hint format ["%1\n%2", var1,var2]

LCD OUT

P.S deres no way ny of u wil pass ma post count its 2400 n somin now :P
Title: Re:Displaying variables in strings
Post by: Chris Death on 08 Oct 2003, 22:52:43
 :o indeeeeeeeeed  :-[

just thought i should keep you an open backdoor
to be able, top'in dat  ;D

~S~ CD
Title: Re:Displaying variables in strings
Post by: dmakatra on 09 Oct 2003, 07:57:24
I'm going to top that, but I need to lay low for a while... KTottE almost gave me a warning. :'(

:beat: *Gets Warned* :beat: