• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Error, Unrecognized type 'ServerColorActor' Compile aborted due to errors.

Boltte

Grizzled Veteran
Mar 5, 2014
168
3
Perth, WA
Hi, kinda new to all this - stole the code from somewhere (post #12) (Heeheehee - well their download links were all dead anyways, fortunately the author left with the code so I *should* be able to compile it myself). It just tells me this error:

Capture.png


And then doesn't compile. What's wrong with "ServerColorActor"? I don't understand.......don't even know how to code lol, as long as there's instructions on how to compile provided source code is available, then I just re-compile it(if the download links are all dead as is the norm around here), but coding itself is a no no for me..heh.:p:eek:

Here's the code:
Code:
class ServerColorMut extends Mutator config (ServerColorMut);

var config string ServerName;
var config string MapColor;
var config string WaveColor;
var config string WavePrefix;
var config string TimeColor;
var config string TimePrefix;
var config string MonsterColor;
var config string MonsterPrefix;
var config string NotStartedColor;
var config string NotStartedPrefix;
var ServerColorActor SCA;

function PostBeginPlay ()
{
SCA = Spawn (class'ServerColorActor ');
}

  class ServerColorActor extends Info;

 var GameRules GRules;

 function PostBeginPlay ()
 {
     GRules = Spawn (class'ServerColorInfo ');
     if (Level.Game.GameRulesModifiers == none)
         Level.Game.GameRulesModifiers = GRules;
     else
         Level.Game.GameRulesModifiers.AddGameRules (GRules);
     super (Actor) .PostBeginPlay ();
 }

class ServerColorInfo extends GameRules;

 function GetServerDetails (out GameInfo.ServerResponseLine ServerState)
 {
     local string sTemp;
     local int waveNum;
     local int monsterNum;
     local int elapsedTime;
     local KFGameReplicationInfo KFGRI;
     KFGRI = KFGameReplicationInfo (Level.GRI);
     waveNum = KFGRI.WaveNumber + 1;
     elapsedTime = KFGRI.ElapsedTime;
     monsterNum = KFGRI.MaxMonsters;
     // Set the server name.  If the variable in the ini is not zero, then paint in the color of what is written in the ini
     if (class'ServerColorMut'.default.ServerName! = "")
         ServerState.ServerName = class'ServerColorMut'.default.ServerName;
     else // Otherwise, draw a white value of the variable specified in the ServerName KillingFloor.ini
         ServerState.ServerName = Level.Game.GameReplicationInfo.ServerName;
     // If you specify a color for the card - draw the name of the color card
     if (class'ServerColorMut'.default.MapColor! = "")
     {
         sTemp = ServerState.MapName;
         if (Left (sTemp, 1)! = "")
         {
             sTemp = class'ServerColorMut'.default.MapColor $ sTemp;
             ServerState.MapName = sTemp;
         }
     }
     // If you specify a color for the wave - draw the wave number, if not specified - do not write anything
     if (class'ServerColorMut'.default.WaveColor! = "")
     {
         // Color + prefix + value
         sTemp = class'ServerColorMut'.default.WaveColor $ class'ServerColorMut'.default.WavePrefix $ waveNum;
         if (Level.Game.GetStateName () == 'MatchInProgress')
             ServerState.ServerName @ = sTemp;
     }
     // If you specify a color for the time - draw the time elapsed since the start of the card, if not specified - do not write anything
     if (class'ServerColorMut'.default.TimeColor! = "")
     {
         // Color + prefix + value
         sTemp = "" $ class'ServerColorMut'.default.TimeColor $ class'ServerColorMut'.default.TimePrefix $ GetTimeString (elapsedTime);
         if (Level.Game.GetStateName () == 'MatchInProgress')
             ServerState.ServerName @ = sTemp;
     }
     // If you specify a color for the amount of the remaining monsters - draw the otherwise - do not write anything
     if (class'ServerColorMut'.default.MonsterColor! = "")
     {
         // Color + prefix + value
         sTemp = "" $ class'ServerColorMut'.default.MonsterColor $ class'ServerColorMut'.default.MonsterPrefix $ monsterNum;
         if (Level.Game.GetStateName () == 'MatchInProgress')
             ServerState.ServerName @ = sTemp;
     }
     // Set the label and its color to a situation where the game is not opened yet
     if (class'ServerColorMut'.default.NotStartedColor! = "")
     {
         sTemp = "" $ class'ServerColorMut'.default.NotStartedColor $ class'ServerColorMut'.default.NotStartedPrefix;
         if (Level.Game.GetStateName ()! = 'MatchInProgress')
             ServerState.ServerName @ = sTemp;
     }
 }

 function string GetTimeString (int seconds)
 {
     local int cMinutes, cSeconds;
     local string result;
     cMinutes = seconds / 60;
     cSeconds = seconds% 60;
     if (cMinutes <10)
         result $ = "0";
     result $ = string (cMinutes);
     result $ = ":";
     if (cSeconds <10)
         result $ = "0";
     result $ = string (cSeconds);
     return result;
 }

Can someone hear who knows coding tell what's wrong please?
 
Last edited:
NikC-;n2269961 said:
Cant view where you find that code, but better take this. I posted there both source and the mutator.

Cool, I'll go check that out.

In the meantime here's the non google translated link that you were supposed to be able to see(google translate must utilize expiry dates and times because it gave me a blank page too when I just revisted it again): http://killingfloor.ru/xforum/thread...11/#post-97423

EDIT: Oh it's the same one, the same one your sourced too! Well how come you were able to compile it no problems and I got this ServerActor crap...? :confused:

Well at least your download link isn't dead....:)
 
Last edited:
Upvote 0
NikC-;n2269977 said:
They are the same i already gave you here..
The problem is that you copy-pasted everything into one place and forgot about ServerColorActor.uc and ServerColorInfo.uc. Better read some KF / unreal script guides, they will help to understand more.

Oh were they separated? I thought all three were suppose to be together in one .uc file and he just separated them for ease of reading... So then that means it's supposed to look like this then:

Code:
class ServerColorMut extends Mutator config (ServerColorMut);

var config string ServerName;
var config string MapColor;
var config string WaveColor;
var config string WavePrefix;
var config string TimeColor;
var config string TimePrefix;
var config string MonsterColor;
var config string MonsterPrefix;
var config string NotStartedColor;
var config string NotStartedPrefix;
var ServerColorActor SCA;

function PostBeginPlay ()
{
SCA = Spawn (class'ServerColorActor ');
}

That's one .uc file.
Code:
  class ServerColorActor extends Info;   var GameRules GRules;   function PostBeginPlay ()  { GRules = Spawn (class'ServerColorInfo '); if (Level.Game.GameRulesModifiers == none) Level.Game.GameRulesModifiers = GRules; else Level.Game.GameRulesModifiers.AddGameRules (GRules); super (Actor) .PostBeginPlay ();  }

That's the second .uc file and the last:

Code:
  class ServerColorInfo extends GameRules;   function GetServerDetails (out GameInfo.ServerResponseLine ServerState)  { local string sTemp; local int waveNum; local int monsterNum; local int elapsedTime; local KFGameReplicationInfo KFGRI; KFGRI = KFGameReplicationInfo (Level.GRI); waveNum = KFGRI.WaveNumber + 1; elapsedTime = KFGRI.ElapsedTime; monsterNum = KFGRI.MaxMonsters; // Set the server name.  If the variable in the ini is not zero, then paint in the color of what is written in the ini if (class'ServerColorMut'.default.ServerName! = "") ServerState.ServerName = class'ServerColorMut'.default.ServerName; else // Otherwise, draw a white value of the variable specified in the ServerName KillingFloor.ini ServerState.ServerName = Level.Game.GameReplicationInfo.ServerName; // If you specify a color for the card - draw the name of the color card if (class'ServerColorMut'.default.MapColor! = "") { sTemp = ServerState.MapName; if (Left (sTemp, 1)! = "") { sTemp = class'ServerColorMut'.default.MapColor $ sTemp; ServerState.MapName = sTemp; } } // If you specify a color for the wave - draw the wave number, if not specified - do not write anything if (class'ServerColorMut'.default.WaveColor! = "") { // Color + prefix + value sTemp = class'ServerColorMut'.default.WaveColor $ class'ServerColorMut'.default.WavePrefix $ waveNum; if (Level.Game.GetStateName () == 'MatchInProgress') ServerState.ServerName @ = sTemp; } // If you specify a color for the time - draw the time elapsed since the start of the card, if not specified - do not write anything if (class'ServerColorMut'.default.TimeColor! = "") { // Color + prefix + value sTemp = "" $ class'ServerColorMut'.default.TimeColor $ class'ServerColorMut'.default.TimePrefix $ GetTimeString (elapsedTime); if (Level.Game.GetStateName () == 'MatchInProgress') ServerState.ServerName @ = sTemp; } // If you specify a color for the amount of the remaining monsters - draw the otherwise - do not write anything if (class'ServerColorMut'.default.MonsterColor! = "") { // Color + prefix + value sTemp = "" $ class'ServerColorMut'.default.MonsterColor $ class'ServerColorMut'.default.MonsterPrefix $ monsterNum; if (Level.Game.GetStateName () == 'MatchInProgress') ServerState.ServerName @ = sTemp; } // Set the label and its color to a situation where the game is not opened yet if (class'ServerColorMut'.default.NotStartedColor! = "") { sTemp = "" $ class'ServerColorMut'.default.NotStartedColor $ class'ServerColorMut'.default.NotStartedPrefix; if (Level.Game.GetStateName ()! = 'MatchInProgress') ServerState.ServerName @ = sTemp; }  }   function string GetTimeString (int seconds)  { local int cMinutes, cSeconds; local string result; cMinutes = seconds / 60; cSeconds = seconds% 60; if (cMinutes <10) result $ = "0"; result $ = string (cMinutes); result $ = ":"; if (cSeconds <10) result $ = "0"; result $ = string (cSeconds); return result;  }
And that means I need to compile *three* .u files...? Just tried doing the top one and still gave me the same error... The second one gave me a
Error can't find Class 'ServerColorInfo'
and the third says
Error, Bad or missing expression after '$'
...

Also check my reply on the other thread please. Thanks!:)
 
Last edited:
Upvote 0