• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] I don't know multiboards so well

Status
Not open for further replies.
Trying to get this work for one of our forumers. I would appreciate someone's effort to help me help him.

He can save his map with all the triggers that I gave him, but he can't load it. I've tried changing up all the questionable areas from the other triggers, but since I don't know much about multiboards I can't tell if there's a problem/problems with these two triggers:

JASS:
function SetIcon takes integer col, integer row, string s returns nothing
    call MultiboardSetItemIconBJ( bj_lastCreatedMultiboard , c , r , s )
endfunction
function SetStyle takes integer col, integer row returns nothing
    call MultiboardSetItemStyleBJ( bj_lastCreatedMultiboard, col, row, true, false )    
endfunction
function SetColor takes integer col, integer row, real red, real gre, real blu returns nothing
    local multiboarditem mbitem = MultiboardGetItem(bj_lastCreatedMultiboard, col - 1, row - 1)
    call MultiboardSetItemValueColor(mbitem, red, gre, blu, 255)
    call MultiboardReleaseItem(mbitem)
endfunction
function SetValue takes integer col, integer row, string s returns nothing
    local multiboarditem mbitem = MultiboardGetItem(bj_lastCreatedMultiboard, col - 1, row - 1)
    call MultiboardSetItemValue(mbitem, s)
    call MultiboardReleaseItem(mbitem)
endfunction
function MultiboardInit takes nothing returns nothing
    local integer index = 2
    call CreateMultiboardBJ( 3, 15, "Class: - " )
    call MultiboardSetItemWidthBJ( bj_lastCreatedMultiboard, 0, 0, 5.00 ) // Affects all boards
    call MultiboardSetItemWidthBJ( bj_lastCreatedMultiboard, 1, 0, 10.00 ) // Affects column 1
// Set colors
    call SetColor(1, 1,255,204,204)
    call SetColor(1, 9,255,204,204)
    call SetColor(2,10,  0,255,  0)
    call SetColor(3, 1,255,204,204)
// Set styles to show value but hide icon
    call SetStyle(1, 1)
    call SetStyle(1, 9)
    call SetStyle(1,13)
    call SetStyle(2, 0)
    call SetStyle(3, 0)
    call MultiboardSetItemStyleBJ( bj_lastCreatedMultiboard, 3, 11, true, true )
    loop // set values in row 2 to "0"
        if index != 9 and index != 13 then
            call SetValue(2,index,I2S(0))
        endif
        set index = index + 1
        exitwhen index > 15
    endloop
// Materials
    call SetValue(1,1,"|cffFFFF00--[Materials]--|r")
    call SetValue(1,2,"Metal Scrap")
    call SetValue(1,3,"Wood")
    call SetValue(1,4,"Resin")
    call SetValue(1,5,"Wine")
    call SetValue(1,6,"Stone")
    call SetValue(1,7,"Sulfer")
    call SetValue(1,8,"Gunpowder")
    //* Icons *
    call SetIcon(1,2,"war3mapImported\\BTNUpgradedPlateBar.blp")
    call SetIcon(1,3,"ReplaceableTextures\\CommandButtons\\BTNBundleOfLumber.blp")
    call SetIcon(1,4,"ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp")
    call SetIcon(1,5,"ReplaceableTextures\\CommandButtons\\BTNShimmerWeed.blp")
    call SetIcon(1,6,"war3mapImported\\BTNINV_Stone_13.blp")
    call SetIcon(1,7,"ReplaceableTextures\\CommandButtons\\BTNManaFlareOff.blp")
    call SetIcon(1,8,"ReplaceableTextures\\CommandButtons\\BTNBarrel.blp")
// Weapons
    call SetValue(1, 9,"|cffFFFF00--[Weapons]--|r")
    call SetValue(1,10,"Weapon")
    call SetValue(1,11,"Ammo")
    call SetValue(1,12,"Magazine")
    //* Icons *
    call SetIcon(1,10,"ReplaceableTextures\\CommandButtons\\BTNDwarvenLongRifle.blp")
    call SetIcon(1,11,"war3mapImported\\BTNammo.blp")
    call SetIcon(1,12,"war3mapImported\\BTNreload.blp")
// Survival
    call SetValue(1,13,"|cffFFFF00--[Survival]--|r")
    call SetValue(1,14,"Food")
    call SetValue(1,15,"Water")
    //* Icons *
    call SetIcon(1,14,"ReplaceableTextures\\CommandButtons\\BTNAcorn.blp")
    call SetIcon(1,15,"war3mapImported\\BTNWaterOrb.blp")
// Column 3 Items
    call SetValue(3, 1,"Max")
    call SetValue(3,11,"Coming Soon")
    call SetIcon( 3,11,"war3mapImported\\BTNbullet.blp")
    call SetValue(3,13,"|cffFFFF00-[Need]-|r")
endfunction
// Initialize multiboard for all players
function InitTrig_HUD1 takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterTimerEvent( t, 1.00, false )
    call TriggerAddAction( t, function MultiboardInit )
    set t = null
endfunction

JASS:
function DoRefresh takes nothing returns nothing
    local integer i = 0
    local integer id
    loop
    set id = GetPlayerId(Player(i))+1
// Begin local code - no net traffic!  Do not set variables here.  In fact, don't change
// this without talking with me.  This local code was causing your crashes until I fixed it.
    if GetLocalPlayer() == Player(i) then
// Materials
    call SetValue( 2, 2, I2S(udg_MetalScrap[id]) )
    call SetValue( 2, 3, I2S(udg_Wood[id]) )
    call SetValue( 2, 4, I2S(udg_Resin[id]) )
    call SetValue( 2, 5, I2S(udg_Wine[id]) )
    call SetValue( 2, 6, I2S(udg_Stone[id]) )
    call SetValue( 2, 7, I2S(udg_Sulfur[id]) )
    call SetValue( 2, 8, I2S(udg_Gunpowder[id]) )
// Weapons
    call SetValue( 2, 10, udg_Weapon[id] )
    call SetValue( 2, 11, I2S(udg_Ammo[id]) )
    call SetValue( 3, 11, udg_AmmoType[id] )
    call SetValue( 2, 12, I2S(udg_Magazine[id]) )
    call SetValue( 3, 12, I2S(udg_MaxMag[id]) )
// Survival
    call SetValue( 2, 14, I2S(udg_Food[id]) )
    call SetValue( 2, 15, I2S(udg_Water[id]) )
    call SetValue( 3, 14, I2S(udg_Hunger[id]) )
    call SetValue( 3, 15, I2S(udg_Thirst[id]) )
// Too much hunger?
    if udg_Hunger[id] >= 80 then
        call SetColor( 3, 14, 255, 0, 0 )
    else
        call SetColor( 3, 14, 255, 255, 255 )
    endif
// Too much thirst?
    if udg_Thirst[id] >= 80 then
        call SetColor( 3, 15, 255, 0, 0 )
    else
        call SetColor( 3, 15, 255, 255, 255 )
    endif
    endif // End local code.
    set i = i + 1
    exitwhen i > 8
    endloop
endfunction
//Initialize Refreshing Slots trigger
function InitTrig_HUD1_refresh takes nothing returns nothing
    set gg_trg_HUD1_refresh = CreateTrigger(  )
    call TriggerRegisterTimerEvent( gg_trg_HUD1_refresh, 0.20, true )
    call TriggerAddAction( gg_trg_HUD1_refresh, function DoRefresh )
endfunction
 
Level 11
Joined
Mar 31, 2009
Messages
732
I2S(0)
Why not just write "0"?

If the map is failing to load, or crashing, due to this code, then run a binary search type debug on it all. Comment out half of it, see if it still crashes... increase or decrease the commented code by half, and so on until you find what line is causing your problem.
 
I think a more practical approach would be a multiboard array where you locally display it and whatnot, but that is an asdfjdkvjdfksf thing to change since you've gotten a decent heap of code for the other method. =P

Anyway, first try asking your friend/fellow mapper to change this:
JASS:
function SetIcon takes integer col, integer row, string s returns nothing
    call MultiboardSetItemIconBJ( bj_lastCreatedMultiboard , col , row , s )
    //arguments were named "c" and "r"
endfunction
function SetColor takes integer col, integer row, integer red, integer gre, integer blu returns nothing
//parameters for the RGB were reals instead of integers
    local multiboarditem mbitem = MultiboardGetItem(bj_lastCreatedMultiboard, col - 1, row - 1)
    call MultiboardSetItemValueColor(mbitem, red, gre, blu, 255)
    call MultiboardReleaseItem(mbitem)
endfunction

They produced syntax errors for the reasons in the comments.

Be sure he has no JASS NewGen stuff in his map, or else it won't let him test the map. For right now, that's it since I am not sure why else it wouldn't let him load them map. I don't think the GetLocalPlayer() would cause that problem (I don't think the code you've used would desync neither) so yeah... Does it physically put up the loading screen or does it not even let him start the map at all. (It makes the Wc3 chains thing move away as if to load the map, and then they come back down and your back at the map selection)
 
Status
Not open for further replies.
Top