per player multiboard issue

eliw00d

New Member
Reaction score
3
i searched for quite a awhile for an answer, but most of it deals with GUI. i understand how to keep it to the local player, but for some reason it is not even showing up. i have another script that changes the title, but it doesn't even display in the first place. i'm definitely missing something. :/

here is my script:

JASS:
    globals
        multiboard array board[9]
    endglobals
...
        local integer p = 0
...
        loop
            exitwhen p == 9
            set board[p] = CreateMultiboard()
            call MultiboardDisplay(board[p],false)
            if GetLocalPlayer() == Player(p) then
                call MultiboardDisplay(board[p],true)
            endif
            set p = p + 1
        endloop


also, what would be a good way to set the integer to the number of people currently playing? i think i can convert GUI to jass to find out, but maybe there is an easier JASS way?
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
I've never used one multiboard per player but I think I've read that you have to hide/display it again every time you make a change to it.
Other than that, it seems to be very little setup code there, does it show if you remove the localization?
 

eliw00d

New Member
Reaction score
3
I've never used one multiboard per player but I think I've read that you have to hide/display it again every time you make a change to it.
Other than that, it seems to be very little setup code there, does it show if you remove the localization?

you mean like this?

JASS:
loop
            exitwhen p == 9
            set board[p] = CreateMultiboard()
            call MultiboardDisplay(board[p],true)
            set p = p + 1
        endloop


if so, that didn't work.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Creating it is one thing.
The next step would be to add some rows / columns and a title.
Then try to display it.

And, don't do this at map init...
 

eliw00d

New Member
Reaction score
3
Creating it is one thing.
The next step would be to add some rows / columns and a title.
Then try to display it.

And, don't do this at map init...

JASS:
scope Startup initializer Events
    globals
        dialog gamemode = DialogCreate()
        button array gmode[1]
        dialog timemode = DialogCreate()
        button array tmode[2]
        multiboard array board[9]
    endglobals
    
    private function Actions takes nothing returns nothing 
        local integer p = 0
       
        call DialogClear(gamemode)        
        call DialogSetMessage(gamemode,"Select game mode:")
        set gmode[0] = DialogAddButton(gamemode,"Timed",'t')
        set gmode[1] = DialogAddButton(gamemode,"Sandbox",'s')
        call DialogClear(timemode)
        call DialogSetMessage(timemode,"Select time mode:")
        set tmode[0] = DialogAddButton(timemode,"Default (20s Days)",'d')
        set tmode[1] = DialogAddButton(timemode,"Long (40s Days)",'l')
        set tmode[2] = DialogAddButton(timemode,"Epic (60s Days)",'e')
        call DialogDisplay(Player(0),gamemode,true)
        loop
            exitwhen p == 9
            set board[p] = CreateMultiboard()
            call MultiboardSetRowCount(board[p],1)
            call MultiboardSetColumnCount(board[p],1)
            call MultiboardSetTitleText(board[p],"test")
            call MultiboardDisplay(board[p],false)
            if GetLocalPlayer() == Player(p) then
                call MultiboardDisplay(board[p],true)
            endif
            set p = p + 1
        endloop
    endfunction

    public function Events takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEventSingle(t,0.00)
        call TriggerAddAction(t,function Actions)
    endfunction
endscope


this doesn't work, either.
 

N-a-z-g-u-l

New Member
Reaction score
30
JASS:
            call MultiboardDisplay(board[p],false)
            if GetLocalPlayer() == Player(p) then
                call MultiboardDisplay(board[p],true)
            endif


better:

JASS:
            call MultiboardDisplay(board[p],GetLocalPlayer() == Player(p))


i know this doesnt solve the problem, but thought i would mention it...

for the problem: perhaps there are conflicts with the dialog... try not displaying the dialog... or change the order (first multiboard, then dialog)

