x


A :float on GUI

I am trying to display the :float variable on my GUI, but the debugging message keeps telling me, that it can not convert the float to string. Is there a way to display the :float variable on the GUI? There's a lot of tutorials for the menu part of the GUI, but I can't find one for the interface itself...

more ▼

asked Jun 28 '12 at 04:51 AM

Makiavel gravatar image

Makiavel
13 5 7 10

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Every type in CIL has a ToString function. What it does depends on the type. Some just return the classname, but most valuetypes return their value as string. You can even specify a format string for int or float values.

var myValue : float;

myValue.ToString("000.0");  //3 leading zeros and one fractional-digit

The compiler also tries to convert floats or ints automatically if it's used in a string concat like this:

var myString = "" + myValue;

this is the same as

var myString = myValue.ToString();
more ▼

answered Jun 28 '12 at 04:56 AM

Bunny83 gravatar image

Bunny83
45.2k 11 49 207

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3684
x181

asked: Jun 28 '12 at 04:51 AM

Seen: 424 times

Last Updated: Jun 28 '12 at 04:56 AM