Convert decimals to integers

From EQ2Interface Wiki

Jump to: navigation, search

Since GU51 you can use the following UIScript functions to convert decimals to integers:

  • int(NUMBER) - Returns only the integer value of NUMBER.
  • abs(NUMBER) - Returns the absolute value of NUMBER.
  • ceil(NUMBER) - Returns the next highest integer value.
  • floor(NUMBER) - Returns the next lowest integer value.

Also the results of math operations in UIScript now only return the required precision instead of always forcing 3 decimal places.

Before GU51 we used to get around the issue by exploiting the fact that Size or Location would accept decimal values whereas Width, Height, Left, Top would return Integer values, so we could do something like this:

Parent.Parent.Parent.Parent.Select.MinimumScrollExtent=('146' ## ',' ## SUM) SUM=(Parent.Parent.SETTINGS.SizeCollection) + (Parent.Parent.SETTINGS.SizeTotal)
Parent.Parent.HQ.Location=('0' ## ',' ## ADD) ADD=(Parent.Parent.Collection.Top) + (Parent.Parent.Collection.Height)
Personal tools