Magentix
if (OP.statement == false) postCount++;
- Reaction score
- 107
I will use this thread to put all mods in for my Advanced Multiboard System,
which can be found here: http://www.thehelper.net/forums/showthread.php?p=591918
These mods are far easier to configure for the less experienced JASSer and perhaps even the GUI people.
I encourage people to make their own mods for AMS!
Credit will be yours, as will I answer questions about AMS itself.
amsTS: Team Scores
Code:
Screenshot (default example):
Specific limitations:
When to use this mod:
If you have a map where you want to simply keep track of kills, lives, deaths, etc of several equal teams and their players, this is your mod.
It allows for increasing or decreasing the scores for each player on the board, as does it allow for teams to have their name displayed above the team's players.
which can be found here: http://www.thehelper.net/forums/showthread.php?p=591918
These mods are far easier to configure for the less experienced JASSer and perhaps even the GUI people.
I encourage people to make their own mods for AMS!
Credit will be yours, as will I answer questions about AMS itself.
amsTS: Team Scores
- Makes a scoreboard for one or more teams
- Very adjustable in size, team amount and colors
- Has an easy function to increase or decrease a player's score
- Creates a nice scoreboard at the start of a game
- Easy to implement
Code:
JASS:
//////////////////////////////////////////////////////////////////////////////
// //
// TEAM SCORES - v1.01 //
// A MAGENTIX' AMS MOD BY MAGENTIX //
// //
// Requires vJASS, Magentix' AMS & Cohadar's ABC //
// //
//==========================================================================//
// //
// 1) CONFIGURATION: //
// ================= //
// - Create a trigger, name doesn't matter //
// - Go to Edit -> Convert to Custom Text //
// - Copy-Paste this entire piece of code over the generated text //
// //
// //
// 2) INSTRUCTIONS: //
// ================ //
// Configure the variables at the bottom of these instructions. //
// ALWAYS start arrays from 0 (arrays are: TEAM_NAME, TEAM_COLOR, etc.) //
// //
// This mod will automaticly create an AMS for you by the name of: //
// --> amsTS <-- //
// You can use this reference name to manipulate the Multiboard further, //
// using AMS functions, should you feel the need to. //
// //
// //
// 3) FUNCTION LIST: //
// ================= //
// Only two functions: //
// amsTS_IncreaseScore(Player,Tag,Amount) //
// amsTS_FetchScore(Player,Tag) // CURRENTLY JASS ONLY! //
// //
// Remember: 0 = player 1, 1 = player 2, etc. //
// You may use a negative Amount to decrease score //
// What a tag is will become clear while configuring TS //
// //
// //
// 4) DETAILED GUIDE FOR THE NON-JASS PEOPLE: //
// ========================================== //
// Go to <a href="http://www.thehelper.net/forums/showthread.php?p=591918" class="link link--internal">http://www.thehelper.net/forums/showthread.php?p=591918</a> //
// to find the latest version of AMS and ABC //
// //
// Create 3 Triggers: AMS, ABC and amsTS and for all three, choose: //
// Edit -> Convert to custom text //
// //
// Delete everything that's generated and paste the 3 systems into the //
// correct triggers. //
// //
// Configure the variables below //
// //
// To increase a player's score (deaths, kills, whatever..) in GUI //
// (= General User Interface), use the Custom Script action: //
// //
// Custom script: call amsTS_IncreaseScore(x,y,z) //
// Where x = the player number //
// y = the tag number //
// z = the amount (may be negative) //
// //
// Remember: player and tag starts counting from 0! //
// //
// //
//==========================================================================//
// //
// PLEASE GIVE CREDIT WHEN USING THIS SYSTEM //
// //
//////////////////////////////////////////////////////////////////////////////
//! textmacro AMS_TeamScores_Configuration
//==============================================================================
// CONFIGURE YOUR SCOREBOARD HERE
//==============================================================================
//
// First of all: choose the lay-out of your scoreboard.
set ENABLE_TAG_TITLES = true
set ENABLE_PLAYER_COLORS = false
set ENABLE_TEAM_NAMES = true
set ENABLE_TEAM_COLORS = false
set ENABLE_TEAM_SORTING = false
//COMING SOON: set ENABLE_TEAM_SCORES = false
//COMING SOON: set ENABLE_DEBUG_LINE = false
//
// EXPERIMENTAL: Function that automaticly adjusts colum widths to center scores
set ENABLE_AUTO_LAYOUT = false
//
//
// Set the title for the scoreboard
set TITLE = "2 Teams Example: DotA"
//
//
//
// Set the amount of teams and players for each team
// Team 1 starts with player red and subsequent teams start where the previous team ended
// While defining the team names and colors, make sure you start counting from 0
set TEAM_AMOUNT = 2
set PLAYERS_PER_TEAM = 5
set TEAM_NAME[0] = "The Sentinel:"
set TEAM_NAME[1] = "The Scourge:"
set TEAM_COLOR[0] = "FF0000"
set TEAM_COLOR[1] = "00FF00"
//
//
//
// Set the amount of scores you want to keep track of for every player
// While defining the tags, make sure you start counting from 0
set TAGS_PER_PLAYER = 2
set TAG[0] = "[Kills]"
set TAG_DEFAULT_VALUE[0] = "10"
set TAG[1] = "[Deaths]"
set TAG_DEFAULT_VALUE[1] = "10"
//
//
//
// Set whether you want the scoreboard to be static or get sorted by kills, deaths, etc...
// When setting ENABLE_TEAM_SORTING to true, remove the "//" before SORT_TEAMS_BY_TAG and SORT_ASCENDING
set SORT_TEAMS_BY_TAG = 1
set SORT_ASCENDING = false
//
//
//==============================================================================
// DO NOT EDIT BEYOND THIS POINT
//==============================================================================
//! endtextmacro
library amsTS initializer Init requires AMS
globals
Multiboard amsTS
private string TITLE
private string array TAG
private string array TAG_DEFAULT_VALUE
private string array TEAM_NAME
private string array TEAM_COLOR
private integer TEAM_AMOUNT
private integer PLAYERS_PER_TEAM
private integer TAGS_PER_PLAYER
private integer SORT_TEAMS_BY_TAG
private boolean SORT_ASCENDING
private boolean ENABLE_TAG_TITLES
private boolean ENABLE_PLAYER_COLORS
private boolean ENABLE_TEAM_SORTING
private boolean ENABLE_TEAM_NAMES
private boolean ENABLE_TEAM_COLORS
private boolean ENABLE_TEAM_SCORES
private boolean ENABLE_DEBUG_LINE
private boolean ENABLE_AUTO_LAYOUT
endglobals
private function Actions takes nothing returns nothing
local integer rows = 0
local integer max = 0
local integer first_max = 0
local integer i = 0
local integer j
// Calculate the total rows
if (ENABLE_TEAM_NAMES) then
set rows = rows + TEAM_AMOUNT
endif
if (ENABLE_TAG_TITLES) then
set rows = rows + 2
endif
set rows = rows + (TEAM_AMOUNT * PLAYERS_PER_TEAM) + (TEAM_AMOUNT-1)
// Create the AMS Multiboard
set amsTS = Multiboard.Create(TITLE,rows,TAGS_PER_PLAYER+1,true,true,false,5)
// Set the tag title row
if (ENABLE_TAG_TITLES) then
set i = 1
loop
exitwhen i > TAGS_PER_PLAYER
call amsTS.SetItem(1,i+1,TAG[i-1])
call amsTS.SetItemColor(1,i+1,"FFCC00")
set i = i + 1
endloop
set i = 0
endif
// Set the team titles and players
set j = 1
if (ENABLE_TAG_TITLES) then
set j = 3
endif
loop
exitwhen i == TEAM_AMOUNT
if (ENABLE_TEAM_NAMES) then
call amsTS.SetItem(j,1,TEAM_NAME<i>)
if (ENABLE_TEAM_COLORS) then
call amsTS.SetItemColor(j,1,TEAM_COLOR<i>)
else
call amsTS.SetItemColor(j,1,"FFCC00")
endif
set j = j + 1
endif
call amsTS.AddPlayers(0+(PLAYERS_PER_TEAM * i),PLAYERS_PER_TEAM,j,1,ENABLE_PLAYER_COLORS)
set j = j + PLAYERS_PER_TEAM + 1
set i = i + 1
endloop
set i = 0
// Fill in the default tag values
loop
exitwhen i == (PLAYERS_PER_TEAM * TEAM_AMOUNT)
set j = 1
loop
exitwhen j > TAGS_PER_PLAYER
call amsTS.SetPlayerItem(i,j+1,TAG_DEFAULT_VALUE[j-1])
set j = j + 1
endloop
set i = i + 1
endloop
// Sort teams if enabled
if (ENABLE_TEAM_SORTING) then
set j = 0
set i = 0
if (ENABLE_TAG_TITLES) then
set j = 2
endif
loop
exitwhen i == TEAM_AMOUNT
if (ENABLE_TEAM_NAMES) then
set j = j + 1
endif
call amsTS.SortRows(j,j+PLAYERS_PER_TEAM-1,2+SORT_TEAMS_BY_TAG,0.10,SORT_ASCENDING)
set j = j + PLAYERS_PER_TEAM + 1
set i = i + 1
endloop
endif
set j = 1
// Automaticly define the width of every column
if (ENABLE_AUTO_LAYOUT) then
loop
exitwhen j > 1 + TAGS_PER_PLAYER
set i = 1
loop
exitwhen i > rows
if (StringLength(amsTS.GetItem(i,j)) > max) then
set max = StringLength(amsTS.GetItem(i,j))
endif
set i = i + 1
endloop
set i = 1
if (j == 1) then
loop
exitwhen i > rows
call amsTS.SetItemWidth(i,j,(max/2.00)+3.00)
set i = i + 1
endloop
set first_max = max
set max = 0
endif
set j = j + 1
endloop
set j = 2
loop
exitwhen j > 1 + TAGS_PER_PLAYER
set i = 1
loop
exitwhen i > rows
if (j < TAGS_PER_PLAYER + 1) then
call amsTS.SetItemWidth(i,j,(max/2.10)+0.50)
else
call amsTS.SetItemWidth(i,j,max/2.10)
endif
if (i > 2 and ENABLE_TAG_TITLES and j == 2) then
call amsTS.SetItemWidth(i,1,(first_max/2.00) + 3.00 + ((max/2.10)/2))
endif
set i = i + 1
endloop
set j = j + 1
endloop
else
loop
exitwhen j > 1 + TAGS_PER_PLAYER
set i = 1
loop
exitwhen i > rows
if (StringLength(amsTS.GetItem(i,j)) > max) then
set max = StringLength(amsTS.GetItem(i,j))
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > rows
if (j == 1) then
call amsTS.SetItemWidth(i,j,(max/2.00)+3.00)
else
if (j < TAGS_PER_PLAYER + 1) then
call amsTS.SetItemWidth(i,j,(max/2.00)+1.00)
else
call amsTS.SetItemWidth(i,j,max/2.00)
endif
endif
set i = i + 1
endloop
set max = 0
set j = j + 1
endloop
endif
// Refreshes the multiboard
call amsTS.Fold()
call amsTS.Unfold()
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function amsTS_IncreaseScore takes integer p, integer tag, integer amount returns nothing
call amsTS.SetPlayerItem(p,2+tag,I2S(S2I(amsTS.GetPlayerItem(p,2+tag))+amount))
endfunction
function amsTS_FetchScore takes integer p, integer tag returns integer
return S2I(amsTS.GetPlayerItem(p,2+tag))
endfunction
private function Init takes nothing returns nothing
local trigger T = CreateTrigger()
call TriggerRegisterTimerEventSingle(T, 0.00)
call TriggerAddAction(T, function Actions)
set T = null
//! runtextmacro AMS_TeamScores_Configuration()
endfunction
endlibrary</i></i>
Screenshot (default example):
Specific limitations:
- Teams have to be equal
- Scores can only be increased/decreased
When to use this mod:
If you have a map where you want to simply keep track of kills, lives, deaths, etc of several equal teams and their players, this is your mod.
It allows for increasing or decreasing the scores for each player on the board, as does it allow for teams to have their name displayed above the team's players.