in my maps sometimes the multiboard disappeared when a dialog was used (i make the multiboard visible everytime a dialog is hidden now)
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
I made a multiboard that showed for different players.. So here's the code:
I hope that this code will help you.
JASS:
library Multiboard initializer InitMultiboard
// How to assign gold:
// The gold type is a multidimensional array you can access the values by typing gold[<Player Number>][<The type of gold>] So Player(0)'s normal gold would be gold[1][1]
//  They are declared as:
//  gold[0][1] = Normal gold
//  gold[0][2] = Gold from wells
//  gold[0][3] = Gold from fountains
//  gold[0][4] = Total gold
//InitMulti initializer InitTrig
globals     
    private MultiboardCore array MBC                // The main core.
    Gold gold                                       // The gold that's saved. 
                                                    //Change this and the multiboard is updated next time the update trigger runs, you can also update it by yourself with: call UpdateMultiboard()
    private constant real COLL1WIDTH = 0.08         // The width of collumn 1
    private constant real COLL2WITDH = 0.048        // The width of collumn 2
    private constant string ONSTRING = "-multi on"  // The string WC3 uses to detect when you want to activate your multiboard
    private constant string OFFSTRING ="-multi off" // The string WC3 uses to detect when you want to deactivate your multiboard
    private constant string EVENT = "-multi"        // The substring WC3 detects when you want to create one
    boolean FMMODE = false                          // Is it FM mode?
    private constant string GoldMinesColor = "|cffFFF68F"
    private constant string FountainsColor = "|cffFFC469"
    private constant string WellsColor = "|cffFFD700"
    private constant string TotalColor = "|cff99CC32"
endglobals

// The gold type.
type EachPlayer extends integer array[12] 
type Gold extends EachPlayer array[4] 
//  Update functions
function UpdateMultiboard takes nothing returns nothing
    local integer i = 1
    local integer i2 = 1
    loop
        exitwhen i == 12
        set gold<i>[4] = gold<i>[1]+gold<i>[2]+gold<i>[3]
        call MultiboardSetItemValue(MBC<i>.row[1].coll[2], GoldMinesColor+I2S(gold<i>[1]))
        call MultiboardSetItemValue(MBC<i>.row[2].coll[2], FountainsColor+I2S(gold<i>[2]))
        call MultiboardSetItemValue(MBC<i>.row[3].coll[2], WellsColor+I2S(gold<i>[3]))
        call MultiboardSetItemValue(MBC<i>.row[4].coll[2], TotalColor+I2S(gold<i>[4]))
        set i = i+1
    endloop
endfunction

// TheCore
struct MultiboardCore
    multiboard main
    MultiboardCoreChild array row[6]
    
    // The init trig, 
    static method MainCreate takes nothing returns MultiboardCore
        local MultiboardCore CreateTemp = MultiboardCore.allocate() // Create the main variable
        local integer i = 1 // The iterator.
        // Init all important values so they don&#039;t point to something strange.
        set CreateTemp.main = CreateMultiboard() 
        
        call MultiboardSetTitleText(CreateTemp.main, &quot;|cFFFFD700Gold income&quot;)
        call MultiboardSetColumnCount(CreateTemp.main, 2)
        call MultiboardSetRowCount(CreateTemp.main, 4)
        set CreateTemp.row[1] = MultiboardCoreChild.AltCreate()
        set CreateTemp.row[2] = MultiboardCoreChild.AltCreate()
        set CreateTemp.row[3] = MultiboardCoreChild.AltCreate()
        set CreateTemp.row[1] = MultiboardCoreChild.AltCreate()
        loop
            exitwhen i == 5
            set CreateTemp.row<i>.coll[1] = MultiboardGetItem(CreateTemp.main, i-1, 0)
            set CreateTemp.row<i>.coll[2] = MultiboardGetItem(CreateTemp.main, i-1, 1)
            set i=i+1
        endloop
        // Init so all icons are gone and size is good.
        set i = 1
        loop
            exitwhen i == 5
            call MultiboardSetItemStyle(CreateTemp.row<i>.coll[1], true, false)
            call MultiboardSetItemStyle(CreateTemp.row<i>.coll[2], true, false)
            call MultiboardSetItemWidth(CreateTemp.row<i>.coll[1], COLL1WIDTH)
            call MultiboardSetItemWidth(CreateTemp.row<i>.coll[2], COLL2WITDH)
            set i = i+1
        endloop
        call MultiboardSetItemValue(CreateTemp.row[1].coll[1], &quot;|cffFFF68FGold mines&quot;)
        call MultiboardSetItemValue(CreateTemp.row[2].coll[1], &quot;|cffFFC469Gold Wells&quot;)
        call MultiboardSetItemValue(CreateTemp.row[3].coll[1], &quot;|cffFFD700Gold Fountians&quot;)
        call MultiboardSetItemValue(CreateTemp.row[4].coll[1], &quot;|cff99CC32Total Income&quot;)
        call UpdateMultiboard()
        return CreateTemp
        endmethod
    endstruct
