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:
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?
"if not allowed on the highest level"
-
- Posts: 591
- Joined: Mon Oct 01, 2012 3:13 pm
- Location: Canada
- Contact:
"if not allowed on the highest level"
See my Strasbourg map project here.
Re: "if not allowed on the highest level"
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.
-
- Posts: 591
- Joined: Mon Oct 01, 2012 3:13 pm
- Location: Canada
- Contact:
Re: "if not allowed on the highest level"
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.
Re: "if not allowed on the highest level"
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.
-
- Posts: 591
- Joined: Mon Oct 01, 2012 3:13 pm
- Location: Canada
- Contact:
Re: "if not allowed on the highest level"
Don't want to ask for too much but could it be possible to include that code path in a future release someday?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.
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.
-
- Posts: 591
- Joined: Mon Oct 01, 2012 3:13 pm
- Location: Canada
- Contact:
Re: "if not allowed on the highest level"
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.