I'm looking for some help with some C++ code. I have working knowledge and understanding of code and coding in general, but don't actually program myself.
I have 2 files
TFGame
and
TFMenuConsole
In TFGame I put
var config bool ToggleWarhead;
and later put
PlayInfo.AddSetting(default.GameGroup, "ToggleWarhead", default.SIGPropsDisplayText[i++], 0, 1, "Check", ,, , true);
To my knowledge, this will create the variable ToggleWarhead and then add a check box to the settings menu to toggle this variable true or false (default being true) and also display the string value that is set for SIGPropsDisplayText for the setting name.
In TFMenuConsole I put
case SMS_Construction:
SMNameArray[0] = "Shield (50/30)";
SMIndexArray[0] = 1;
SMNameArray[1] = "Protector (200/30)";
SMIndexArray[1] = 2;
SMNameArray[2] = "Portal (200/30)";
SMIndexArray[2] = 3;
SMNameArray[3] = "Armory (200/60)";
SMIndexArray[3] = 4;
SMNameArray[4] = "Generator (300/60)";
SMIndexArray[4] = 5;
SMNameArray[5] = "Outpost (600/90)";
SMIndexArray[5] = 6;
if(tfgame.ToggleWarhead == True)
{
SMNameArray[6] = "Warhead (3000/180)";
SMIndexArray[6] = 7;
}
SMArraySize=7;
break;
Which should Check if the variable ToggleWarhead in the File TFGame is true, if it is then it will execute array number 6, if not then it should skip it and Warhead should be left out of the Array.
When I try to compile I get this
"Error, Bad or Missing Expression in 'if'
So I have 2 questions
1. Should my code for the if statement on the array include the difference in array size like so?:
case SMS_Construction:
SMNameArray[0] = "Shield (50/30)";
SMIndexArray[0] = 1;
SMNameArray[1] = "Protector (200/30)";
SMIndexArray[1] = 2;
SMNameArray[2] = "Portal (200/30)";
SMIndexArray[2] = 3;
SMNameArray[3] = "Armory (200/60)";
SMIndexArray[3] = 4;
SMNameArray[4] = "Generator (300/60)";
SMIndexArray[4] = 5;
SMNameArray[5] = "Outpost (600/90)";
SMIndexArray[5] = 6;
if(tfgame.ToggleWarhead == True)
{
SMNameArray[6] = "Warhead (3000/180)";
SMIndexArray[6] = 7;
SMArraySize=7;
}
SMArraySize=6;
break;
and 2. What am I doing wrong? why is it not working?
I'm sure it is because of the format I put the if statement in, I am not used to C++ and I only understand code, I don't actually know how to code.
Any help would be greatly appreciated.
I can also provide the source files if your willing to help me solve this.
Thanks,
Grim