Check if a number has no decimals?

Dito

New Member
Reaction score
0
Hello, is there a easy way to check if a number has no decimals? Like in this example:

Trigger:
  • Or - Any (Conditions) are true
    • Conditions
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 1.00
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 2.00
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 3.00
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 4.00
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 5.00
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 6.00
      • WildGrowth_Tick[WildGrowth_Loop] Equal to 7.00


The variable will never exceed 7, I would like a one liner to check this, is it possible? (all it has to check is if the variable doesn't have a decimal)
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
if WildGrowth_Tick[WildGrowth_Loop] Equal to (integer(WildGrowth_Tick[WildGrowth_Loop]))
should work.

integers are whole numbers, if you convert a real to an integer all it decimals will be removed. 7.13 would become 7, same goes for 7.98.
 

Dito

New Member
Reaction score
0
7.90 would get rounded up to 8? If that is so, then I cannot use this. And if not, then how would I use it to make it all into one line?
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
7.90 would get rounded up to 8? If that is so, then I cannot use this. And if not, then how would I use it to make it all into one line?

no, everything behind the floating point is completely removed. there is nothing rounded up nor down. 7.90 is 7 as an integer.

just check if MyVar == Integer(MyVar)
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top