Open main menu

UESPWiki β

Morrowind Mod:XLongToFloats

< Mod / Morrowind: Morrowind Mod: MWSE

A function from MWSE update by Merzasphor.

This function stores a long value using a pair of floats. It is intended to work around the issue that all globals are really floats. They work by splitting the long 32 bit value into two 16 bit values and adding a flag to indicate which value maps to the high 16 bits. Argument order doesn't matter. MWEdit doesn't like to compile these functions with globals as arguments, so you'll need to use temporary locals.

SyntaxEdit

val1 (float) val2 (float): xLongToFloats val (long)

ExampleEdit

long lVal1
long lVal2
float fVal1
float fVal2

set lVal1 to 2147483647
setx fVal1 fVal2 to xLongToFloats lVal1
setx lVal2 to xFloatsToLong fVal1 fVal2

if ( lVal1 == lVal2 )
        MessageBox "Success!"
else
        MessageBox "Failure!"
endif

See AlsoEdit