System MBS - Multiboard System

Joker(Div)

Always Here..
Reaction score
86
JASS:
//==============================================================================
//  MBS -- Multiboard System by Joker(Div) -- v1.0
//==============================================================================
//
//  PURPOSE:
//       * Easy Multiboard Editing/Creating
//
//  HOW TO USE:
//       * Create a global Multiboard (the struct)
//       * Call the .create and start editing
//
//  FUNCTIONS:
//
//      .create takes integer MaxColumn, integer MaxRow returns Multiboard (the struct )
//
//      -----  Functions for Entire Board -----
//      .setTitle       takes string Title
//      .setColCount    takes integer NewMaxColumns returns nothing
//      .setRowCount    takes integer NewMaxRows returns nothing
//      .setStyle       takes boolean ShowText, boolean ShowIcon returns nothing
//      .show           takes nothing returns nothing
//      .hide           takes nothing returns nothing
//      .minimize       takes nothing returns nothing
//      .maximize       takes nothing returns nothing
//      .setColCount    takes integer NewMaxColumns returns nothing
//
//      -----  Functions for Specific Items -----
//      .setItemText    takes integer column, integer row, string text returns nothing
//      .setItemColor   takes integer column, integer row, integer red, integer blue, integer green, integer alpha returns nothing
//      .setItemStyle   takes integer column, integer row, boolean ShowText, boolean ShowIcon returns nothing
//
//      -----  Functions for Entire Row -----
//      .setRowText     takes integer row, string text returns nothing
//      .setRowColor    takes integer row, integer red, integer blue, integer green, integer alpha returns nothing
//      .setRowStyle    takes integer row, boolean ShowText, boolean ShowIcon returns nothing
//
//      -----  Functions for Entire Col -----
//      .setColText     takes integer column, string text returns nothing
//      .setColColor    takes integer column, integer red, integer blue, integer green, integer alpha returns nothing
//      .setColStyle    takes integer column, boolean ShowText, boolean ShowIcon returns nothing
//      .setColWidth    takes integer column, real widthPercent returns nothing
//
//      -----  Functions for Specific Players -----
//      .showForPlayer      takes player p returns nothing
//      .hideForPlayer      takes player p returns nothing
//      .minimizeForPlayer  takes player p returns nothing
//      .maximizeForPlayer  takes player p returns nothing
//
//  PROS: 
//       * Easy editing
//       * Simple
//
//  CONS:
//       * ???
//
//  DETAILS:
//       * Really its mostly wrappers for eye-candy. Some helpful functions too I suppose...
//
//  THANKS TO:
//      * Cohadar - Who I stole this info template from
//
//  HOW TO IMPORT:
//       * Just create a trigger named MBS
//       * convert it to text and replace the whole trigger text with this one
//
//==============================================================================
library MBS

    struct Multiboard
        //  I'm not really sure why I decided to use a 
        //  module. I thought I would need one when I 
        //  started, but I guess not...
        //  Looks prettier at least.
        implement MultiboardFunctions
        
        static method create takes integer colCount, integer rowCount returns thistype
            local thistype dat = thistype.allocate()
            
              set dat.board = CreateMultiboard()
                call dat.setColCount( colCount )
                call dat.setRowCount( rowCount )
                
            return dat
        endmethod
    endstruct
    
    //Wrappers and such...
    module MultiboardFunctions
        multiboard board
        private static multiboarditem mbi  //only need 1
        
        //===  --The "get" functions-- ===//
        //  If really needed, I could add some, but I 
        //  honestly don't see a need to.
        
        //===  --Functions for entire board-- ===//
        method setTitle takes string title returns nothing
            call MultiboardSetTitleText( this.board, title )
        endmethod
        
        method setColCount takes integer colCount returns nothing
            call MultiboardSetColumnCount( this.board, colCount )
        endmethod
        
        method setRowCount takes integer rowCount returns nothing
            call MultiboardSetRowCount( this.board, rowCount )
        endmethod
        
        method setStyle takes boolean showText, boolean showIcon returns nothing
            call MultiboardSetItemsStyle( this.board, showText, showIcon )
        endmethod
        
        method show takes nothing returns nothing
            call MultiboardDisplay( this.board, true )
        endmethod
        
        method hide takes nothing returns nothing
            call MultiboardDisplay( this.board, false )
        endmethod
        
        method minimize takes nothing returns nothing
            call MultiboardMinimize( this.board, true )
        endmethod
        
        method maximize takes nothing returns nothing
            call MultiboardMinimize( this.board, false )
        endmethod
        
        //===  --Functions for specific items-- ===//
        method setItemText takes integer whatCol, integer whatRow, string text returns nothing
            set .mbi = MultiboardGetItem( this.board, whatRow - 1, whatCol - 1 ) 
            call MultiboardSetItemValue( .mbi, text )
            call MultiboardReleaseItem( .mbi )
        endmethod
        
        method setItemColor takes integer whatCol, integer whatRow, integer red, integer blue, integer green, integer alpha returns nothing
            //I left this to the default 255, same as object editor coloring
            set .mbi = MultiboardGetItem( this.board, whatRow - 1, whatCol - 1 )
            call MultiboardSetItemValueColor( .mbi, red, green, blue, alpha )
            call MultiboardReleaseItem( .mbi )
        endmethod
        
        method setItemStyle takes integer whatCol, integer whatRow, boolean showText, boolean showIcon returns nothing
            set .mbi = MultiboardGetItem( this.board, whatRow - 1, whatCol - 1 ) 
            call MultiboardSetItemStyle( .mbi, showText, showIcon )
            call MultiboardReleaseItem( .mbi )
        endmethod
        
        //===  --Functions for entire row/column-- ===//
        method setRowText takes integer whatRow, string text returns nothing
            local integer loopCol = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, whatRow - 1, loopCol )
                call MultiboardSetItemValue( .mbi, text )
                call MultiboardReleaseItem( .mbi )
                set loopCol = loopCol + 1
                exitwhen loopCol == MultiboardGetColumnCount( this.board )
            endloop
        endmethod
        
        method setRowColor takes integer whatRow, integer red, integer blue, integer green, integer alpha returns nothing
            local integer loopCol = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, whatRow - 1, loopCol )
                call MultiboardSetItemValueColor( .mbi, red, green, blue, alpha )
                call MultiboardReleaseItem( .mbi )
                set loopCol = loopCol + 1
                exitwhen loopCol == MultiboardGetColumnCount( this.board )
            endloop
        endmethod
        
        method setRowStyle takes integer whatRow, boolean showText, boolean showIcon returns nothing
            local integer loopCol = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, whatRow - 1, loopCol )
                call MultiboardSetItemStyle( .mbi, showText, showIcon )
                call MultiboardReleaseItem( .mbi )
                set loopCol = loopCol + 1
                exitwhen loopCol == MultiboardGetColumnCount( this.board )
            endloop
        endmethod
        
        method setColText takes integer whatCol, string text returns nothing
            local integer loopRow = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, loopRow, whatCol - 1 )
                call MultiboardSetItemValue( .mbi, text )
                call MultiboardReleaseItem( .mbi )
                set loopRow = loopRow + 1
                exitwhen loopRow == MultiboardGetRowCount( this.board )
            endloop
        endmethod
        
        method setColColor takes integer whatCol, integer red, integer blue, integer green, integer alpha returns nothing
            local integer loopRow = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, loopRow, whatCol - 1 )
                call MultiboardSetItemValueColor( .mbi, red, green, blue, alpha )
                call MultiboardReleaseItem( .mbi )
                set loopRow = loopRow + 1
                exitwhen loopRow == MultiboardGetRowCount( this.board )
            endloop
        endmethod
        
        method setColStyle takes integer whatCol, boolean showText, boolean showIcon returns nothing
            local integer loopRow = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, loopRow, whatCol - 1 )
                call MultiboardSetItemStyle( .mbi, showText, showIcon )
                call MultiboardReleaseItem( .mbi )
                set loopRow = loopRow + 1
                exitwhen loopRow == MultiboardGetColumnCount( this.board )
            endloop
        endmethod
        
        method setColWidth takes integer whatCol, real widthPercent returns nothing
            local integer loopRow = 0
            
            loop
                set .mbi = MultiboardGetItem( this.board, loopRow, whatCol - 1 )
                call MultiboardSetItemWidth( .mbi, widthPercent * 0.01 )
                call MultiboardReleaseItem( .mbi )
                set loopRow = loopRow + 1
                exitwhen loopRow == MultiboardGetRowCount( this.board )
            endloop
        endmethod
        
        //===  --Functions for specific players-- ===//
        method showForPlayer takes player p returns nothing
            if GetLocalPlayer() == p then
                call MultiboardDisplay( this.board, true )
            endif
        endmethod
        
        method hideForPlayer takes player p returns nothing
            if GetLocalPlayer() == p then
                call MultiboardDisplay( this.board, false )
            endif
        endmethod
        
        method minimizeForPlayer takes player p returns nothing
            if GetLocalPlayer() == p then
                call MultiboardMinimize( this.board, true )
            endif
        endmethod
        
        method maximizeForPlayer takes player p returns nothing
            if GetLocalPlayer() == p then
                call MultiboardDisplay( this.board, false )
            endif
        endmethod
    endmodule

