This is an old revision of the document!
Table of Contents
VR Logic Library
Current Version: 1
First added to Community Project v0.90
In a nutshell:
* Allow VR Basic Library (v7 and higher) and VR Immersion Library to use the FLAGs using IFs and SETs
* Contains the functions to interpret IFs and SETs
* Contains table and event to run a logic table
* Contains table and event to execute change to any libraries global libvars based on an IF statement.
IF & SET statements
These are very simple statements that consist of 3 parts.
For example:
a>b
a=c
a*4
etc..
They can be combined using an @ symbol that acts as a logical AND.
And IF or SET statement always has to have 3 parts. A value to the left, to the right and an operator ( <, >, = for IF and =, *, /, +, - for SET) in the middle.
The value to the left or the right can be a number, a LookUp value or a Flag.
Lookup values
Valid lookup codes at the moment are:
[turn] ⇒ Is 0 based and returns 0 for the first player and 1 for the second player
[round] ⇒ Returns round number. First round returns 1, second returns 2, etc..
Flags
To put the value of a flag in an IF or SET statement just write the flag variable (not case insensitive). For example: points>4 or phase=2
To err on the side of caution only use regular letters and numbers in your flag names. And never ever use [,],<.>,=,*,/,+,-
Logic Table
Has just two columns. IF and SET. If IF statement is true then the SET statement will be executed.
Checked at the early start of every turn.
It runs before any of the VR Basic Library events are run. So you can for example set flagA = 1 here in the same turn as having it cause 10 PP extra to arrive through the VR Basic Event Libs PP rewards table that has IF Logic flagA>0.
Global Libvar Table
Has four columns. First one of course the IF statement. If the IF statement is true the global lib var (name in 3rd column) of library name (name in 2nd column) will be set to the value in the 4th column.
It also runs before any of the VR Basic Library events are run.
Interoperability with the VR Basic Events Library
From the VR Basic Events Lib version 7 and higher.
The following tables in the VR Basic Events tables have an extra column for IF logic:
* Supply Table
* Reinforcement Unit Table
* Replacement Troops Table
* Fuel Table
* PP Rewards Table
* Replacement Cards Table
* Officer Pool Table
If any IF logic is added to any of the rows to these tables these rows will only be executed if the IF logic returns true.
This allows you for example to give a special PP reward when a certain FLAG is present, or let specific unit arrive upon a certain FLAG value.
Best wishes, Vic
