• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Weird Multiboard bug

Status
Not open for further replies.

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
This is an excerpt from a periodicly executed script that updates a buff status monitor multiboard.
Depending on the number of buffs registered, the size of the multiboard expands (3 static rows plus one row per buff).
All stuff works perfectly. The number of rows of the multiboard changes correctly. Also, all values retrieved are correct all the time (tested with debug messages).

The only issue: When 2 remaining buffs vanish at the same time and the multiboard shrinks back to rowcount 3, when adding a new buff, the rowcount expands back to 4 (like it should), but no values are displayed in row 3! The values of row 4 get displayed correctly. I checked the values for row 3 with debug messages and they are correct ... they just won't get displayed for row 3 for some weird reason.

What is even more strange: If I set the rowcount to a constant value (like 7), the bug is gone. It seems to have something to do with the rowcount thing.

PS: The rowcount expansion works all the time; it's just that there is no values or icons displayed in the "bugged" row.
JASS:
       set j = 0
        set maxeffect = MonitorGetEffectNumber(i)
        call MultiboardSetRowCount(PlayerThreatMeters[i], maxeffect+3)
        loop
            exitwhen j >= maxeffect
            set monitorTime = MultiboardGetItem(PlayerThreatMeters[i], j+3, 1)
            set monitorTarget = MultiboardGetItem(PlayerThreatMeters[i], j+3, 0)
            call MultiboardSetItemStyle(monitorTime, true, false)
            call MultiboardSetItemStyle(monitorTarget, true, true)
            call MultiboardSetItemIcon(monitorTarget, MonitorGetEffectIcon(i, j))
            call MultiboardSetItemWidth(monitorTime, 0.03)
            call MultiboardSetItemWidth(monitorTarget, 0.12)
            set r = MonitorGetEffectTime(i, j)
            if r >= 0.1 then
                call MultiboardSetItemValue(monitorTime, I2S(R2I(r)))
            else
                call MultiboardSetItemValue(monitorTime, "")
            endif
            set u = MonitorGetEffectTarget(i, j)
            if IsUnitType(u, UNIT_TYPE_HERO) then
                set color = ARGB.fromPlayer(GetOwningPlayer(u))
                set s = GetUnitName(u) + "  ["+ color.str(GetPlayerName(GetOwningPlayer(u))) + "]"
            else
                if GetOwningPlayer(u) == Player(PLAYER_NEUTRAL_AGGRESSIVE) then
                    set s = "|cffffdab9" + GetUnitName(u) + " ("+ I2S(GetUnitLevel(u)) + ")|r" 
                elseif GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_PASSIVE) then
                    set color = ARGB.fromPlayer(GetOwningPlayer(u))
                    set s = color.str(GetUnitName(u))
                else
                    set s = GetUnitName(u)
                endif
            endif
            call MultiboardSetItemValue(monitorTarget, s)
            call MultiboardReleaseItem(monitorTarget)
            call MultiboardReleaseItem(monitorTime)
            set monitorTarget = null
            set monitorTime = null
            set j = j + 1
        endloop
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Does minimizing/maximizing help?
Nope. Also, the row remains bugged until the rowcount gets reduced one by one until it reaches 3 again. This script runs every 0.25 seconds, which means even if a value is bugged once, it should almost instantly get overwritten again. But that does not happen for some reason.

This bug only occurs when I shrink the rowcount by 2 in one step. If I reduce the rowcount by just 1, it works fine.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Fixed! Reducing rowcount one by one helped. I can't help but being amazed at how blizzard managed to bug up even the most simple stuff.
JASS:
        set j = 0
        set maxeffect = MonitorGetEffectNumber(i)
        if PlayerLastRowcount[i] > maxeffect then
            set PlayerLastRowcount[i] = PlayerLastRowcount[i] - 1
        else
            set PlayerLastRowcount[i] = maxeffect
        endif
        call MultiboardSetRowCount(PlayerThreatMeters[i], PlayerLastRowcount[i]+3)
 
Status
Not open for further replies.
Top