// The child stuct so I can use a matrix like syntax
struct MultiboardCoreChild
    multiboarditem array coll[3]
    static method AltCreate takes nothing returns MultiboardCoreChild
        local MultiboardCoreChild TempChild = MultiboardCoreChild.allocate()
        return TempChild
    endmethod
endstruct

private function DisplayToPlayer takes player p, MultiboardCore TMBCS, boolean show returns nothing
    if GetLocalPlayer() == p then
        call MultiboardDisplay(TMBCS.main, show)
        call UpdateMultiboard()
    endif
endfunction

private function WhatCommand takes nothing returns nothing
    local player p = GetTriggerPlayer()
    local string chat = GetEventPlayerChatString()
    if chat == ONSTRING then
        call DisplayToPlayer(p, MBC[(GetPlayerId(p))+1], true)
    elseif chat == OFFSTRING then
        call DisplayToPlayer(p, MBC[(GetPlayerId(p))+1], false)
    else 
    endif    
    set p = null
    set chat = &quot;&quot;
endfunction

private function MainInit takes nothing returns nothing
    local integer i = 1
    set gold = Gold.create()
    loop
        exitwhen i == 11
        set MBC<i> = MultiboardCore.MainCreate()
        set gold<i>[1] = 0
        set gold<i>[2] = 0
        set gold<i>[3] = 0
        set gold<i>[4] = 0
        set i = i+1
    endloop
    
endfunction


private function InitMultiboard takes nothing returns nothing
    local trigger Trig = CreateTrigger()
    local integer i = 0
    set Trig = CreateTrigger()
    call TriggerRegisterTimerEvent(Trig, 0.01, false)
    call TriggerAddAction(Trig, function MainInit)
    loop
        exitwhen i == 11
        call TriggerRegisterPlayerChatEvent(Trig, Player(i), EVENT, false)
        set i = i+1
    endloop
    call TriggerAddAction(Trig, function WhatCommand)
    set Trig = CreateTrigger()
    call TriggerRegisterTimerEvent(Trig, 10, true)
    call TriggerAddAction(Trig, function UpdateMultiboard)
endfunction
endlibrary</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>


If you see some different events and stuff in this it's because I active it with a chat command. I don't know how optimized this is but it works.
 

eliw00d

New Member
Reaction score
3
for the problem: perhaps there are conflicts with the dialog... try not displaying the dialog... or change the order (first multiboard, then dialog)

in my maps sometimes the multiboard disappeared when a dialog was used (i make the multiboard visible everytime a dialog is hidden now)
i rem'ed all the code pertaining to the dialog, but the multiboard still doesn't show.

Gwypaas said:
I made a multiboard that showed for different players.. So here's the code:
I hope that this code will help you.
thanks. i'll look it over.

Acehart said:
> dialog gamemode = DialogCreate()

Tried moving the create call inside the function instead of the globals?
i just did and warcraft crashed. you mean like this, correct?
JASS:
set gamemode = DialogCreate()
set timemode = DialogCreate()
 

eliw00d

New Member
Reaction score
3
Crashed? Where did you put that?

here is all of the code as of now:

