Author Topic: variables in xml files? can we set them from inside the xml or script only?  (Read 170 times)

ninekorn

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Hey!

Some xml files have this:

Code: [Select]
<variables>
<var>some_variable</var>
</variables>

can we set them directly from inside the xml file for instance:

Code: [Select]
<variables>
<var>some_variable = 10</var>
</variables>


I am trying to avoid using Global Storage Variables for the market mod and having something like this below would really help.

Code: [Select]
<variables>
<var>price = 159</var>
</variables>



ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1105
    • View Profile
Hello!

No, you cannot define variable values there.
It's used just to define which variables should be saved for the script instance. So if your script has a global variable (defined in the root of the script file) of name "price", the game will store it in a savegame for this script.
The names of variables in XML should match the names of variables in the corresponding
script file.
If you want to set default values to such variables, just define them with assigning right in the script file. For example:
Code: [Select]
// in the root of the JS file
var price = 123;

Regards!