System All Magentix' AMS modifications

Status
Not open for further replies.

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

  • 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 -&gt; Convert to custom text                                        //
//                                                                          //
//    Delete everything that&#039;s generated and paste the 3 systems into the   //
//    correct triggers.                                                     //
//                                                                          //
//    Configure the variables below                                         //
//                                                                          //
//    To increase a player&#039;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                 = &quot;2 Teams Example: DotA&quot;
//
//
//
// 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]          = &quot;The Sentinel:&quot;
    set TEAM_NAME[1]          = &quot;The Scourge:&quot;
    set TEAM_COLOR[0]         = &quot;FF0000&quot;
    set TEAM_COLOR[1]         = &quot;00FF00&quot;
//   
// 
//
// 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]                = &quot;[Kills]&quot;
    set TAG_DEFAULT_VALUE[0]  = &quot;10&quot;
    set TAG[1]                = &quot;[Deaths]&quot;
    set TAG_DEFAULT_VALUE[1]  = &quot;10&quot;
//    
//
//
// 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 &quot;//&quot; 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 &gt; TAGS_PER_PLAYER
            call amsTS.SetItem(1,i+1,TAG[i-1])
            call amsTS.SetItemColor(1,i+1,&quot;FFCC00&quot;)
            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,&quot;FFCC00&quot;)
            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 &gt; 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 &gt; 1 + TAGS_PER_PLAYER
            set i = 1 
            loop
            exitwhen i &gt; rows
                if (StringLength(amsTS.GetItem(i,j)) &gt; 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 &gt; 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 &gt; 1 + TAGS_PER_PLAYER
            set i = 1
            loop
            exitwhen i &gt; rows
                if (j &lt; 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 &gt; 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 &gt; 1 + TAGS_PER_PLAYER
            set i = 1
             
            loop
            exitwhen i &gt; rows
                if (StringLength(amsTS.GetItem(i,j)) &gt; max) then
                    set max = StringLength(amsTS.GetItem(i,j))
                endif
                set i = i + 1
            endloop
            set i = 1
            
            loop
            exitwhen i &gt; rows
                if (j == 1) then
                    call amsTS.SetItemWidth(i,j,(max/2.00)+3.00)
                else
                    if (j &lt; 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):
amstsexamplegw0.jpg

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.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
I recomend you change the name. AMS already means Anti Map-Hack System. :)

AMS has been the name since November, they should make Anti Map-Hack System be called AMHS, since I'm not changing it anymore ;)

P.S.: I thought it was "Anti-MH"?


Anyhow, on topic:

The goal is to create an easy multiboard creation environment for people of all World Edit skill levels.
With amsTS, I hope to have set the first step in that direction.
 

Hero

─║╣ero─
Reaction score
250
I recomend you change the name. AMS already means Anti Map-Hack System. :)

Then I think Anti Map-Hack System should change it's name to AMHS

Cause AMS= Advanced Multiboard System

Thats must easier to remember

Anyways looks good.
 

Cohadar

master of fugue
Reaction score
209
I always get terrified when I see your monster length code.

Anyways I was going to ask you to make me a mod for Pyramidal Defence.

I want it to display gold and lumber players currently have.
+2 team rows displaying lives left for each team.
+ one special row for displaying handle count (for debugging purposes)
 

Demi666

New Member
Reaction score
127
what if the teams isnt suppose to be even? like in a tagteam map, maybe 9vs2 how do i do then?



JASS:
set PLAYERS_PER_TEAM      = 5
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
what if the teams isnt suppose to be even? like in a tagteam map, maybe 9vs2 how do i do then?



JASS:
set PLAYERS_PER_TEAM      = 5

That, my friend is a good starting point for working out an update of this mod ;)
I'll look into it.

I always get terrified when I see your monster length code.
Anyways I was going to ask you to make me a mod for Pyramidal Defence.

I want it to display gold and lumber players currently have.
+2 team rows displaying lives left for each team.
+ one special row for displaying handle count (for debugging purposes)

If you can give me the exact specifics of what you need, it should be easy to make it with AMS :)


About my monster code: I thought this mod was rather short compared to AMS itself :D, but I write what I need to write to make it work.
Even if that means a lot of lines ;)
 

Cohadar

master of fugue
Reaction score
209
How about for starters you make me a demo mod that displays current gold and lumbers of players. (it is 4 vs 4 map but I will expand it to 5vs5 pretty soon)
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Updated the first mod: amsTS

v1.01
  • Added 2 lay-outs: a normal one and an experimental centering lay-out
  • Added variables for allowing me to work on Cohadar's request

Expect more functions for amsTS soon, which will be able to suit Pyramidal Defense's needs, as well as allowing icons to be set before player names or scores.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
I suggest you keep it all in the original thread. :)
 
Status
Not open for further replies.
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top