JASS:
scope Startup initializer Events
    globals
        dialog gamemode 
        button array gmode[1]
        dialog timemode
        button array tmode[2]
        multiboard array board[9]
    endglobals
    
    private function Actions takes nothing returns nothing 
        local integer p = 0

        loop
            exitwhen p == 9
            set board[p] = CreateMultiboard()
            call MultiboardSetRowCount(board[p],1)
            call MultiboardSetColumnCount(board[p],1)
            call MultiboardSetTitleText(board[p],&quot;test&quot;)
            call MultiboardDisplay(board[p],GetLocalPlayer() == Player(p))
            set p = p + 1
        endloop
        set gamemode = DialogCreate()
        set timemode = DialogCreate()
        call DialogClear(gamemode)        
        call DialogSetMessage(gamemode,&quot;Select game mode:&quot;)
        set gmode[0] = DialogAddButton(gamemode,&quot;Timed&quot;,&#039;t&#039;)
        set gmode[1] = DialogAddButton(gamemode,&quot;Sandbox&quot;,&#039;s&#039;)
        call DialogClear(timemode)
        call DialogSetMessage(timemode,&quot;Select time mode:&quot;)
        set tmode[0] = DialogAddButton(timemode,&quot;Default (20s Days)&quot;,&#039;d&#039;)
        set tmode[1] = DialogAddButton(timemode,&quot;Long (40s Days)&quot;,&#039;l&#039;)
        set tmode[2] = DialogAddButton(timemode,&quot;Epic (60s Days)&quot;,&#039;e&#039;)
        call DialogDisplay(Player(0),gamemode,true)
    endfunction

    public function Events takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEventSingle(t,0.00)
        call TriggerAddAction(t,function Actions)
    endfunction
endscope

JASS:
scope GameMode
    globals
        boolean array gmodeis[1]
    endglobals 
        
    private function Actions takes nothing returns nothing        
        if GetClickedButton() == gmode[0] then
            call DialogDisplay(Player(0),timemode,true)
            set gmodeis[0] = true
            return
        elseif GetClickedButton() == gmode[1] then
            call DialogDisplay(Player(0),timemode,true)
            set gmodeis[1] = true
            return
        endif
    endfunction

    public function InitTrig takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterDialogEvent(t,gamemode)
        call TriggerAddAction(t,function Actions)
    endfunction
endscope

JASS:
scope TimeMode
    private function Actions takes nothing returns nothing
        if GetClickedButton() == tmode[0] and gmodeis[0] == true then
            call SetTimeOfDayScale(1)
        elseif GetClickedButton() == tmode[0] and gmodeis[1] == true then
            call SetTimeOfDayScale(1)
        elseif GetClickedButton() == tmode[1] and gmodeis[0] == true then 
            call SetTimeOfDayScale(0.5)
        elseif GetClickedButton() == tmode[1] and gmodeis[1] == true then
            call SetTimeOfDayScale(0.5)
        elseif GetClickedButton() == tmode[2] and gmodeis[0] == true then
            call SetTimeOfDayScale(0.33)
        elseif GetClickedButton() == tmode[2] and gmodeis[1] == true then
            call SetTimeOfDayScale(0.33)                             
        endif
    endfunction
    
    public function InitTrig takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterDialogEventBJ(t,timemode)
        call TriggerAddAction(t,function Actions)
    endfunction
endscope

JASS:
scope DateTime
    globals
        string secondstr
        string minutestr
        string hourstr
    endglobals
      
    private function Actions takes nothing returns nothing
        local integer seconds = 0
        local integer minutes = 0
        local integer hours = 6
        local integer days = 1
        local integer p = 0
        
            set seconds = seconds + 1
            if seconds == 60 then
                set seconds = 0
                set minutes = minutes + 1
                if minutes == 60 then 
                    set minutes = 0
                    set hours = hours + 1
                    if hours == 24 then
                        set hours = 0
                        set days = days + 1
                    endif
                endif
            endif 
            if seconds &lt; 10 then
                set secondstr = &quot;0&quot;+I2S(seconds)
            else
                set secondstr = I2S(seconds)
            endif
            if minutes &lt; 10 then 
                set minutestr = &quot;0&quot;+I2S(minutes)
            else
                set minutestr = I2S(minutes)
            endif
            if hours &lt; 10 then
                set hourstr = &quot;0&quot;+I2S(hours)
            else
                set hourstr = I2S(hours)
            endif
            loop
                exitwhen p &gt; 9
                call MultiboardSetTitleText(board[p],&quot;Z-Day+&quot;+I2S(days)+&quot;, &quot;+hourstr+&quot;:&quot;+minutestr+&quot;:&quot;+secondstr)
                set p = p + 1
            endloop      
    endfunction

    public function InitDateTime takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEventPeriodic(t,1.00)
        call TriggerAddAction(t,function Actions)
    endfunction
endscope
 

eliw00d

New Member
Reaction score
3
i tried taking away the array so that it is a regular board, but that doesn't seem to work, either. am i missing something big? or are my other triggers causing the problems?
 

eliw00d

New Member
Reaction score
3
i can't wrap my head around how to fix this. did posting the triggers help in any way?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Some random wild guessing maybe:
> call TriggerRegisterDialogEvent(t,gamemode)

Does this work if gamemode has not been initialized yet?

Either way, I would suggest keeping all the init stuff, especially if they depend on some order, in one place only.
If nothing else, at least you actually know what the order is.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top