Reforged 2.0 Bug: Real variables are no longer displayed in text messages or multiboard?!

Level 7
Joined
Jun 1, 2009
Messages
125
Greetings everyone!
After recent patch 2.0 came out, the text messages and multiboard strings no longer display a real variable. Formatted real aint working too.
Any idea how to fix that?
My best thought is to split a real number into 2 integers and dot between them, but I hope there is some new elegant feature I don't know yet.

here some example:

  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 1 columns and 1 rows, titled TEST.
      • Multiboard - Show (Last created multiboard)
      • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Show icons
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 1 to UI\Feedback\Resources\ResourceGold.blp
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to 0
      • Multiboard - Maximize (Last created multiboard)
      • Set VariableSet MB = (Last created multiboard)
This one is broken (real variable)

  • Untitled Trigger 002
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet R = (R + 0.12)
      • Set VariableSet S = (String(R))
      • Game - Display to (All players) the text: (Real = + S)
      • Multiboard - Set the text for MB item in column 1, row 1 to S
This one works fine (integer)

  • Untitled Trigger 002
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet R = (R + 0.12)
      • Set VariableSet S = (String((Integer(R))))
      • Game - Display to (All players) the text: (Real = + S)
      • Multiboard - Set the text for MB item in column 1, row 1 to S
:eekani:
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
Have you tried increasing the width of the cell? Perhaps it doesn't display if there's not enough room

  • Multiboard - Set the width for (Last created multiboard) item in column 1, row 1 to 6.00% of the total screen width
 
R2S and R2SW are broken as currently.

Here's a snippet you can use you really need it to work as a temporary fix

JASS:
/* Removed in favor of fixed version below */

As far as I know R2S(x) does something similar to R2SW(x, 0, 3)

You could implement R2SW3 yourself if needed by looking how both are implemented.

Edit: Missing some rounding with negatives fixed version for negative as follow:

JASS:
    // Same as R2SW(value, 1, 1)
    private function R2SW1 takes real value returns string
        local string output = ""
        local integer on_off = ModuloInteger(R2I(RAbsBJ(value / 0.1)), 10)
        return I2S(R2I(value)) + "." + I2S(on_off)
    endfunction

    // Same as R2SW(value, 2, 2)
    private function R2SW2 takes real value returns string
        local string output = ""
        local integer two_off = ModuloInteger(R2I(RAbsBJ(value / 0.01)), 10)
        local integer on_off = ModuloInteger(R2I(RAbsBJ(value / 0.1)), 10)
        return I2S(R2I(value)) + "." + I2S(on_off) + I2S(two_off)
    endfunction
 
Last edited:
Level 7
Joined
Jun 1, 2009
Messages
125
Yup, I think my GUI solution is quite the same:

  • Untitled Trigger 002
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet R = (R + 0.12)
      • Set VariableSet i = (Integer(R))
      • Set VariableSet R_Dec = ((R - (Real(i))) x 10.00)
      • Set VariableSet i_Dec = (Integer(R_Dec))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i_Dec Greater than 0
        • Then - Actions
          • Set VariableSet S = (((String(i)) + .) + (String(i_Dec)))
        • Else - Actions
          • Set VariableSet S = (String(i))
      • Game - Display to (All players) the text: (Real = + S)
      • Multiboard - Set the text for MB item in column 1, row 1 to S
Ofc. jass looks more efficient, so I try to screw it into my GUI.
+rep!

Upd: I've found a modulo function in the GUI as well, so my fix is:

  • Untitled Trigger 002
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet R = (R + 0.12)
      • Set VariableSet i = (Integer(R))
      • Set VariableSet i_Dec = ((Integer((R / 0.10))) mod 10)
      • Set VariableSet S = (((String(i)) + ,) + (String(i_Dec)))
      • Game - Display to (All players) the text: (Real = + S)
      • Multiboard - Set the text for MB item in column 1, row 1 to S
 
Last edited:
Top