Bug: initial value of list not restored when reloading scene

publysher

  • Posts: 41
Hi all,

I seem to have encountered a bug in Stencyl's handling of initial values.

Problem description
Modifying List attributes in a behavior also modifies the initial value – by "initial value" I mean either the  value set as "Default Value" in the behavior, the value set in the when attaching a behavior to an actor, and the value set when customizing an actor.

Reproducing the problem
I have a behavior with a List Attribute. The list attribute has an initial value. When my behavior modifies the value of this list attribute and reloads the scene, the value of the list is NOT restored to its initial value.

Attached you will find a game which shows this behavior and compares it to the behavior of e.g. Text attributes.

Expected behavior
When reloading the scene, I expect the List attribute to be completely restored to its initial value.

Workaround
The workaround is of course to _not_ modify your list attributes, but it's quite annoying.

- publysher

june 10, 2012 Updated the description and reformatted the post

« Last Edit: June 10, 2012, 06:30:56 am by publysher »

72master

  • Posts: 7
i know you have your own problems but i couldn't help but notice your a stencyl pro so maybe you could help me figure out a little problem i have. I am trying to add text to my list that is in the NPC behaviour now when i use blocks like add_to_ or insert_at _to_ the only options on where i get to move my text is to a new list or a copy of some other list could you help me out 

« Last Edit: July 25, 2012, 12:35:17 am by 72master »

davient

  • Posts: 5
...
Workaround
The workaround is of course to _not_ modify your list attributes, but it's quite annoying.


I also ran into this bug. Though in my case, the problem was more pronounced, I find that whatever initial values I set the list to they are not respected.

My workaround is to manually initialize the values of the list in an on created block.

zerosimms

  • Posts: 710
...
Workaround
The workaround is of course to _not_ modify your list attributes, but it's quite annoying.


I also ran into this bug. Though in my case, the problem was more pronounced, I find that whatever initial values I set the list to they are not respected.

My workaround is to manually initialize the values of the list in an on created block.

Ditto, when I set an int value to 3 from the 'Attributes', it is totally ignored. I have to manually set it to 3 for every scene that it's required in.

Blacksmith

  • Posts: 142
http://community.stencyl.com/index.php/topic,13748.new.html#new

I ran into this bug this week and it was confirmed by Rob1221 that it has been around for a while. See my thread above.

My solution: Ask the player when they start the game if it is a new game or a continued game. If it's a new game, you initialize all the game attributes you need to start with their default attributes. If the player chooses to continue playing the game instead, those attributes that you saved in the "new game" version, will have retained the values they had the last time the game was saved. So you don't need to initialize them. Hence the boolean question at the beginning.

Blacksmith

  • Posts: 142
I forgot to attach a screenshot of the custom behavior I wrote (Initialize all Game attributes). Most of them are the same size, 10 records, so I could initialize most of them in 1 repeat loop.