Page 1 of 1

Syntax Error

Posted: Thu Aug 12, 2021 4:19 am
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

Re: Syntax Error

Posted: Thu Aug 12, 2021 8:50 pm
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.

Re: Syntax Error

Posted: Thu Aug 12, 2021 11:40 pm
by professor_smith
Thank you DiamondBack. I will give it a try for sure.

Joshua
Professor Smith

Re: Syntax Error

Posted: Tue Aug 17, 2021 8:02 pm
by Diamondback
Did it work?

Re: Syntax Error

Posted: Wed Aug 25, 2021 12:02 am
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

Re: Syntax Error

Posted: Sat Aug 28, 2021 6:51 am
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.

Re: Syntax Error

Posted: Wed Feb 08, 2023 11:53 pm
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?

Re: Syntax Error

Posted: Thu Feb 09, 2023 6:00 pm
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