There is many way to do so, and even if I personally also have difficulty with the subject, I will try to help.
From what I got, there is three major way to create variable:
1-the initialization block
I believe the problem with that principle is the you variable might not be save (this is one of the point I have dificulty understand, as I believe they sometime do).
2-default
The usually recommended method from what I've heard:
Code: Select all
default strength=5.0
default defence=5.0
This will set the variable to that value if no value is given in the save file (or for a new game). I was once recommended to always use that:
viewtopic.php?f=8&t=44567&p=458047#p458054
3-define
If I remember well, this is recommended for variable that doesn't varies as it is not saved, or something like that.
Code: Select all
define strength=5.0
define defence=5.0
I believe this is principally supposed to be used to create character.
In any case once that's done, you can interact with it later on by starting a python line by a starting it by a $
or by using logic statement:
In the end, you will generaly find more information in the
manual, especially using the search function. You might need to go over a few article before finding what you want, but I almost always find what I need there.
Hope I could help