Loading...
  OR  Zero-K Name:    Password:   

Local colors

8 posts, 2164 views
Post comment
Filter:    Player:  
sort
13 years ago
local colors widget doesnt allow user to override

from gui_local_colors.lua, lines 15-18:

if VFS.FileExists("Luaui/Configs/ZKTeamColors.lua") then
colorCFG = VFS.Include("Luaui/Configs/ZKTeamColors.lua")
elseif VFS.FileExists("Luaui/Configs/LocalColors.lua") then
colorCFG = VFS.Include("Luaui/Configs/LocalColors.lua")

as we can see, it's else-if so it only loads the user stuff only if there is no ZK file, but the ZK file is always there.
+0 / -0
13 years ago
I'd like to add that it would be nice if in the next release we could change colors as easily as in BA, tech ann or other mods I guess.
I just tried the hard way and my com was invisible and the game crashed. I'd wait for the next release of zero k.
Thank you.
P.S.:I hate being cyan!
+0 / -0


13 years ago
Simplest way is to disable local team colors widget. Then colors from lobby apply.
However for newbies and consistency local team colors are enforced by default.
+0 / -0


13 years ago
Power user question get a power user answer. Disable the teamcolours widget and place this code in a file in your engine installation called "teamcolours.lua"

You may already have such a file in which case "local disabled

true" needs to be changed to "local disabled

false".

Following text is the file contents of the file:
----------------------------------------------------------------------------

----------------------------------------------------------------------------

--
-- file: teamcolors.lua
-- brief: local team recoloring
-- author: Dave Rodgers
--
-- notes:
-- This script can be used to configure the local
-- client's team colors before the game starts.
--
-- Copyright (C) 2007.
-- Licensed under the terms of the GNU GPL, v2 or later.
--
----------------------------------------------------------------------------

----------------------------------------------------------------------------

--
-- Configuration
--

local disabled = false --<<** NOTE **>>--

local debug = false


----------------------------------------------------------------------------

----------------------------------------------------------------------------

--
-- Color sets
--

local myColor = { 1, 191/255, 0 }

local gaiaColor = { 0.8, 0.8, 0.8 }

local allyColors = {
{ 1.0, 0.0, 0 },
{ 0.05, 0.96, 0.95 },
{ 1.0, 0.0, 1 },
{ 132/255, 100/255, 50/255 },
{ 158/255, 42/255, 0.0 },
{ 153/255, 0.0, 13/255 },
{ 238/255, 1.0, 3/255 },
{ 250/255, 127/255, 225/255 },
{ 183/255, 99/255, 103/255 },
}

local enemyColors = {
{ 0.0, 0.1, 0.9 },
{ 1, 1, 0.5 },
{ 0.5, 1, 0.5 },
{ 0, 0.4, 0 },
{ 1, 97/255, 40/255 },
{ 151/255, 0, 219/255 },
{ 1, .5, .7},
{ 1,0,0},
{ 88/255,46/255,1 },
}


----------------------------------------------------------------------------

----------------------------------------------------------------------------


local myTeam = players[myPlayer].team

local myAllyTeam = teams[myTeam].allyTeam


----------------------------------------------------------------------------

----------------------------------------------------------------------------


local teamColors = {}


-- set the colors
local a, e = 0, 0
for teamID, team in pairs(teams) do
if (team.gaia) then
teamColors[teamID] = gaiaColor
else
if (teamID == myTeam) then
teamColors[teamID] = myColor
elseif (team.allyTeam == myAllyTeam) then
a = (a % #allyColors) + 1
teamColors[teamID] = allyColors[a]
else
e = (e % #enemyColors) + 1
teamColors[teamID] = enemyColors[e]
end
end
end


----------------------------------------------------------------------------

----------------------------------------------------------------------------


if (debug) then
print('TEAMCOLORS.LUA')

print(' modName = ' .. modName);
print(' modShortName = ' .. modShortName);
print(' modVersion = ' .. modVersion);

print(' mapName = ' .. mapName);
print(' mapHumanName = ' .. mapHumanName);

print(' myPlayer = ' .. myPlayer)
print(' myTeam = ' .. myTeam)
print(' myAllyTeam = ' .. myAllyTeam)

for teamID, team in pairs(teams) do
local color = team.color
print(' team ' .. teamID)
print(' leader = ' .. team.leader)
print(' allyTeam = ' .. team.allyTeam)
print(' gaia = ' .. tostring(team.gaia))
print(' active = ' .. tostring(team.active))
print(' color = ' .. color[1]..' '..color[2]..' '..color[3])
end

for playerID, player in pairs(players) do
if (player.active) then
print(' player ' .. playerID)
print(' name = ' .. player.name)
print(' team = ' .. player.team)
print(' active = ' .. tostring(player.active))
print(' spec = ' .. tostring(player.spectating))
end
end

for teamID, color in pairs(teamColors) do
print(string.format('teamcolors.lua: %i = %f, %f, %f', teamID,
color[1], color[2], color[3]))
end
end


----------------------------------------------------------------------------

----------------------------------------------------------------------------


if (disabled) then
return {}
else
return teamColors
end

----------------------------------------------------------------------------

----------------------------------------------------------------------------

+0 / -0
13 years ago
I still have to think about which tab my rders are oneso +1 team colors in my book
+0 / -0
Necroing thread.
Could someone please fix this:

if VFS.FileExists("Luaui/Configs/LocalColors.lua") then -- user override
    colorCFG = VFS.Include("Luaui/Configs/LocalColors.lua")
    Spring.Echo("Loaded local team color config.")
elseif VFS.FileExists("Luaui/Configs/ZKTeamColors.lua") then
    colorCFG = VFS.Include("Luaui/Configs/ZKTeamColors.lua")
else
    error("missing file: Luaui/Configs/LocalColors.lua")
end


to something like this:

if VFS.FileExists(LUAUI_DIRNAME .. "Configs/LocalColors.lua") then -- user override
    colorCFG = VFS.Include(LUAUI_DIRNAME .. "Configs/LocalColors.lua")
    Spring.Echo("Loaded local team color config.")
elseif VFS.FileExists(LUAUI_DIRNAME .. "Configs/ZKTeamColors.lua") then
    colorCFG = VFS.Include(LUAUI_DIRNAME .. "Configs/ZKTeamColors.lua")
else
    error("missing file: " .. LUAUI_DIRNAME .. "Configs/LocalColors.lua")
end


It appears LUAUI_DIRNAME == LuaUI\, and real file system part of VFS (virtual file system i presume) is case sensetive (at least under linux). Its just not funny to have 2 different folders Luaui and LuaUI :(

Bug relevant to v1.2.7.7 (and prior)
+1 / -0


10 years ago
Feel free to clone Zero-K on github, fix it, test it and submit pull request :)
+0 / -0

10 years ago
Thanks for quick fix (v.1.2.7.8)
About pull request: will consider it next time. I'm too lazy atm and thought those little changes not woth cloning, commiting, pulling, requesting...
+0 / -0