System jBoard - Advanced Multiboard System

Discussion in 'Systems and Snippets' started by Magentix, Mar 28, 2010.

  1. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    jBoard
    Combines the power of jQuery (webdesign) into vJASS multiboards.
    The manual is quite clear, give it a look:

    JASS:
    //==============================================================================
    //  jBoard -- ADVANCED MULTIBOARD SYSTEM BY MAGENTIX -- v1.2
    //==============================================================================
    
    //==============================================================================
    //  Quick manual:
    //==============================================================================
    //
    //    Implement by adding "requires jBoardLib" behind your library/scope names
    //
    //    ----------------------------------------------------------------------
    //      What is jBoard?
    //    ----------------------------------------------------------------------
    //
    //      jBoard is an enhanced multiboard management system, inspired by the
    //      jQuery library that is available to webdesigners. That javascript library
    //      allows for a cool functionality called "chaining".
    //
    //      Because WC3 multiboards often require a huge amount of function calls,
    //      I came up with jBoard to allow you to make your multiboard code shorter,
    //      smoother and overall more easy to use.
    //
    //
    //    ----------------------------------------------------------------------
    //      What is chaining and how to use it?
    //    ----------------------------------------------------------------------
    //
    //      An example says a thousand words, assume this is your 10x5 multiboard setup
    //      and you want to set all fields to "0" and the first field to "1":
    //
    //      -  local multiboard MB = CreateMultiboard()
    //         local multiboarditem MBI
    //         call MultiboardSetTitleText(MB,"My Multiboard")
    //         call MultiboardDisplay(MB,true)
    //         call MultiboardSetRowCount(MB,10)
    //         call MultiboardSetColumnCount(MB,5)
    //         call MultiboardSetItemsValue(MB,"0")
    //         call MultiboardSetItemsStyle(MB,true,false)
    //         set MBI = MultiboardGetItem(MB,0,0)
    //         call MultiboardSetItemValue(MBI,"1")
    //
    //      Now take a look at jBoard:
    //      -  //! runtextmacro jBoardCreate("MyBoard","10","5")
    //         local MyBoard MB = MyBoard.create("My Multiboard").field(0,0).setValue("1")
    //      That's all you need to type!
    //
    //      Remember: the textmacro also only has to be called ONCE to create a
    //      multiboard with the wanted dimensions. So actually that line wouldn't be
    //      there, but at the top of your script.
    //
    //      Did you also notice how every method call returned an object that you
    //      could then call another method on? That is the beauty of chaining.
    //
    //   !! EVERY FUNCTION CALL RETURNS A jBoard OBJECT UNLESS STATED OTHERWISE !!
    //
    //
    //    ----------------------------------------------------------------------
    //      I noticed a textmacro there, what gives?
    //    ----------------------------------------------------------------------
    //      
    //      Since you need to create structs that represent your multiboard, jBoard
    //      needs to know the dimensions of your multiboard to ensure the structs
    //      don't take up more space than they need to.
    //
    //      For every multiboard variation you plan to use, simply call this once at
    //      the top of your script:
    //      //! runtextmacro jBoardCreate("StructName","RowAmount","ColAmount")
    //
    //      Example for an 8 row, 4 col board:
    //      //! runtextmacro jBoardCreate("My8x4Board","8","4")
    //      Which you can then instanciate in your script as
    //      My8x4Board.create("BoardTitle")
    //
    //
    //    ----------------------------------------------------------------------
    //      Defaults
    //    ----------------------------------------------------------------------
    //      
    //      Somtimes we don't want our board cells to be empty by default, but show
    //      0 for example. This is easy to achieve by setting a default. Take a look
    //      at the jBoard struct further down this info block and edit the defaults
    //      you like to see changed. Every jBoard that gets created after a change
    //      will take those defaults into account.
    //
    //      Note that you can hardcode defaults below and still change them on the fly!
    //      set jBoard.defaultItemValue = "1" -- Valid syntax!
    //
    //      Edit your defaults here:
    //! textmacro jBoardDefaults
            static string  defaultItemValue = ""
            static string  defaultIconPath  = "UI\\Widgets\\EscMenu\\Human\\observer-icon.blp"
            static boolean defaultShowValue = true
            static boolean defaultShowIcon  = false
            static boolean defaultShowBoard = true
            static real    defaultItemWidth = 0.03
    //! endtextmacro
    //
    //==============================================================================
    
    //==============================================================================
    //  Tip: Commenting out newlines
    //==============================================================================
    //
    //  Sometimes when chaining methods, a command can get quite lengthy. jQuery
    //  doesn't suffer from this visually, because javascript allows people to write
    //  code over multiple lines until they end it with a semicolon (;)
    //
    //  JASS, however, doesn't allow that directly. Fortunately you can call jBoard
    //  commands just as easily on multiple lines. Remember: Until you call .reset(),
    //  your selection will be saved to the next line!
    //
    //  Example:
    //  local MyBoard MB = MyBoard.create("funkyboard").setplayerrow(0,2).setcolour("ff0000").reset().setplayerrow(1,3).setcolour("0000ff").reset().etc...
    //
    //  Could become:
    //      local MyBoard MB = MyBoard.create("funkyboard")
    //      call MB.setplayerrow(0,2).setcolour("ff0000").reset()
    //      call MB.setplayerrow(1,3)
    //      call MB.setcolour("0000ff").reset() <-- Previous row selection was saved to this line
    //
    //  In the end it all boils down to which type of coding you prefer, of course.
    //
    //==============================================================================
    
    //==============================================================================
    //  Tip: -R Functions
    //==============================================================================
    //
    //  When chaining several commands onto a set of fields, one could easily say:
    //  "There, now let me reset my selection and continue chaining methods"
    //
    //  However, when chaining that way, a string of jBoard commands could easily
    //  contain the call .reset() a dozen times.
    //
    //  To save coding space and safeguard readability, I introduced the -R functions:
    //  Basically, any non-selector function that returns a jBoard object can be called
    //  with a capital "R" behind the name and the jBoard system will automatically
    //  call a .reset() for you.
    //
    //  The above example of commenting out newlines would then become:
    //  local MyBoard MB = MyBoard.create("funkyboard").setPlayerRow(0,2).setColourR("ff0000").setPlayerRow(1,3).setColourR("0000ff").etc...
    //
    //  As you can see, this makes the chaining process yet again a little smoother
    //  Once again: this functionality does not work on selectors/"getters"!
    //
    //==============================================================================
    
    //==============================================================================
    //  Function index:
    //==============================================================================
    //
    //    ----------------------------------------------------------------------
    //      Standard Functions - Creating, showing, etc...
    //    ----------------------------------------------------------------------
    //
    //      Main functionality you'd expect from any multiboard. May be used within
    //      a local player block. Can be used on any jBoard object (boad, row, col,
    //      field(s)) and returns the selection you called the function on.
    //
    //    .create("MultiboardName")
    //    .show()
    //    .hide()
    //    .clear() -- SHOULD NEVER BE CALLED, just here for completion
    //    .fold()
    //    .unfold()
    //    .setName()
    //    .getName() -- Returns the multiboard name as a string, not a jBoard object
    //    .setNameColour("rgb value")
    //      Colour syntax: rrggbb (in hexadecimal)
    //    .getNameColour()
    //    .destroy()
    //
    //
    //    ----------------------------------------------------------------------
    //      Selection Functions - Adds rows, cols or fields to the selection
    //    ----------------------------------------------------------------------
    //
    //      Selectors can be used on any jBoard object (boad, row, col, field(s))
    //      They always return the collection of all the objects you selected from
    //      the last .reset() up to that point.
    //
    //    VERY IMPORTANT!
    //    .reset()
    //      Resets the current selection to the board
    //
    //    MAIN SELECTORS
    //    .row(integer start, integer end)
    //    .col(integer start, integer end)
    //      Selects a row, a columns or multiple of any
    //      -  .row(0,0) returns the row object of row 0
    //      -  .row(0,1) returns the combined fields of row 0 and row 1
    //      -  ONLY WHEN HAVING -ONE- ROW/COL SELECTED will you be able
    //         to use row/col only functionality
    //         (it won't give errors or bugs if you try, though)
    //
    //    SINGLE SELECTOR
    //    .field(integer row, integer col)
    //      Adds one field to the selection or (if selection is empty)
    //      returns one field to use field-level manipulations on
    //    .getPlayerRowField(integer player, integer column)
    //    .getPlayerColField(integer player, integer row)
    //      The above two return just ONE field of a player's row.
    //      Since the player selectors return an entire row and a deep
    //      selector inside that row would clear the selection first,
    //      it would otherwise be impossible to select multiple fields
    //      from player rows or columns...
    //      You should use this over .getPlayerRow(0).getField(3) unless
    //      you want only that field of course.
    //
    //    DEEP SELECTOR
    //    .getField(integer which)
    //      Returns just ONE field, selected from your previous selection
    //      
    //      Quick list of what it does when used on a:
    //      -  Board:  Returns the field in position X of the board,
    //                 reading from top left to bottom right
    //      -  Row:    Returns the field in column X of that row
    //      -  Column: Returns the field in row X of that column
    //      -  Fields: Returns the field in position X of the selection,
    //                 reading from top left to bottom right
    //      -  Field:  Does nothing (returns same field)
    //
    //
    //    ----------------------------------------------------------------------
    //      Player Selectors
    //    ----------------------------------------------------------------------
    //
    //      Simple functions that allow you to save a row/col to a player.
    //
    //      Both the setters and the getters add the row/col you just set
    //      to the current selection. Hence, this is both valid syntax:
    //      -  MB.setPlayerRow(0,1).setcolour("ff0000")
    //      -  MB.setPlayerRow(0,1)
    //         MB.getPlayerRow(0,1).setcolour("ff0000")
    // 
    //      The player "setters" have -R functionality, but the "getters" don't!
    //      
    //    .setPlayerRow(integer player, integer row)
    //    .setPlayerCol(integer player, integer col)
    //    .getPlayerRow(integer player)
    //    .getPlayerCol(integer player)
    //
    //
    //    ----------------------------------------------------------------------
    //      Manipulation Functions - Also referred to as "setters"
    //    ----------------------------------------------------------------------
    //
    //      Setters can be used on any jBoard object (boad, row, col, field(s))
    //      They always return the object that was just manipulated
    //
    //      ABOUT PREFIXES AND SUFFIXES:
    //      Imagine you want a row with user experience values, by setting a suffix
    //      "XP", you could still use .add(value) to a field, because the content
    //      can still be handled by S2I(). Example:
    //      -  .field(1,2) has content "2" and suffix " xp", the field shows "2 xp"
    //         A user calls .field(1,2).add(4), the field now show "6 xp", without
    //         having to worry about the " xp" bit!
    //
    //    VALUE SETTERS
    //    .setValue("value")
    //    .setColour("rgb value")
    //      Colour syntax: rrggbb (in hexadecimal)
    //    .setPrefix("value")
    //    .setSuffix("value")
    //    .setIconPath("path")
    //    .setWidth(real width)
    //
    //    VALUE MANIPULATORS
    //    .add(integer value)
    //      Only works if field contents are numerical strings, value can be negative
    //
    //
    //    ----------------------------------------------------------------------
    //      Retrieval Functions - Also referred to as "getters"
    //    ----------------------------------------------------------------------
    //
    //      Getters can be used on any jBoard object (boad, row, col, field(s))
    //                      !! EVERY GETTER RETURNS A STRING !!
    //
    //      HERE'S WHY:
    //      When using a getter on anything but a single field, a string is returned
    //      with all values in it, separated by a pipe (|).
    //      Future versions may support smart retrieval of a row's/col's properties
    //      should they all have the same colour for example...
    //
    //      Naturally, the fact that these methods return a string instead of a
    //      jBoard object means that calling any of these methods is in fact
    //      "The end of the line" for that chaining process...
    //
    //    .getValue()
    //    .getColour()
    //    .getPrefix()
    //    .getSuffix()
    //    .getIconPath() -- CAREFUL USE on many fields! (might blow up in your face)
    //    .getWidth()
    //
    //
    //    ----------------------------------------------------------------------
    //      Extra Functions - Various
    //    ----------------------------------------------------------------------
    //
    //    .showIcon()
    //    .hideIcon()
    //    .showValue()
    //    .hideValue()
    //
    //==============================================================================
    
    //==============================================================================
    //  Credits:
    //==============================================================================
    //
    //  John Resig for coming up with jQuery and its chaining
    //  Vexorian for vJass and JassHelper, making jBoard possible
    //
    //==============================================================================
    
    //==============================================================================
    //  Open letter to Vexorian:
    //==============================================================================
    //
    //  Take a look at the setter/getter methods and the -R functions. If that isn't
    //  a reason why textmacroes should be allowed to be nested, I don't know what
    //  is :x (They're all the same bar the function name...)
    //
    //  Protip: Yes, this is a request to you to get nested textmacroes working :)
    //
    //==============================================================================
    
    //==============================================================================
    //  Macro function core -- No touchy from here on out!
    //==============================================================================
    
    //! textmacro jBoardCreate takes NAME, ROWS, COLS
        globals
            private constant integer $NAME$SIZE = $ROWS$*$COLS$
            private constant integer $NAME$ROWS = $ROWS$
            private constant integer $NAME$COLS = $COLS$
        endglobals
        
        private struct $NAME$FIELD
            $NAME$ parent
            integer realRow
            integer realCol
            multiboarditem mbi
            
            real   width    = jBoard.defaultItemWidth
            string iconpath = jBoard.defaultIconPath
            string colour   = "ffffff"
            string prefix   = ""
            string content  = jBoard.defaultItemValue
            string suffix   = ""
            
            boolean showV   = jBoard.defaultShowValue
            boolean showI   = jBoard.defaultShowIcon
            
            static method create takes $NAME$ parent, integer row, integer col returns thistype
                local thistype f = thistype.allocate()
                set f.parent = parent
                set f.realRow = row
                set f.realCol = col
                set f.mbi = MultiboardGetItem(f.parent.MB,f.realRow,f.realCol)
                
                return f
            endmethod
            
            method onDestroy takes nothing returns nothing
                call MultiboardReleaseItem(.mbi)
            endmethod
            
            private method updateField takes nothing returns nothing
                call MultiboardSetItemValue(.mbi,"|cff"+.colour+.prefix+.content+.suffix+"|r")
            endmethod
            
            method add takes integer i returns nothing
                set .content = I2S(S2I(.content) + i)
                call .updateField()
            endmethod
            
            method setValue takes string s returns nothing
                set .content = s
                call .updateField()
            endmethod
            
            method setPrefix takes string s returns nothing
                set .prefix = s
                call .updateField()
            endmethod
            
            method setSuffix takes string s returns nothing
                set .suffix = s
                call .updateField()
            endmethod
            
            method setColour takes string rgb returns nothing
                set .colour = rgb
                call .updateField()
            endmethod
            
            method setWidth takes real w returns nothing
                set .width = w
                call MultiboardSetItemWidth(.mbi,w)
            endmethod
            
            method showIcon takes nothing returns nothing
                set .showI = true
                call MultiboardSetItemStyle(.mbi,.showV,.showI)
            endmethod
            
            method hideIcon takes nothing returns nothing
                set .showI = false
                call MultiboardSetItemStyle(.mbi,.showV,.showI)
            endmethod
            
            method showValue takes nothing returns nothing
                set .showV = true
                call MultiboardSetItemStyle(.mbi,.showV,.showI)
            endmethod
            
            method hideValue takes nothing returns nothing
                set .showV = false
                call MultiboardSetItemStyle(.mbi,.showV,.showI)
            endmethod
            
            method setIconPath takes string s returns nothing
                set .iconpath = s
            endmethod
            
            method getValue takes nothing returns string
                return .content
            endmethod
            
            method getPrefix takes nothing returns string
                return .prefix
            endmethod
            
            method getSuffix takes nothing returns string
                return .suffix
            endmethod
            
            method getColour takes nothing returns string
                return .colour
            endmethod
            
            method getWidth takes nothing returns string
                return R2S(.width)
            endmethod
            
            method getIconPath takes nothing returns string
                return .iconpath
            endmethod
        endstruct
        
        private interface $NAME$FIELDCOLLECTION
            $NAME$ parent
            method getField takes integer i returns $NAME$FIELD
        endinterface
        
        private struct $NAME$UTILITY extends $NAME$FIELDCOLLECTION        
            stub method getField takes integer i returns $NAME$FIELD
                return 0
            endmethod
        endstruct
    
        private struct $NAME$ROW extends $NAME$UTILITY
            $NAME$FIELD array fields[$COLS$]
            integer realPos
            integer fromPlayer = -1
            
            static method create takes $NAME$ parent, integer pos returns thistype
                local thistype row = thistype.allocate()
                local integer i = 0
                set row.parent = parent
                set row.realPos = pos
                
                loop
                exitwhen i == $NAME$COLS
                    set row.fields[i] = $NAME$FIELD.create(parent,pos,i)
                    set i = i + 1
                endloop
                
                return row
            endmethod
            
            method getField takes integer i returns $NAME$FIELD
                return .fields[i]
            endmethod
        endstruct
        
        private struct $NAME$COL extends $NAME$UTILITY
            $NAME$FIELD array fields[$ROWS$]
            integer realPos
            integer fromPlayer = -1
            
            static method create takes $NAME$ parent, integer pos returns thistype
                local thistype col = thistype.allocate()
                local integer i = 0
                set col.parent = parent
                set col.realPos = pos
                
                loop
                exitwhen i == $NAME$ROWS
                    set col.fields[i] = col.parent.rows[i].fields[pos]
                    set i = i + 1
                endloop
                
                return col
            endmethod
            
            method getField takes integer i returns $NAME$FIELD
                return .fields[i]
            endmethod
        endstruct
        
        private struct $NAME$FLD extends $NAME$UTILITY
            $NAME$FIELD array fields[$NAME$SIZE]
            
            static method create takes $NAME$ parent returns thistype
                local thistype fld = thistype.allocate()
                set fld.parent = parent
                return fld
            endmethod
            
            private method hasField takes $NAME$FIELD f returns boolean
                local integer i = 0
                
                loop
                exitwhen i == .parent.selectionAmount
                    if (.fields[i] == f) then
                        return true
                    endif
                    set i = i + 1
                endloop
                
                return false
            endmethod
            
            method addFields takes $NAME$FIELDCOLLECTION f, integer amount returns nothing
                local integer i = 0
                
                loop
                exitwhen i == amount
                    if not(.hasField(f.getField(i))) then
                        set .fields[.parent.selectionAmount] = f.getField(i)
                        set .parent.selectionAmount = .parent.selectionAmount + 1
                    endif
                    
                    set i = i + 1
                endloop
            endmethod
            
            method getField takes integer i returns $NAME$FIELD
                return .fields[i]
            endmethod
        endstruct
        
        struct $NAME$ extends jBoard    
            $NAME$ROW array rows[$ROWS$]
            $NAME$COL array cols[$COLS$]
            $NAME$FLD selection
            
            static method create takes string boardName returns thistype
                local thistype board = thistype.allocate(boardName)
                local integer i = 0
                
                call MultiboardSetRowCount(board.MB,$NAME$ROWS)
                call MultiboardSetColumnCount(board.MB,$NAME$COLS)
                
                set board.selection = $NAME$FLD.create(board)
                loop
                exitwhen i == $NAME$ROWS
                    set board.rows[i] = $NAME$ROW.create(board,i)
                    set i = i + 1
                endloop
                set i = 0
                loop
                exitwhen i == $NAME$COLS
                    set board.cols[i] = $NAME$COL.create(board,i)
                    set i = i + 1
                endloop
                
                call board.initBoard()
                return board
            endmethod
            
            private method transfer takes $NAME$FIELDCOLLECTION f, integer ftype, integer amount returns nothing
                set .selectionLevel = IntegerTertiaryOp(.selectionLevel == jBoard_SELECTION_LVL_BOARD,ftype,jBoard_SELECTION_LVL_FIELDS)
                call .selection.addFields(f,amount)
            endmethod
            
            method reset takes nothing returns thistype
                set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                set .selectionAmount = 0
                return this
            endmethod
            
            method field takes integer row, integer col returns thistype
                set .selection.fields[0] = .rows[row].fields[col]
                set .selectionLevel = jBoard_SELECTION_LVL_FLD
                return this
            endmethod
            
            method getField takes integer which returns thistype
                if .selectionLevel == jBoard_SELECTION_LVL_ROW then
                    set .selection.fields[0] = .rows[.selectionSpecial].fields[which]
                elseif .selectionLevel == jBoard_SELECTION_LVL_COL then
                    set .selection.fields[0] = .cols[.selectionSpecial].fields[which]
                elseif .selectionLevel == jBoard_SELECTION_LVL_FIELDS then
                    set .selection.fields[0] = .selection.fields[which]
                elseif .selectionLevel == jBoard_SELECTION_LVL_BOARD then
                    set .selection.fields[0] = .rows[which/$NAME$COLS].fields[ModuloInteger(which,$NAME$COLS)]
                endif
                
                set .selectionLevel = jBoard_SELECTION_LVL_FLD
                return this
            endmethod
            
            method row takes integer start, integer end returns thistype
                local integer i = IntegerTertiaryOp(start<end,start,end)
                local integer j = IntegerTertiaryOp(start<end,end,start)
                
                if start == end then
                    set .selectionSpecial = start
                    call .transfer(.rows[start],jBoard_SELECTION_LVL_ROW,$NAME$COLS)
                else
                    loop
                    exitwhen i > j
                        call .transfer(.rows[i],jBoard_SELECTION_LVL_ROW,$NAME$COLS)
                        set i = i + 1
                    endloop
                endif
                
                return this
            endmethod
            
            method col takes integer start, integer end returns thistype
                local integer i = IntegerTertiaryOp(start<end,start,end)
                local integer j = IntegerTertiaryOp(start<end,end,start)
                
                if start == end then
                    set .selectionSpecial = start
                    call .transfer(.cols[start],jBoard_SELECTION_LVL_COL,$NAME$ROWS)
                else
                    loop
                    exitwhen i > j
                        call .transfer(.cols[i],jBoard_SELECTION_LVL_COL,$NAME$ROWS)
                        set i = i + 1
                    endloop
                endif
                
                return this
            endmethod
            
            method setPlayerRow takes integer p, integer row returns thistype
                set .playerRow[p] = row
                set .rows[row].fromPlayer = p
                return .row(row,row)
            endmethod
            
            method getPlayerRow takes integer p returns thistype
                return .row(.playerRow[p],.playerRow[p])
            endmethod
            
            method getPlayerRowField takes integer p, integer i returns thistype
                return .field(.playerRow[p],i)
            endmethod
            
            method setPlayerCol takes integer p, integer col returns thistype
                set .playerCol[p] = col
                set .cols[col].fromPlayer = p
                return .col(col,col)
            endmethod
            
            method getPlayerCol takes integer p returns thistype
                return .col(.playerCol[p],.playerCol[p])
            endmethod
            
            method getPlayerColField takes integer p, integer i returns thistype
                return .field(i,.playerCol[p])
            endmethod
    
            method setColour takes string rgb returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).setColour(rgb)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].setColour(rgb)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].setColour(rgb)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].setColour(rgb)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].setColour(rgb)
                endif
                
                return this
            endmethod
            
            method setWidth takes real w returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).setWidth(w)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].setWidth(w)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].setWidth(w)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].setWidth(w)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].setWidth(w)
                endif
                
                return this
            endmethod
            
            method setPrefix takes string val returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).setPrefix(val)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].setPrefix(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].setPrefix(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].setPrefix(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].setPrefix(val)
                endif
                
                return this
            endmethod
            
            method setSuffix takes string val returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).setSuffix(val)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].setSuffix(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].setSuffix(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].setSuffix(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].setSuffix(val)
                endif
                
                return this
            endmethod
            
            method setIconPath takes string val returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).setIconPath(val)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].setIconPath(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].setIconPath(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].setIconPath(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].setIconPath(val)
                endif
                
                return this
            endmethod
            
            method showIcon takes nothing returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).showIcon()
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].showIcon()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].showIcon()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].showIcon()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].showIcon()
                endif
                
                return this
            endmethod
            
            method hideIcon takes nothing returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).hideIcon()
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].hideIcon()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].hideIcon()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].hideIcon()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].hideIcon()
                endif
                
                return this
            endmethod
            
            method showValue takes nothing returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).showValue()
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].showValue()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].showValue()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].showValue()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].showValue()
                endif
                
                return this
            endmethod
            
            method hideValue takes nothing returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).hideValue()
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].hideValue()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].hideValue()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].hideValue()
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].hideValue()
                endif
                
                return this
            endmethod
            
            method setValue takes string val returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).setValue(val)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].setValue(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].setValue(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].setValue(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].setValue(val)
                endif
                
                return this
            endmethod
            
            method add takes integer val returns thistype
                local integer i = 0
                          
                if (.selectionLevel == jBoard_SELECTION_LVL_BOARD) then            
                    loop
                    exitwhen i == $NAME$ROWS
                        call .reset().row(i,i).add(val)
                        set i = i + 1
                    endloop
                    set .selectionLevel = jBoard_SELECTION_LVL_BOARD
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FIELDS) then
                    loop
                    exitwhen i == .selectionAmount
                        call .selection.fields[i].add(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_ROW) then
                    loop
                    exitwhen i == $NAME$COLS
                        call .rows[.selectionSpecial].fields[i].add(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_COL) then
                    loop
                    exitwhen i == $NAME$ROWS
                        call .cols[.selectionSpecial].fields[i].add(val)
                        set i = i + 1
                    endloop
                elseif (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    call .selection.fields[0].add(val)
                endif
                
                return this
            endmethod
            
            method getValue takes nothing returns string
                local integer i = 0
                local string s = ""
                
                if (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    set s = .selection.fields[0].getValue()
                else
                    loop
                    exitwhen i == .selectionAmount
                        set s = s + .selection.fields[i].getValue()
                        set i = i + 1
                    exitwhen i == .selectionAmount
                        set s = s + "|"
                    endloop
                endif
                
                call .reset()
                return s
            endmethod
            
            method getPrefix takes nothing returns string
                local integer i = 0
                local string s = ""
                
                if (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    set s = .selection.fields[0].getPrefix()
                else
                    loop
                    exitwhen i == .selectionAmount
                        set s = s + .selection.fields[i].getPrefix()
                        set i = i + 1
                    exitwhen i == .selectionAmount
                        set s = s + "|"
                    endloop
                endif
                
                call .reset()
                return s
            endmethod
            
            method getSuffix takes nothing returns string
                local integer i = 0
                local string s = ""
                
                if (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    set s = .selection.fields[0].getSuffix()
                else
                    loop
                    exitwhen i == .selectionAmount
                        set s = s + .selection.fields[i].getSuffix()
                        set i = i + 1
                    exitwhen i == .selectionAmount
                        set s = s + "|"
                    endloop
                endif
                
                call .reset()
                return s
            endmethod
            
            method getWidth takes nothing returns string
                local integer i = 0
                local string s = ""
                
                if (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    set s = .selection.fields[0].getWidth()
                else
                    loop
                    exitwhen i == .selectionAmount
                        set s = s + .selection.fields[i].getWidth()
                        set i = i + 1
                    exitwhen i == .selectionAmount
                        set s = s + "|"
                    endloop
                endif
                
                call .reset()
                return s
            endmethod
            
            method getColour takes nothing returns string
                local integer i = 0
                local string s = ""
                
                if (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    set s = .selection.fields[0].getColour()
                else
                    loop
                    exitwhen i == .selectionAmount
                        set s = s + .selection.fields[i].getColour()
                        set i = i + 1
                    exitwhen i == .selectionAmount
                        set s = s + "|"
                    endloop
                endif
                
                call .reset()
                return s
            endmethod
            
            method getIconPath takes nothing returns string
                local integer i = 0
                local string s = ""
                
                if (.selectionLevel == jBoard_SELECTION_LVL_FLD) then
                    set s = .selection.fields[0].getIconPath()
                else
                    loop
                    exitwhen i == .selectionAmount
                        set s = s + .selection.fields[i].getIconPath()
                        set i = i + 1
                    exitwhen i == .selectionAmount
                        set s = s + "|"
                    endloop
                endif
                
                call .reset()
                return s
            endmethod
            
            method setName takes string s returns thistype
                set .boardName = s
                call MultiboardSetTitleText(.MB,"|cff"+.boardNameColour+.boardName+"|r")
                return this
            endmethod
            
            method getName takes nothing returns string
                call .reset()
                return .boardName
            endmethod
            
            method setNameColour takes string s returns thistype
                set .boardNameColour = s
                call MultiboardSetTitleText(.MB,"|cff"+.boardNameColour+.boardName+"|r")
                return this
            endmethod
            
            method getNameColour takes nothing returns string
                call .reset()
                return .boardNameColour
            endmethod
            
            method show takes nothing returns thistype
                call MultiboardDisplay(.MB,true)
                return this
            endmethod
                
            method hide takes nothing returns thistype
                call MultiboardDisplay(.MB,false)
                return this
            endmethod
                
            method clear takes nothing returns thistype
                call MultiboardClear(.MB)
                return this
            endmethod
    
            method fold takes nothing returns thistype
                call MultiboardMinimize(.MB,true)
                return this
            endmethod
                
            method unfold takes nothing returns thistype
                call MultiboardMinimize(.MB,false)
                return this
            endmethod
            
            method setValueR takes string val returns thistype
                call .setValue(val)
                call .reset()
                return this
            endmethod
            
            method setColourR takes string rgb returns thistype
                call .setColour(rgb)
                call .reset()
                return this
            endmethod
            
            method setPrefixR takes string val returns thistype
                call .setPrefix(val)
                call .reset()
                return this
            endmethod
            
            method setSuffixR takes string val returns thistype
                call .setSuffix(val)
                call .reset()
                return this
            endmethod
            
            method setIconPathR takes string val returns thistype
                call .setIconPath(val)
                call .reset()
                return this
            endmethod
            
            method setWidthR takes real w returns thistype
                call .setWidth(w)
                call .reset()
                return this
            endmethod
            
            method addR takes integer val returns thistype
                call .add(val)
                call .reset()
                return this
            endmethod
            
            method setPlayerRowR takes integer p, integer col returns thistype
                call .setPlayerRow(p,row)
                call .reset()
                return this
            endmethod
            
            method setPlayerColR takes integer p, integer col returns thistype
                call .setPlayerCol(p,col)
                call .reset()
                return this
            endmethod
            
            method setNameR takes string s returns thistype
                call .setName(s)
                call .reset()
                return this
            endmethod
            
            method setNameColourR takes string s returns thistype
                call .setNameColour(s)
                call .reset()
                return this
            endmethod
            
            method showR takes nothing returns thistype
                call .show()
                call .reset()
                return this
            endmethod
            
            method showIconR takes nothing returns thistype
                call .showIcon()
                call .reset()
                return this
            endmethod
            
            method hideIconR takes nothing returns thistype
                call .hideIcon()
                call .reset()
                return this
            endmethod
            
            method showValueR takes nothing returns thistype
                call .showValue()
                call .reset()
                return this
            endmethod
            
            method hideValueR takes nothing returns thistype
                call .hideValue()
                call .reset()
                return this
            endmethod
            
            method hideR takes nothing returns thistype
                call .hide()
                call .reset()
                return this
            endmethod
            
            method clearR takes nothing returns thistype
                call .clear()
                call .reset()
                return this
            endmethod
            
            method foldR takes nothing returns thistype
                call .fold()
                call .reset()
                return this
            endmethod
            
            method unfoldR takes nothing returns thistype
                call .unfold()
                call .reset()
                return this
            endmethod
            
            method destroy takes nothing returns nothing
                local integer i = 0
                local integer j = 0
                
                loop
                exitwhen i == $NAME$ROWS
                    loop
                    exitwhen j == $NAME$COLS
                        call rows[i].fields[j].destroy()
                        set j = j + 1
                    endloop
                    
                    set i = i + 1
                endloop
                
                call DestroyMultiboard(.MB)
                call .deallocate()
            endmethod
        endstruct
    //! endtextmacro
    
    
    //==============================================================================
    //  ACTUAL LIBRARY
    //==============================================================================
    library jBoardLib
    
        globals
            constant integer jBoard_SELECTION_LVL_BOARD = 0
            constant integer jBoard_SELECTION_LVL_ROW = 1
            constant integer jBoard_SELECTION_LVL_COL = 2
            constant integer jBoard_SELECTION_LVL_FLD = 3
            constant integer jBoard_SELECTION_LVL_FIELDS = 4
        endglobals
    
        struct jBoard
    //! runtextmacro jBoardDefaults()
            
            multiboard MB
            string boardName
            string boardNameColour = "ffffcc"
            
            integer selectionLevel = 0
            integer selectionSpecial = 0
            integer selectionAmount = 0
            
            integer array playerRow[12]
            integer array playerCol[12]
            
            static method create takes string boardName returns jBoard
                local jBoard j = thistype.allocate()
                local integer i = 0
                    
                set  j.MB = CreateMultiboard()
                set  j.boardName = boardName
                call MultiboardSetTitleText(j.MB,boardName)
                call MultiboardDisplay(j.MB,false)
                    
                return j
            endmethod
            method initBoard takes nothing returns nothing
                call MultiboardSetItemsValue(.MB,.defaultItemValue)
                call MultiboardSetItemsIcon(.MB,.defaultIconPath)
                call MultiboardSetItemsStyle(.MB,.defaultShowValue,.defaultShowIcon)
                call MultiboardSetItemsWidth(.MB,.defaultItemWidth)
                call MultiboardDisplay(.MB,.defaultShowBoard)
            endmethod
        endstruct
    endlibrary
    //==============================================================================
    //  END OF jBoard ADVANCED MULTIBOARD SYSTEM
    //==============================================================================


    You can copy this into a map to try it out:
    JASS:
    library test initializer Init requires jBoardLib
        //! runtextmacro jBoardCreate("MyBoard","4","4")
        
        private function Actions takes nothing returns nothing
            local MyBoard mb = MyBoard.create("Some jBoard")
            call mb.setPlayerRow(0,0).setValue("1").setColourR("ff0000")
            call mb.setPlayerRow(1,1).setValue("2").setColourR("00ff00")
            call mb.setPlayerRow(2,2).setValue("3").setColourR("ffff00")
            call mb.setPlayerRow(3,3).setValue("4").setColourR("ff00ff")
            call mb.getField(3).setValueR("Sup").getField(14).setValueR("Dawg?")
        endfunction
        
        private function Init takes nothing returns nothing
            local trigger T = CreateTrigger()
            call TriggerRegisterTimerEvent(T,1.,false)
            call TriggerAddAction(T,function Actions)
        endfunction
    endlibrary


    Changelog:
    Code:
    v1.2 - Fixed unwanted behaviour of "getters" not resetting your selection
           Deleted support for commenting out newlines, added multi-line call hint instead
           Added two new functions: getPlayerRowField and getPlayerColField
             Now you can get just one field belonging to a player and add it to
             your selection instead of being bound to adding the entire row
    v1.1 - Followed method naming convention
           Added a defaultShowBoard value
    
     
    • Like Like x 2
  2. kingkingyyk3

    kingkingyyk3 Visitor (Welcome to the Jungle, Baby!)

    Ratings:
    +216 / 0 / -0
    This is better in terms of API. It is easier to use too.
     
  3. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    JASS:
    //      Since you need to create structs that represent your multiboard, jBoard
    //      needs to know the dimensions of your multiboard to ensure the structs
    //      don't take up more space than they need to.

    I don't believe this justifies having to duplicate all that code, and not allowing dynamic adding/removing of columns. I would suggest you remove the text macro interface, and replace it hashtable use, or something. Multiboards are definitely not efficiency critical...

    I haven't worked heaps with multiboards, so I'm not aware of the actual JASS limitations, though.

    Edit: Also, convention for method names is camelCase.
     
  4. Anachron

    Anachron New Member

    Ratings:
    +53 / 0 / -0
    Yes, Board by Earth-Fury is a lot better.
     
  5. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    The reason you don't get to dynamically define your multiboard's size is twofold:
    1. Speed. jBoard uses only array lookups and stores every multiboarditem once at start. Every manipulation you then execute on any item, row, col or the entire board will be way faster than hashtables or having to lookup the multiboarditem again.
    2. Most people don't change multiboard size during the game. If they want to, they can just create another jBoard
    3. It looks like "all that code" because you can't nest textmacroes. 75% of the code in there could be created with 7 lines of textmacroes...

    • jBoard allows for chaining, which is if I'm not mistaken the first vJASS library to ever do so.
    • jBoard is probably faster
    • jBoard has smart selecting calling .row(1,2).field(3,0) will let you then manipulate all fields in rows 1 and 2 AND the field in row 3, column 0 all at once. A simple -R or .reset() call and you're back to manipulating the parent jBoard

    jBoard =/= Board, doesn't mean one's de facto better than the other.


    I'll fix that
     
  6. Anachron

    Anachron New Member

    Ratings:
    +53 / 0 / -0
    Nope, I did such things before, basically because in PHP 5 you are able to do it in bigger librarys.

    No it isn't, the first benchmark of a DotA-like board did result that yours is slower.

    Board (by Earth-Fury) provides functions to get a group of objects, like a row or column in which you can edit all cells at once. So nothing new here.
     
  7. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    • Show me your benchmark please
    • A row/col isn't new indeed because blizzard.j already has functions for that. Can Board edit the contents of, for example: cell(0,0), cell(1,5), cell(7,3), in one call?

    In a DotA-like board, you could update both the team score and a player score in one call (supposing kills are kept in column 4 and team kills in row 1):
    dotaboard.getPlayerRow(1).getField(3).field(0,3).add(1)
     
  8. Anachron

    Anachron New Member

    Ratings:
    +53 / 0 / -0
    Who cares? Linking rows to players isn't new and also not effective.
    (The rows that are linked to a player can change, for example in an sorting multiboard)
     
  9. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    People that don't sort multiboards (like DotA) care
    People that want to easily update a player's score care
    Need I go on?

    Just because it doesn't suit YOUR needs or because you can't see a use for it, doesn't mean it can't suit someone else's needs


    And if you really wanted sorting, it would only take me an hour or so to add it to the system...
    P.S.: I asked for your benchmark
     
  10. Anachron

    Anachron New Member

    Ratings:
    +53 / 0 / -0
    Don't get rude.

    Well DotA != good.

    Well, what if you have not only one Row for your player?
    What if you have for example, like in DotAs End-Board, player columns?

    Well, it's okay I guess, but the player-row feature isn't that good.

    Then add it please.

    You only need to check the number of actions you execute.
     
  11. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    Oh my, you are so wrong here...
    Board refetches the multiboarditem every time you want to manipulate it, that's a native doing something behind the scenes.
    All jBoard does, is an array lookup.

    Array lookups >>> natives
    My guess is you didn't really benchmark it, now did you?

    As for DotA endboard: I also have a player-column function.
    I suppose I could add sorting (was going to in a future release anyhow)

    But why do you criticise me for not having sorting functionality when Board doesn't seem to have it either?

    By the way:
    The player column/row system is to help people who don't need complicated jBoards. You don't have to use it, you just can.. Want more than one column per player? Store your own globals...
     
  12. Anachron

    Anachron New Member

    Ratings:
    +53 / 0 / -0
    Same goes for Board.

    Sounds neat.

    Because Board doesn't have the player bounded functionality. So it doesn't have to provide the sort functionality that updates the player linked rows.

    Sounds fair enough. I guess I might give it a try. Anyway, good job on making it.
     
  13. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    Board calls MultiboardGetItem every time...

    Please do, if any function requests pop up during testing, I'll try to add them
     
  14. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    Fixed a minor bug and added two cool new selectors.
     
  15. Ghan

    Ghan Administrator - Servers are fun Staff Member

    Ratings:
    +773 / 0 / -0
    Approved.
     
  16. Chaos_Knight

    Chaos_Knight New Member

    Ratings:
    +39 / 0 / -0
    Wow. +rep.
     
  17. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    I'm working on a new version that doesn't require textmacroes by the way...
    Expect to release it soon(tm)
     
  18. Chaos_Knight

    Chaos_Knight New Member

    Ratings:
    +39 / 0 / -0
    So amazing. So simple to use. This is awsome. Maybe add a function that enables the user to check Players Hero kills. (Very useful for Hero Arenas) :D
     
  19. Chaos_Knight

    Chaos_Knight New Member

    Ratings:
    +39 / 0 / -0
    How do i create a multiboard that checks players death and kills?
     
  20. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
    Check on unit death event, register the killer and dying unit's owner to the multiboard. (Using player rows for example)
     

Share This Page