Not sure if this helps but it mentions setting local variables
Quote:
Mission Variables
As of 1.65? these methods can also be used with script local variables by suppling a "local_" variable rather than a "mission_" varaible. The difference is that "mission_" variables are stored within a save file and "local_" variables are not saved with the game and are only valid localy, within a mission script.
set: mission_variable <value>
// sets the mission_variable to the value given
// the value can be a particular string or numeric value,
// or a queriable state
reset: mission_variable <value>
// sets the mission_variable to be UNDEFINED
increment: mission_variable
// increases the mission variable's value by 1.0
decrement: mission_variable
// decreases the mission variable's value by 1.0
add: mission_variable <value>
// adds the value given to the mission_variable
// the value can be a number or a queriable state
// like shipsFound_number
subtract: mission_variable <value>
// subtracts the value given from the mission_variable
// the value can be a number or a queriable state
// like shipsFound_number
so
can you not
Code:
set: local_legal <value>
then
Code:
setLegalStatus: local_legal
I am not entirely sure, but I think that the solution you are suggesting only works for mission variables (such as being defined by us, the oxp'ers) but not for hardcoded variables that are already there in the core game, like the legal rating.
The "<string>???</string>" part would be where I want to deduct from or add to the players legal rank. Basically this script checks if the player owns a certain station and if it is owned, gives him the income and alters his legal rating.
The income bit is already working, but as to the legal thing I am clueless. How would you apply your solution to the above ??? sequence? I am ready to experiment if need be ...
Generally spoken there are commands that expect a value and those that expect a variable.
In cased a fixed number is expected for a command you can replace that with [variable]. Before Oolite executes a line it first replace everything between [] and than executes the new line.
String expansion works at all places except in a CONDITION line.
... then the above example should, after each witchjump, add 4000 Cr to the player's fortune and raise his legal rank towards "Offender" or "Fugitive" by 5 points, is that correct?
It will but is there a top limit to your legal status .How high does this rating go i thought 64 but have found no evidence. You will need to find out and perform a check to see if this top limit has been reached. before adding more on to local legal otherwise it will just keep increasing.
Unless legal status has a cap it wont exceed not sure have not found the info
I add 10 - even if they were applied before the witchjump, there should still be five left after it - making me an Offender when Clean. And that doesn't happen.
The conditions are applied correctly - because the 4000 Cr get awarded as they should!