| 07-29-2008, 12:03 AM | #1 |
So I have my multiboard and it scales in size depending on how many units are in a group. But randomly it just wont show rows... I have no idea why it's doing this, maybe someone can spot what I can't. JASS:function UpdateAggroMultiboard takes player P, unit u returns nothing local integer c = 1 local integer r = 1 local integer i = GetUnitUserData(u) local integer p = GetConvertedPlayerId(P) local integer rows = CountUnitsInGroup(PlayerFighter[i].AI_AllAggroUnits) local unit array units local unit tempunit = null local group tempgroup = CreateGroup() local integer l = 4 call GroupAddGroup(PlayerFighter[i].AI_AllAggroUnits,tempgroup) loop set tempunit = FirstOfGroup(tempgroup) //NEED TO MAKE THIS SORT BY ORDER!!! exitwhen tempunit == null set units[l] = tempunit call GroupRemoveUnit(tempgroup,tempunit) set l=l+1 endloop call MultiboardSetRowCount(MultiBoardAggro[p],3+rows) loop exitwhen c > 2 loop exitwhen r > 3+rows if (r ==1 and c == 2) then call MultiboardSetItemValueBJ(MultiBoardAggro[p],c,r, PlayerColor[GetConvertedPlayerId(GetOwningPlayer(u))] + GetUnitName(u) + "|r") endif if (r ==2 and c == 1) then call MultiboardSetItemWidthBJ(MultiBoardAggro[p],c,r,20) if PlayerFighter[i].AI_TargetedUnit != null then call MultiboardSetItemValueBJ(MultiBoardAggro[p],c,r, PlayerColor[GetConvertedPlayerId(GetOwningPlayer(u))] + GetUnitName(u) + "|r is targeting " + PlayerColor[GetConvertedPlayerId(GetOwningPlayer(PlayerFighter[i].AI_TargetedUnit))] + GetUnitName(PlayerFighter[i].AI_TargetedUnit) + "|r." ) else call MultiboardSetItemValueBJ(MultiBoardAggro[p],c,r,PlayerColor[GetConvertedPlayerId(GetOwningPlayer(u))] + GetUnitName(u) + "|r has no target.") endif endif //This is the problematic area, sometimes it won't show the text in this area on random rows======= if (r > 3 and c == 1) then call MultiboardSetItemWidthBJ(MultiBoardAggro[p],c,r,30) call MultiboardSetItemStyleBJ(MultiBoardAggro[p],c,r,true,true) call MultiboardSetItemIconBJ(MultiBoardAggro[p],c,r, "ReplaceableTextures\\WorldEditUI\\Editor-Ally-NoPriority.blp" ) call MultiboardSetItemValueBJ(MultiBoardAggro[p],c,r, PlayerColor[GetConvertedPlayerId(GetOwningPlayer(units[r]))] + GetUnitName(units[r]) + "|r " + Gold + " - " + I2S(PlayerFighter[i].AI_UnitAggro[GetUnitUserData(units[r])]) + "|r") call BJDebugMsg("Row " + I2S(r) + " is " + GetUnitName(units[r])) endif //=========================================================================== set r=r+1 endloop set c = c+1 set r = 1 endloop endfunction The Debug message comes out fine, saying the correct row and correct unit, but the board wont show it. |
| 07-29-2008, 02:29 AM | #2 |
There is a bug with the set row and column functions. Fix, destroy and recreate your multiboard. http://www.wc3campaigns.net/showpost...4&postcount=30 |
| 07-29-2008, 03:50 AM | #3 |
Well that's fucking lame, thanks for the heads up! |
| 07-29-2008, 08:26 AM | #4 | |
Quote:
so do like i do... precache some amount of MBs and use them separate. // you can look at TRSII how i made it. btw it does need 1 frame to update... to clean the mb. |
| 07-29-2008, 11:17 PM | #6 | |
Quote:
=O Good idea! (+1 as you would say) I'm going to be working with multiboards soon, so if I create enough to cover all the different sizes I will be using, then I wont have a problem. Edit: after doing some tests, the memory increase from multiboards look minimal. Ran this script for 30 seconds (3000 multiboards) after jogging it (making sure everything was loaded in properly) and received only 92K of extra memory usage (from 88,284 to 88,376) JASS:library Test initializer init globals private timer TIMER private trigger TRIGGER private boolean BOOLEAN = true endglobals private function H2I takes handle h returns integer return h return 0 endfunction private function MBtest takes nothing returns nothing local multiboard m = CreateMultiboard() local multiboarditem mb call BJDebugMsg(I2S(H2I(m))) call MultiboardSetColumnCount(m, 2) call MultiboardSetRowCount(m, 2) set mb = MultiboardGetItem(m, 0, 0) call MultiboardSetItemValue(mb, "test") call MultiboardDisplay(m, true) call MultiboardReleaseItem(mb) call DestroyMultiboard(m) set mb = null set m = null endfunction private function onPress takes nothing returns nothing if BOOLEAN then call PauseTimer(TIMER) call DestroyTimer(TIMER) set TIMER = null call BJDebugMsg("Stop") set BOOLEAN = false else set TIMER = CreateTimer() call TimerStart(TIMER, 0.01, true, function MBtest) set BOOLEAN = true endif endfunction function init takes nothing returns nothing set TIMER = CreateTimer() set TRIGGER = CreateTrigger() call TriggerRegisterPlayerEvent(TRIGGER, Player(0), EVENT_PLAYER_END_CINEMATIC) call TriggerAddAction(TRIGGER, function onPress) call TimerStart(TIMER, 0.01, true, function MBtest) endfunction endlibrary Personally, it doesn't feel necessary to pre-cache multiboards for such a small leak when there are bigger fish to fry in maps. If first started with the creation destruction, then with the columns and rows, then with the multiboarditem, then onto the value and even to showing it; nothing increased memory. Ran it for about 5 minutes and no noticeable side-effects. |
| 07-30-2008, 08:21 AM | #7 |
btw the releaseitem story is full crap i don't why this native does exist... after you set the row/col count it does intialize the matrix and thats it. for some odd reason it doesnt clean properly... // like units, effects. afaik |
