News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

float to integer

Started by sgn15, September 16, 2012, 05:49:17 PM

Previous topic - Next topic

sgn15

so by using a process (which i cannot avoid), i have a float value in variable. i will use it for stuff that uses integer values, yeah i know the debug message and all that.

i used multiple fvars in this method and i will use the values in several supposedly integer values

so i am asking, what can i possibly do to "convert" float into integer? like truncating the fractional part of numbers and only getting the whole number part.

Zzyzzyxx

I believe these are the triggers you're looking for. From Mugen docs:

Quote
Ceil (math)

Implements the "ceiling" function. Returns the least integer which is greater than or equal to the specified argument.

Format:
    ceil(exprn)
Arguments:

    exprn
        Expression to compute the ceil of.

Return type:
    int
Error conditions:
    Returns bottom if exprn evaluates to bottom.

Example:

1. value = ceil(5.5)
  Sets value to 6.
2. value = ceil(-2)
  Sets value to -2.

Quote
Floor (math)

Implements the floor function. Returns the greatest integer less than or equal to its argument.

Format:
    floor(exprn)
Arguments:

    exprn
        Expression to compute the floor of.

Return type:
    int
Error conditions:
    Returns bottom if exprn evaluates to bottom.

Examples:

1. value=floor(5.5)
  Sets value to 5.
2. value=floor(-2)
  Sets value to -2.

sgn15

oh god, i forgot about those even if i have read the docs countless times. I have never used those math triggers. guess it's about damn time.

thanks