endlibrary


Example:
JASS:
//I know this has some other things, but really its irrelevant to 
//showing MBS
scope BoardSetup initializer onInit

    globals
        constant string GONE        = "|cFF808080 *Empty"
        constant string GONE_NUM    = "|cFF808080---"
    endglobals
    //======================================================
    
    globals
        Multiboard Board
    endglobals

    private function Create takes nothing returns nothing
        local integer i = 0
        
        set Board = Multiboard.create( 3, 10 )
            call Board.setTitle( "Time: 0:00" )
            
            call Board.setColWidth( 1, 9.0 )
            call Board.setColWidth( 2, 3.5)
            call Board.setColWidth( 3, 3.5 )
            
            call Board.setColColor( 2, 100, 80, 142, 255 )
            call Board.setColColor( 3, 210, 160, 120, 255 )
            
            call Board.setItemColor( 1, 2, 100, 250, 200, 255 )
            call Board.setItemColor( 1, 5, 100, 225, 200, 255 )
            call Board.setItemColor( 1, 8, 100, 200, 200, 255 )
            
            call Board.setRowText( 3, " 0" )
            call Board.setRowText( 4, " 0" )
            
            call Board.setItemText( 2, 1, BLIZZ_COLOR + "Count" )
            call Board.setItemText( 3, 1, BLIZZ_COLOR + "Total" )
        
            call Board.setItemText( 1, 2, "Team 1" )
            call Board.setItemText( 1, 5, "Team 2" )
            call Board.setItemText( 1, 8, "Team 3" )
        
            loop
                if Players<i>.isPlaying then
                    call Board.setItemText( 1, Players<i>.rowPosition, &quot; &quot; + GetPlayerNameColored(Player(i)) )
                else
                    call Board.setItemText( 1, Players<i>.rowPosition, GONE )
                    call Board.setItemText( 2, Players<i>.rowPosition, GONE_NUM )
                    call Board.setItemText( 3, Players<i>.rowPosition, GONE_NUM )
                endif
                set i = i + 1
                exitwhen i &gt;= MAX_PLAYERS
            endloop
            
            call Board.setStyle(true, false )
            call Board.minimize()
            call Board.show()
            
            call ReleaseTimer( GetExpiredTimer() )
    endfunction

    private function onInit takes nothing returns nothing
        call TimerStart( NewTimer(), GAME_DELAY, false, function Create )
    endfunction

endscope</i></i></i></i></i>

exampleu.jpg



Edit: Well, I now find that Darfett has beat me by 2 weeks. I had no idea...o well. I'll take it down with popular request.
 

D.V.D

Make a wish
Reaction score
73
In your first list of functions you wrote
JASS:
//      .setColCount    takes integer NewMaxColumns returns nothing
twice.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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