Morrowind Mod:XFloatsToLong

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

A function from MWSE update by Merzasphor.

This function retrieves 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.

Syntax[edit]

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

Example[edit]

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 Also[edit]

XLongToFloats