| 08-20-2006, 12:37 AM | #1 |
After completing my hardcoded AI, I get these real strange problems in my multiboard, as already mentioned here before: especially when the AI completes buildings, all the values in the 3rd colomn of the multiboard would turn to 0. Sometimes even the first row; (http://www.wc3campaigns.net/showthre...ght=multiboard ) I would usually refresh only a certain value in the multiboard, like 'udg_kills', whenever a unit has been killed, or 'udg_zones[PlayerId]' whenever a player finishes or sells a structure. Now I thought, if I can't avoid this problem, which might be due to some internal bugs rather in warcraft than in my code (why else would this problem come into existence after adding the AI, when there are no common variables interconnected with the multiboard whatsoever), I'd try to alleviate it. So now I'm constantly looping a few lines as a separate thread to refresh the boards every 0.75 seconds. Here's the script. What do you think of it? Is it a good idea to have yet more infinite loops in a game? JASS:function BoardRefresh takes nothing returns nothing local multiboard mb = bj_lastCreatedMultiboard local leaderboard lb = bj_lastCreatedLeaderboard local integer j loop set j=1 call MultiboardSetItemValueBJ(mb, 1, 1, "|cffffcc00Warlord|r" ) call MultiboardSetItemValueBJ(mb, 2, 1, "|cffffcc00Units|r" ) call MultiboardSetItemValueBJ(mb, 3, 1, "|cffffcc00Zones|r" ) loop exitwhen j>8 if IsPlayerInForce(Player(j-1), udg_Players) == true then if udg_zonesplayer[j]<= 0 and udg_unitsplayer[j]<= 0 then call MultiboardSetItemValueBJ(mb, 3, udg_Multiboard_Spots[j], "") call MultiboardSetItemValueBJ(mb, 2, udg_Multiboard_Spots[j], "|cffde0000Defeated|r" ) else call MultiboardSetItemValueBJ(mb, 2, udg_Multiboard_Spots[j], I2S(udg_unitsplayer[j]) ) call MultiboardSetItemValueBJ(mb, 3, udg_Multiboard_Spots[j], UpkeepColor(udg_zonesplayer[j])+I2S(udg_zonesplayer[j])+"|r" ) endif endif set j=j+1 endloop call LeaderboardSetPlayerItemValueBJ( Player(bj_PLAYER_NEUTRAL_EXTRA),lb, R2I(udg_Kills) ) call LeaderboardSetPlayerItemValueBJ( Player(PLAYER_NEUTRAL_AGGRESSIVE), lb, udg_zonestotal ) call TriggerSleepAction(0.75) endloop set mb=null set lb=null endfunction |
| 08-20-2006, 01:01 AM | #2 |
I'm not 100% sure, but you don't need this or? JASS:set mb=null set lb=null |
| 08-20-2006, 01:39 AM | #3 |
that's true. what about the essential question? |
| 08-20-2006, 01:52 AM | #4 |
Well, does it work? |
| 08-20-2006, 02:28 AM | #5 | |
Quote:
JASS:call MultiboardSetItemValueBJ(mb, 3, udg_Multiboard_Spots[j], UpkeepColor(udg_zonesplayer[j])+I2S(udg_zonesplayer[j])+"|r" ) |
| 08-20-2006, 09:08 PM | #6 |
constantly refreshing the board values works nicely. yet every now and then the problem turns up again. not really noticeably, as the next second the zeroes are gone and the board back to normal; but it's still weird, and bothering me in some way. I wouldn't know why the values in the whole colomn would change to zero, even though this is not caused by my script. again: this whole problem turns up: either when using the blizzard cheat codes like "keysersoze", or after implementing my AI. I haven't changed anything of the multiboard functions before. here's the upkeepcolor function; I can't see any flaws in it. JASS:function UpkeepColor takes integer i returns string if i > 7 then return "|cffff0000" elseif i > 3 then return "|cffffff00" elseif i > 1 then return "|cff00ff00" endif return "|cffffffff" endfunction |
| 08-22-2006, 05:04 PM | #7 | |
Quote:
Well, then you have to post your AI script or if you don't bother, then post your map, but I also can't find any possible causes for this problem in the posted triggers... |
| 08-22-2006, 11:09 PM | #8 |
hm, I think that'll blast the frame. the AI part of my code is about 420 lines, the rest another 4100 (including globals). I don't have any functions dealing with the multiboard in my AI script. Neither does it touch the globals. My bet is that it's an WC3 internal problem after all. Now, after making it refresh all the values constantly, it really doesn't bother to see barely a second of zeroes in the multiboard until it refreshes to the correct values. |
