[ Updated threads · New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Advanced CON file scripting in BF1942 - the complete guide
grandsarbresqcDate: Wednesday, 2019-08-07, 5:30 PM | Message # 1
Group: Recruit
Messages: 8
Awards: 1
Reputation: 0
Status: Offline
Hello all,

Over the last two weeks I have started writing a comprehensive guide that sums up all the knowledge I have gathered on advanced CON file scripting in BF1942.

The guide should be read as an addition to 4CentsShy's amazing work mapping the huge array of available BF1942 console commands and debugging them, as well as his work on understanding how variables, constants and conditional statements are used in BF1942. Without 4CentsShy's work, this little known area of BF1942 client side modding would never have surfaced.

As of right now, the guide, which will take the form of a Word document, is still being written. The objective of the guide is to shed more light on advanced CON file scripting in BF1942 - that is, how to define constant and variables and use them with conditional statements to add more functionalities to your scripts. The information in the guide was compiled by reading the various guides and sources on variables, constants and conditionals. Most of these invaluable resources come from 4CentsShy's website, which I am linking here: http://www.velotech.net/battlefield/. It also compiles various forum threads and posts from BFMods.com, mostly on how to tie CON file scripts to keyboard keys using a console command.

The guide is divided in chapters and can be started at any chapter the reader wishes, although I recommend reading the guide from A to Z. Every chapter is composed of at least one practical script example which use the actual BF1942 CON file syntax. In the annex of the guide, a list of CON files which were used throughout the guide to assist the theory is provided. 

Although the emphasis is put on conditional statements in this guide, it covers more than just their usage. The second part of the guide is geared on how to build your own CON file scripts, how to debug them, how to make them work on Internet games and on a local server and various script examples you can use for your map or mod. These scripts were made by me and they work in various game modes BF1942 supports (Internet, Singleplayer and through the BF1942 Debugger). I also encourage people to reply to this topic by posting examples of CON file scripts they have made themselves. Eventually it would be nice to build some sort of CON file code bank that everyone can use for their maps and mods.

Here is a list of topics the guide covers:

- Constants, variables and their respective uses. User created variables (or local variables) versus variables that are global in scope (such as the v_arg1, v_arg2, v_arg3 class of commands)
- Defining constants and variables with the const c_ and var v_ prefixes
- Assigning variables to BF1942 console commands
- The principle of variable mutability in BF1942 (local variables can be assigned to different console commands)
- Console command argument(s) substitution by constants and variables
- Operators (<, >, =, ==, !=, <=, >=, |)
- BF1942 arithmetic operations on floats and integers (addition, subtraction, multiplication and division) and operations on 2D and 3D vectors using the Utils class of console commands
- Conditional statements (if-else-elseif-endIf) and while loops (while-endWhile)
- Nesting conditional statements to verify multiple conditions at the same time
- Other useful statements that the BF1942 Refractor engine uses (rem, beginRem/endRem, return, exit, beginNoExecution/endNoExecution, alias) and when to use them
- While loops and how they work in BF1942
- How to build your own advanced CON file scripts; CON script structure (variable or constant definition, variable assignment, body of the script) and where to place your CON file scripts in the game file structure (main directory vs in your mod's main folder vs in your map RFAs) in order to test them
- A crash course on how the file system in BF1942 works; how CON files are read and the order in which they are loaded (Archives folder RFAs, then the Game.rfa, then map RFAs)
- Debugging your CON file scripts with the BF1942 Debugger (very useful before you pack your CON scripts in a map RFA or other mod archive)
- What program to use to edit CON file scripts, which can be opened with any text editor. I recommend Notepad++ because it correctly indents your lines of codes and numbers them, which is very important for debugging purposes
- Binding your CON file scripts to unused keys on your keyboard in order to execute them on the fly
- Examples of working CON file scripts that use conditional statements and variables and how to use them. You can use these CON file scripts for your mod or map
- How my Console Unlocker tool was built (an annotated diagram)
- An annex complete with useful definitions and a list of CON files used throughout the guide as well as CON files made by me that you can use in your mod or map

As this is still a work in progress I would appreciate if anyone could provide some topics about advanced CON file scripting in BF1942 that I might have missed. I will gladly add these parts to my guide to make it more complete, and give proper credits to the person that originally came up with the idea.
vp8cktdiDate: Friday, 2023-10-13, 6:14 AM | Message # 2
Group: Recruit
Messages: 1
Awards: 0
Reputation: 0
Status: Offline
hi, thank you very much
is there a mode also called bf1918? If yes where can i find and download it?
calgary local escorts
  • Page 1 of 1
  • 1