Syntax Error

Ask questions, discuss ideas, get answers
Post Reply
professor_smith
Posts: 133
Joined: Thu Dec 13, 2012 7:45 am

Syntax Error

Post by professor_smith »

Hello Folks,
So, I am constantly getting this error in my debugging log, for many of my maps, in various files such as the AI.con, the AIPathfinding.con, the StrategicAreas.con, etc:

Warning: Io: Error bf1942/levels/Coral_sea/ai.con: Can not have an "endIf" without an "if"!

Warning: Io: Error bf1942/levels/Coral_sea/ai.con (35): if v_arg1 == host
Engine\Io\Console.cpp

Warning: Io: Error bf1942/levels/Coral_sea/ai.con: Error: Syntax error in expression!

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Below, I have copied and pasted my AI.con file for Coral_Sea as an example of what I have. Please tell me if anything is incorrect or how to correct these errors. Thank You.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

rem ************** LEVEL SPECIFIC AI SETTINGS ***************************

if v_arg1 == host

aiSettings.setWorldMapSize 2048 2048
aiSettings.viewDistance 600
aiSettings.setInformationGridDimension 64

rem ********************** START THE AI *********************************

rem *** Init AI using current settings ****
ai.init 2

rem *** init Botmanager ***
AIBotManager.setLodLevelTicks 6 6 6
AIBotManager.setLodLevelPriority 3 3 3
AIBotManager.setPlannedDecisionMakingThreshold 0.5 0.5 0.5
AIBotManager.setUnplannedDecisionMakingThreshold 0.3 0.4 0.4
AIBotManager.setDecisionMakingInterleave 2 2
AIBotManager.setSensingQuotient 1 1
AIBotManager.setSystemQuotient 40 40 20


rem *** Strategic map dimension, MUST BE DONE BEFORE CREATING SAI! ***
ai.saiMapXDimension 64
ai.saiMapYDimension 64

rem *** Create Strategic AI ***
ai.createSAI

rem *** Bot statistic ***
ai.botStatisticUpdateSpeed 3

rem *** Enabled or disabled as default ***
ai.saiEnable 1
game.showAIstats 0
ai.showBotStats 0


endIf

run AIPathFinding.con
run ai/StrategicAreas.con

rem *** Load and set strategies for each side ***

run ai/conditions.con
run ai/prerequisites.con
run ai/Strategies.con
rem run ai/AIBehavioursTweaks.con

if v_arg1 == host

ai.addSAIStrategy 1 TeamAAttack
rem ai.addSAIStrategy 1 TeamADefend
rem ai.addSAIStrategy 1 TeamARepulse
ai.addSAIStrategy 2 TeamBAttack
rem ai.addSAIStrategy 2 TeamBDefend
rem ai.addSAIStrategy 2 TeamBRepulse

endIf
Lets make war games, not war.
Diamondback
Posts: 589
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada
Contact:

Re: Syntax Error

Post by Diamondback »

I’ve had this error many times with the if/endIf conditional statement but it hasn’t stopped my script from working properly. It’s basically saying you have to enclose your if statement with an endIf statement, which you did already in your code.

I think that the debugger is giving you that error because it probably doesn’t support rem statements inserted inside if/endIf code blocks. Try removing those and see if the error is still there. If it is and your CON file still works as intended, just add console.echoErrors 0 at the beginning of the CON file.
See my Strasbourg map project here.
professor_smith
Posts: 133
Joined: Thu Dec 13, 2012 7:45 am

Re: Syntax Error

Post by professor_smith »

Thank you DiamondBack. I will give it a try for sure.

Joshua
Professor Smith
Lets make war games, not war.
Diamondback
Posts: 589
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada
Contact:

Re: Syntax Error

Post by Diamondback »

Did it work?
See my Strasbourg map project here.
professor_smith
Posts: 133
Joined: Thu Dec 13, 2012 7:45 am

Re: Syntax Error

Post by professor_smith »

Sorry, I've been out of commission for the past week and a half. I will be trying your idea tonight. I was just wondering, what exactly does "console.echoErrors 0", do?

Thank You,

Joshua
Professor Smith
Lets make war games, not war.
professor_smith
Posts: 133
Joined: Thu Dec 13, 2012 7:45 am

Re: Syntax Error

Post by professor_smith »

So far, the removal of the remmed lines from in between the if and endIf lines, has not done much to change the errors, but then again, I am doing other edits at the moment as well. Once I am finished with those, I'll be able to test it out a bit better. I'll keep you informed. Thank you.
Lets make war games, not war.
professor_smith
Posts: 133
Joined: Thu Dec 13, 2012 7:45 am

Re: Syntax Error

Post by professor_smith »

Diamondback wrote: Thu Aug 12, 2021 8:50 pm I’ve had this error many times with the if/endIf conditional statement but it hasn’t stopped my script from working properly. It’s basically saying you have to enclose your if statement with an endIf statement, which you did already in your code.

I think that the debugger is giving you that error because it probably doesn’t support rem statements inserted inside if/endIf code blocks. Try removing those and see if the error is still there. If it is and your CON file still works as intended, just add console.echoErrors 0 at the beginning of the CON file.
What exactly does that "console.echoErrors 0" statement, do?
Lets make war games, not war.
professor_smith
Posts: 133
Joined: Thu Dec 13, 2012 7:45 am

Re: Syntax Error

Post by professor_smith »

I did try the edits you mentioned, and nothing seems to work. I have a feeling that it is something else in the mod, that is causing these maps to crash over a network.

Thank You Anyway
Lets make war games, not war.
Post Reply