"if not allowed on the highest level"

Ask questions, discuss ideas, get answers
Post Reply
Diamondback
Posts: 589
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada
Contact:

"if not allowed on the highest level"

Post 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?
See my Strasbourg map project here.
russ
Posts: 73
Joined: Sun Oct 29, 2017 8:12 am

Re: "if not allowed on the highest level"

Post 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.
Diamondback
Posts: 589
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada
Contact:

Re: "if not allowed on the highest level"

Post 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?
See my Strasbourg map project here.
russ
Posts: 73
Joined: Sun Oct 29, 2017 8:12 am

Re: "if not allowed on the highest level"

Post 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.
Diamondback
Posts: 589
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada
Contact:

Re: "if not allowed on the highest level"

Post 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.
See my Strasbourg map project here.
Diamondback
Posts: 589
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada
Contact:

Re: "if not allowed on the highest level"

Post 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.
See my Strasbourg map project here.
Post Reply