Rounding off a float to pass it to an Integer

Post » Fri May 04, 2012 8:13 am

Hi

I have a float that is used in a formula that outputs a variable that is either 1, 2 or 4. Once I have this value, I pass it into another variable which is an Integer. I want to use this integer variable later in a Message - and here's the problem. The script won't accept it - it seems to think that integer variable isn't an integer, and warns me that messages need integers! It seems that somehow GECK has converted the integer into a float.

Does anyone know how can I convert a float into a proper integer?

Thanks
Jason
User avatar
TRIsha FEnnesse
 
Posts: 3369
Joined: Sun Feb 04, 2007 5:59 am

Post » Thu May 03, 2012 9:23 pm

I haven't encountered this problem , but it sounds like the format you have specified for the variable within the message is incompatible in some way.

I created a little script that did just what you have described:

SCN Testcript01float aint bBegin GameMode  set a to 1.23456  set b to a  showmessage AResSweetSuitcaseMSG02 bEND

The message is one I had lying around that displays an integer. It says "Enter combination digit %.0f".

The script compiled successfully.

Check to ensure that the format characters (the "%.0f" in my example) in your message are compatible with the variable you are displaying. A list of the available formatting options is given here: http://geck.gamesas.com/index.php/ShowMessage
User avatar
aisha jamil
 
Posts: 3436
Joined: Sun Jul 02, 2006 11:54 am

Post » Thu May 03, 2012 11:13 pm

Thanks! At least I know this works then.
User avatar
lillian luna
 
Posts: 3432
Joined: Thu Aug 31, 2006 9:43 pm


Return to Fallout 3