Page 1 of 1

"if not allowed on the highest level"

Posted: Fri Jun 28, 2019 11:06 pm
by Diamondback
Hey guys,

I've been experimenting with the include statements and console run custom scripts recently and I noticed that the console doesn't like conditional statements such as if/else/elseif.

Here is the code of the test.con file which I placed inside my main Battlefield 1942 folder:

var v_test = 5

if v_test = 5

game.sayAll "test"

else

game.sayAll "nothing"

endIf


I then start a local game (Berlin CQ in this case), pull down the console with the tilde key and type "include test.con". This is the error I get in the console:
Image

So it seems using the include statement from the console or an admin command excludes the use of conditionals. Would it be possible to circumvent that error so that conditional statements could be used in CON, TXT and INC files when included from the console or typed as a custom admin command?

Re: "if not allowed on the highest level"

Posted: Thu Jul 04, 2019 7:46 am
by russ
So these only run if the depth is non-zero. depth gets bumped inside while loops, if loops and run commands. So you want to run the script rather than include it.

Re: "if not allowed on the highest level"

Posted: Sat Jul 06, 2019 9:15 pm
by Diamondback
I tested the run command and used a CON file with conditionals to do the test. It works, but only with the Debugger. Using the '"run'' command does nothing on a non Debugger server (local server) or in an Internet server. russ, do your fixed linux server executables enable the run command to work with conditionals from the console?

Re: "if not allowed on the highest level"

Posted: Sun Jul 07, 2019 1:03 am
by russ
The current patch doesn't modify that code path so if you can't use run now, it also wouldn't run with the patch.

Re: "if not allowed on the highest level"

Posted: Sun Jul 07, 2019 4:26 pm
by Diamondback
russ wrote:The current patch doesn't modify that code path so if you can't use run now, it also wouldn't run with the patch.
Don't want to ask for too much but could it be possible to include that code path in a future release someday?

There are interesting applications and advantages to running conditional statements from the console using the run command, such as creating custom admin login scripts. I will post more about what I've done on the Debugger with this soon.

Re: "if not allowed on the highest level"

Posted: Tue Jul 09, 2019 2:33 pm
by Diamondback
When I use the ''console.run'' command instead of simply typing ''run'' in the console window, instead of the console producing no output as was the case with the run command, it instead says ''Unauthorised method''. As expected, the console.run command works in the Debugger.