View Single Post
Old 04-19-2008, 09:40 PM   #2
Free Software Terrorist
Vexorian's Avatar

Technical Director
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place


It's a scope with no initializer?

How are people supposed to use it?

Edit: I see, that's lame.

This is a vJass map so I demand vJass to be exploited.

1. Use this, instead of your custom script section, have it in some trigger.

Collapse JASS:
library GetPlayerNameColored

function GetPlayerNameColored takes player id returns string
 local playercolor col=GetPlayerColor(id)
 local string r=GetPlayerName(id)
    if col == PLAYER_COLOR_RED then
        set r="|cffff0000"+r+"|r"
    elseif col == PLAYER_COLOR_BLUE then
        set r="|cff0000ff"+r+"|r"
    elseif col == PLAYER_COLOR_CYAN then
        set r="|cff93ffc9"+r+"|r"
    elseif col == PLAYER_COLOR_PURPLE then
        set r="|cff400080"+r+"|r"
    elseif col == PLAYER_COLOR_YELLOW then
        set r="|cffffff00"+r+"|r"
    elseif col == PLAYER_COLOR_ORANGE then
        set r="|cffff8000"+r+"|r"
    elseif col == PLAYER_COLOR_GREEN then
        set r="|cff00c400"+r+"|r"
    elseif col == PLAYER_COLOR_PINK then
        set r="|cffff80c0"+r+"|r"
    elseif col == PLAYER_COLOR_LIGHT_GRAY then
        set r="|cff808080"+r+"|r"
    elseif col == PLAYER_COLOR_LIGHT_BLUE then
        set r="|cffc1c1ff"+r+"|r"
    elseif col == PLAYER_COLOR_AQUA then
        set r="|cff5e5e2f"+r+"|r"
    elseif col == PLAYER_COLOR_BROWN then
        set r="|cff004000"+r+"|r"
        set r="|cff000000"+r+"|r"
 return r


1. Make HSS a library that requires it and also a library called HSS_setup, also make start begin automatically (an initializer)

2. Is the trigger that begins with GetSelectionOrders_Effects part of your HSS? Then include that in the library or make a library required by it.

3. Regarding the contents of HSS_setup, it should replace this:

Collapse JASS:
    local integer i = 0
    // Loop through players in map, setting up their hero selection rects and hero creation locs
        exitwhen i > 3
        set HSS_HeroSelection[i] = gg_rct_HeroSelection
        set HSS_HeroCreation[i] = GetStartLocationLoc(GetPlayerStartLocation(Player(i)))
        set i = i + 1
    // Store the trigger to be ran when a hero is created
    set HSS_CreatedHeroTrigger = gg_trg_PostHeroCreation
With what? you may ask, I dunno, you can use a function that returns that stuff, you can also use an initializer, be creative there.

So, in other words your users will just need to modify the setup library and just include your HSS instead of messing with when and how to call ExecuteFunc("Start_HSS") , btw, I should advice against ever ExecuteFunc, if necessary use .execute() this time it was not necessary.

The reasoning is that jasshelper will some day integrate the map optimizer's capabilities but taking advantage of the higher level syntax, so if we just use alternatives to ExecuteFunc the optimization will be much better than with the optimizer, .execute() is faster anyways.

4. Oh yes, if you make a function public, make sure to document what it does.

I don't like this, don't worry, the reason I don't like it is that my old hero system code has a lot of messy stuff, and yours has inherited most of the bad things old hss had. Can you try fixing them? Will save me the time of having to update it, for example it is way too liberal about dynamic triggers.
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote