//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
//First, create your global board(s)
BoardEx rem //for now I'm gonna use this instance, but you must use this by:
//set rem = rem.create(rowQty, columnQty, showtexts, showicons)
//see the GUI trigger "SetupBoard RemainingUnits GUI" for more info and setup
//============================
//You can create more boards up to 8191
//Im not gonna focus on the created BoardEx below coz
//this just gives you an example on how to create them
BoardEx kills
BoardEx xxx
BoardEx saved
BoardEx etc
endglobals
Name | Type | is_array | initial_value |
Index | integer | No | |
Remaining | integer | Yes |
//TESH.scrollpos=266
//TESH.alwaysfold=0
[B][SIZE="3"]BoardEx: v1.4[/SIZE][/B]
Actually this is a Multiboard System and the Ex means extra system which is the ColoredText, these systems are very
simple and GUI'ers can use this with ease.
Please read carefully the instructions on how to use this.
[hidden=BoardEx (Main System)]
[jass]
/*
=====BoardEx v1.5
=====Made by: Mckill2009
This is just a Multiboard System, simple to use even for GUIer's
INSTALLATION:
- Copy and Paste the "BoardEx" trigger to your map.
- Read the instructions. DONE!
API:
static method create takes integer rowQty, integer columnQty, boolean showtexts, boolean showicons returns thistype
method setTitle takes string s returns nothing
method setAllWidth takes real width returns nothing
method setIndividualWidths takes integer row, integer column, real width returns nothing
method showValues takes integer row, integer column, boolean showtext, boolean showicon returns nothing
method display takes boolean minimize, boolean show returns nothing
method setIcon takes integer row, integer column, string iconpath returns nothing
method setText takes integer row, integer column, string text returns nothing
method destroy takes nothing returns nothing
*/
library BoardEx
struct BoardEx extends array
private multiboard MB
private static constant integer boardLimit = 8191
private static multiboarditem boardItem = null
private static thistype countBoard = 0
//===This is the first thing you need to do, setting up the multiboard
//===Take note that this allocates a new index
static method create takes integer rowQty, integer columnQty, boolean showtexts, boolean showicons returns thistype
local thistype this
if countBoard==boardLimit then
debug call BJDebugMsg("boardSetUp ERROR: Maximum exceeded: "+I2S(boardLimit))
else
set countBoard = countBoard + 1
set this = countBoard
set .MB = CreateMultiboard()
call .display(false,true)
call MultiboardSetColumnCount(.MB, columnQty)
call MultiboardSetRowCount(.MB, rowQty)
call MultiboardSetItemsStyle(.MB, showtexts, showicons)
endif
return this
endmethod
method setTitle takes string s returns nothing
call MultiboardSetTitleText(.MB, s)
endmethod
//===Sets all width of the multiboard in uniform order, real value should be 0.1 or less
method setAllWidth takes real width returns nothing
call MultiboardSetItemsWidth(.MB, width)
endmethod
//===Sets individual widths, real value should be 0.1 or less
method setIndividualWidths takes integer row, integer column, real width returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemWidth(boardItem, width)
call MultiboardReleaseItem(boardItem)
endmethod
//===Show/Hide values such as text or icons
method showValues takes integer row, integer column, boolean showtext, boolean showicon returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemStyle(boardItem, showtext, showicon)
call MultiboardReleaseItem(boardItem)
endmethod
//===Maximize/Minimize, Show/Hide multiboard
method display takes boolean minimize, boolean show returns nothing
call MultiboardDisplay(.MB, show)
call MultiboardMinimize(.MB, minimize)
endmethod
//===Change the icon, showicon from the showValues must be true
method setIcon takes integer row, integer column, string iconpath returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemIcon(boardItem, iconpath)
call MultiboardReleaseItem(boardItem)
endmethod
//===This is the MAIN multiboard value and text change
method setText takes integer row, integer column, string text returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemValue(boardItem, text)
call MultiboardReleaseItem(boardItem)
endmethod
//===destroys the 'this' (indexed) multiboard
method destroy takes nothing returns nothing
call MultiboardClear(.MB)
call DestroyMultiboard(.MB)
set .MB = countBoard.MB
set countBoard = countBoard - 1
endmethod
endstruct
endlibrary
[/jass]
[hidden=Instructions and Sample Trigger:]
[jass]
globals
//First, create your global board(s)
BoardEx rem //for now I'm gonna use this instance, but you must use this by:
//set rem = rem.create(rowQty, columnQty, showtexts, showicons)
//see the GUI trigger "SetupBoard RemainingUnits GUI" for more info and setup
//============================
//You can create more boards up to 8191
//Im not gonna focus on the created BoardEx below coz
//this just gives you an example on how to create them
BoardEx kills
BoardEx xxx
BoardEx saved
BoardEx etc
endglobals
[/jass]
[trigger]
SetupBoard RemainingUnits GUI
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
-------- Read the map header script instructions before you proceed --------
-------- Map header scripts can be found far above this trigger when you can see the BoardEx.w3x --------
-------- Let's make an instance of the rem variable --------
Custom script: set rem = rem.create(6,2,true,true)
-------- The 'rem' is your global reference in accessing the BoardEx multiboards --------
-------- So let's set this up --------
Custom script: call rem.setTitle("RemainingUnits")
Custom script: call rem.setText(0,0,"Player Name")
Custom script: call rem.setText(0,1,"Remaining Units")
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Set Index = (Index + 1)
Custom script: call rem.setText(udg_Index, 0,"Player "+I2S(udg_Index))
Custom script: call rem.setText(udg_Index, 1,I2S(udg_Remaining[udg_Index]))
-------- resetting the index to zero --------
Set Index = 0
-------- the rows is 6 so we need to set the loop at 6 --------
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
-------- setting the width for each column, it should ne be greater than 0.1 --------
Custom script: call rem.setIndividualWidths(udg_Index,0,0.05)
Custom script: call rem.setIndividualWidths(udg_Index,1,0.05)
Set Index = (Index + 1)
Set Index = 0
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Custom script: call rem.setIcon(udg_Index,0,"ReplaceableTextures\\CommandButtons\\BTNPriestAdept.blp")
Custom script: call rem.setIcon(udg_Index,1,"ReplaceableTextures\\CommandButtons\\BTNHumanMissileUpOne.blp")
Set Index = (Index + 1)
-------- maximizes the multiboard and shows texts --------
Custom script: call rem.display(false,true)
[/trigger]
UPDATING USING COLORED TEXT:
[trigger]
RemainingUnits DEMO GUI
Events
Unit - A unit Dies
Conditions
Actions
Set Index = (Player number of (Triggering player))
Set Remaining[Index] = (Remaining[Index] - 1)
-------- updating the units remaining, the row and column in multiboard starts with 0 --------
Custom script: call rem.setText(udg_Index, 1, ColoredText.ctRandomColor(I2S(udg_Remaining[udg_Index])))
[/trigger]
[/hidden]
[/hidden]
[hidden=ColoredText (Sub System)]
[jass]
/*
===ColoredText v1.0
===Made by Mckill2009
This system colors your text using a hex code or web code, a sample of a web code format
can be seen in your object edidor like the War Stomp ability.
- Learn War S|cffffcc00t|romp - [|cffffcc00Level %d|r].
The "ffcc00" is a hex code, colored as yellow or yellow orange. There are tons of hex codes
that you can browse on the web like.
- [url]http://en.wikipedia.org/wiki/Web_colors[/url]
You may color your systems like quests, leaderboard, multiboard, texttag etc...
API:
static method ctFixedColor takes string fixedHexColor, string text returns string
static method ctRandomColor takes string text returns string
HOW TO USE:
local string coloredText = ColoredText.ctFixedColor("00f5ff","I AM TEAL!")
call BJDebugMsg(coloredText) //this displays the colored text which is teal
*/
library ColoredText
globals
private string array sID
endglobals
struct ColoredText extends array
static method ctFixedColor takes string fixedHexColor, string text returns string
return "|cff"+ fixedHexColor + text + "|r"
endmethod
static method ctRandomColor takes string text returns string
local integer a = GetRandomInt(0,15)
local integer b = GetRandomInt(0,15)
local integer c = GetRandomInt(0,15)
local integer d = GetRandomInt(0,15)
local integer e = GetRandomInt(0,15)
local integer f = GetRandomInt(0,15)
return "|cff"+sID[a]+sID[b]+sID[c]+sID[d]+sID[e]+sID[f]+text + "|r"
endmethod
private static method onInit takes nothing returns nothing
set sID[0] = "0"
set sID[1] = "1"
set sID[2] = "2"
set sID[3] = "3"
set sID[4] = "4"
set sID[5] = "5"
set sID[6] = "6"
set sID[7] = "7"
set sID[8] = "8"
set sID[9] = "9"
set sID[10] = "a"
set sID[11] = "b"
set sID[12] = "c"
set sID[13] = "d"
set sID[14] = "e"
set sID[15] = "f"
endmethod
endstruct
endlibrary
[/jass]
[hidden=ColoredText Sample Trigger:]
[trigger]
ColoredText DEMO GUI
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
-------- Fixed color texts --------
Custom script: call BJDebugMsg(ColoredText.ctFixedColor("0000ff","I AM BLUE!"))
Custom script: call BJDebugMsg(ColoredText.ctFixedColor("ff0000","I AM RED!"))
Custom script: call BJDebugMsg(ColoredText.ctFixedColor("ffff00","I AM YELLOW!"))
Custom script: call BJDebugMsg(ColoredText.ctFixedColor("EE9A00","I AM ORANGE!"))
Custom script: call BJDebugMsg(ColoredText.ctFixedColor("00f5ff","I AM TEAL!"))
-------- Random colored texts --------
For each (Integer A) from 1 to 7, do (Actions)
Loop - Actions
Custom script: call BJDebugMsg(ColoredText.ctRandomColor("RANDOM COLORS"))
[/trigger]
[/hidden]
[/hidden]
[hidden=Credits and Changelogs]
Credits:
-
Changelogs:
v1.5
- Added extends array which behaves less accurate (suggested by Magtheridon96)
[quote=Magtheridon96]
When you deallocate, destroy the multiboard, and set this.multiboard = count.multiboard, then decrease count by 1.
[/quote]
v1.4
- Static methods replaced by methods
v1.3
- API changed names
v1.2
- boardDestroy changed
v1.1
- Multiboard is now arrayed which means you can have up to boardLimit(8190 MAX) at the same time but displays at a time only.
- boardEdit removed and replaced by boardDestroy.
[/hidden]
//TESH.scrollpos=9
//TESH.alwaysfold=0
/*
===ColoredText v1.0
===Made by Mckill2009
This system colors your text using a hex code or web code, a sample of a web code format
can be seen in your object edidor like the War Stomp ability.
- Learn War S|cffffcc00t|romp - [|cffffcc00Level %d|r].
The "ffcc00" is a hex code, colored as yellow or yellow orange. There are tons of hex codes
that you can browse on the web like.
- http://en.wikipedia.org/wiki/Web_colors
You may color your systems like quests, leaderboard, multiboard, texttag etc...
API:
static method ctFixedColor takes string fixedHexColor, string text returns string
static method ctRandomColor takes string text returns string
HOW TO USE:
local string coloredText = ColoredText.ctFixedColor("00f5ff","I AM TEAL!")
call BJDebugMsg(coloredText) //this displays the colored text which is teal
*/
library ColoredText
globals
private string array sID
endglobals
struct ColoredText extends array
static method ctFixedColor takes string fixedHexColor, string text returns string
return "|cff"+ fixedHexColor + text + "|r"
endmethod
static method ctRandomColor takes string text returns string
local integer a = GetRandomInt(0,15)
local integer b = GetRandomInt(0,15)
local integer c = GetRandomInt(0,15)
local integer d = GetRandomInt(0,15)
local integer e = GetRandomInt(0,15)
local integer f = GetRandomInt(0,15)
return "|cff"+sID[a]+sID[b]+sID[c]+sID[d]+sID[e]+sID[f]+text + "|r"
endmethod
private static method onInit takes nothing returns nothing
set sID[0] = "0"
set sID[1] = "1"
set sID[2] = "2"
set sID[3] = "3"
set sID[4] = "4"
set sID[5] = "5"
set sID[6] = "6"
set sID[7] = "7"
set sID[8] = "8"
set sID[9] = "9"
set sID[10] = "a"
set sID[11] = "b"
set sID[12] = "c"
set sID[13] = "d"
set sID[14] = "e"
set sID[15] = "f"
endmethod
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
struct ColoredTextDEMO
static method ac takes nothing returns nothing
local integer i = 0
call BJDebugMsg(ColoredText.ctFixedColor("0000ff","I AM BLUE!"))
call BJDebugMsg(ColoredText.ctFixedColor("ff0000","I AM RED!"))
call BJDebugMsg(ColoredText.ctFixedColor("ffff00","I AM YELLOW!"))
call BJDebugMsg(ColoredText.ctFixedColor("EE9A00","I AM ORANGE!"))
call BJDebugMsg(ColoredText.ctFixedColor("00f5ff","I AM TEAL!"))
loop
call BJDebugMsg(ColoredText.ctRandomColor("RANDOM COLORS"))
set i = i + 1
exitwhen i==7
endloop
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventSingle(t, 0.00 )
call TriggerAddAction(t, function ColoredTextDEMO.ac)
endmethod
endstruct
//TESH.scrollpos=77
//TESH.alwaysfold=0
/*
=====BoardEx v1.5
=====Made by: Mckill2009
This is just a Multiboard System, simple to use even for GUIer's
INSTALLATION:
- Copy and Paste the "BoardEx" trigger to your map.
- Read the instructions. DONE!
API:
static method create takes integer rowQty, integer columnQty, boolean showtexts, boolean showicons returns thistype
method setTitle takes string s returns nothing
method setAllWidth takes real width returns nothing
method setIndividualWidths takes integer row, integer column, real width returns nothing
method showValues takes integer row, integer column, boolean showtext, boolean showicon returns nothing
method display takes boolean minimize, boolean show returns nothing
method setIcon takes integer row, integer column, string iconpath returns nothing
method setText takes integer row, integer column, string text returns nothing
method destroy takes nothing returns nothing
*/
library BoardEx
struct BoardEx extends array
private multiboard MB
private static constant integer boardLimit = 8191
private static multiboarditem boardItem = null
private static thistype countBoard = 0
//===This is the first thing you need to do, setting up the multiboard
//===Take note that this allocates a new index
static method create takes integer rowQty, integer columnQty, boolean showtexts, boolean showicons returns thistype
local thistype this
if countBoard==boardLimit then
debug call BJDebugMsg("boardSetUp ERROR: Maximum exceeded: "+I2S(boardLimit))
else
set countBoard = countBoard + 1
set this = countBoard
set .MB = CreateMultiboard()
call .display(false,true)
call MultiboardSetColumnCount(.MB, columnQty)
call MultiboardSetRowCount(.MB, rowQty)
call MultiboardSetItemsStyle(.MB, showtexts, showicons)
endif
return this
endmethod
method setTitle takes string s returns nothing
call MultiboardSetTitleText(.MB, s)
endmethod
//===Sets all width of the multiboard in uniform order, real value should be 0.1 or less
method setAllWidth takes real width returns nothing
call MultiboardSetItemsWidth(.MB, width)
endmethod
//===Sets individual widths, real value should be 0.1 or less
method setIndividualWidths takes integer row, integer column, real width returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemWidth(boardItem, width)
call MultiboardReleaseItem(boardItem)
endmethod
//===Show/Hide values such as text or icons
method showValues takes integer row, integer column, boolean showtext, boolean showicon returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemStyle(boardItem, showtext, showicon)
call MultiboardReleaseItem(boardItem)
endmethod
//===Maximize/Minimize, Show/Hide multiboard
method display takes boolean minimize, boolean show returns nothing
call MultiboardDisplay(.MB, show)
call MultiboardMinimize(.MB, minimize)
endmethod
//===Change the icon, showicon from the showValues must be true
method setIcon takes integer row, integer column, string iconpath returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemIcon(boardItem, iconpath)
call MultiboardReleaseItem(boardItem)
endmethod
//===This is the MAIN multiboard value and text change
method setText takes integer row, integer column, string text returns nothing
set boardItem = MultiboardGetItem(.MB, row, column)
call MultiboardSetItemValue(boardItem, text)
call MultiboardReleaseItem(boardItem)
endmethod
//===destroys the 'this' (indexed) multiboard
method destroy takes nothing returns nothing
call MultiboardClear(.MB)
call DestroyMultiboard(.MB)
set .MB = countBoard.MB
set countBoard = countBoard - 1
endmethod
endstruct
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
struct testMB
static BoardEx mb1
static BoardEx mb2
static BoardEx mb3
static BoardEx mb4
static BoardEx mb5
static BoardEx mb6
static BoardEx mb7
static integer check = 0
static boolean b = true
static method displayMB takes nothing returns nothing
if check==1 then
call mb1.display(false,true)
elseif check==2 then
call mb2.display(false,true) //will be destroyed
elseif check==3 then
call mb3.display(false,true)
elseif check==4 then
call rem.display(false,true)
elseif check==5 then
call mb4.display(false,true)
elseif check==6 then
call mb5.display(false,true) //will be destroyed
elseif check==7 then
call mb6.display(false,true)
elseif check==8 then
call mb7.display(false,true) //will be destroyed
elseif check==9 then
if b then
call BJDebugMsg("DESTROYED")
set b = false
call mb5.destroy()
call mb2.destroy()
call mb7.destroy()
endif
set check = 0
endif
set check = check + 1
endmethod
static method tim takes nothing returns nothing
set mb1 = mb1.create(1,1,true,true)
set mb2 = mb2.create(1,1,true,true)
set mb3 = mb3.create(1,1,true,true)
set mb4 = mb4.create(1,1,true,true)
set mb5 = mb5.create(1,1,true,true)
set mb6 = mb6.create(1,1,true,true)
set mb7 = mb7.create(1,1,true,true)
call mb1.setTitle("BoardEx 1")
call mb2.setTitle("BoardEx 2")
call mb3.setTitle("BoardEx 3")
call mb4.setTitle("BoardEx 4")
call mb5.setTitle("BoardEx 5")
call mb6.setTitle("BoardEx 6")
call mb7.setTitle("BoardEx 7")
call mb1.setIcon(0,0,"ReplaceableTextures\\CommandButtons\\BTNWallOfFire.blp")
call mb2.setIcon(0,0,"ReplaceableTextures\\CommandButtons\\BTNAvatar.blp")
call mb3.setIcon(0,0,"ReplaceableTextures\\CommandButtons\\BTNSlow.blp")
call TimerStart(CreateTimer(),1.0,true,function thistype.displayMB)
endmethod
static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(),0,false,function thistype.tim)
endmethod
endstruct