Stencyl 3.4.0 is now out. Get it now!

How to change the names of global attributes.

Dear Forum,

So I've seen a few questions about how to change the names of global attributes, and its something I've needed to do a couple times before myself as well. I figured out how to do it, so I thought I would put it up here in case anyone needed it.

Please note: As far as I know, this only works on the Windows version of Stencyl and is correct as of build 9300.

  • Make sure all Stencyl programs are closed and all of your work is backed up. All of your work SHOULD be backup up anyway (File > Export Game...) but needless to say (even though I've barely tested this at all so far) you should not try to be modifying your game and messing with game files at the same time.
  • Press [Windows Key].
  • Type %appdata%, and press [Enter].
  • Open the file path Stencyl\stencylworks\games\<your project name>.
  • Open the file game.xml in notepad, wordpad, or another similar program if you prefer.
  • Scroll down. Eventually you will get to a line which has only <attributes> written in it.

Each line between <attributes> and </attributes> is a different game attribute you have saved and seems to be in the format
    <a cid="b" id="c" name="d" save="e" value="f"/>
where
  • a is the attribute type (number, text, boolean, list, map).
  • b I have no clue about, its always -1 for me.
  • c is the identification of the global attribute, I assume this is what behaviours use to refer to global attributes, and it iterates from zero up.
  • d is the name of the attribute. This can be changed to whatever you want (presumebly as long as another global attribute with the same name doesn't already exist) and it will update the name in all behaviours after saving and closing the game.xml file for the next time you open Stencyl.
  • e is whether or not the global attribute can be saved with the Save Game block. true by default, but change at your own risk.
  • f is the initial value of the global attribute and should correspond to the attribute type.

Well, hopefully this is useful to someone. Once again, I've barely played around with it at all so make sure to backup your stuff constantly, otherwise go nuts.


Thank you,
Annulus

LenseOnLife

  • *
  • Posts: 92
Hi Annulus,

Thans for that info - great to know how to change those mis-spelled globals  ::) as seems to be happening more often with every passing year  :(

Cheers,

Oliver