Attribute Not Updating

JeffreyDriver

  • Posts: 2262
I'm trying to write a value to a list, but it's not always working, and even though I've been staring at this for two days, I cannot figure it out.

There's comments in the attached image to explain my code, but here are the basics.

- The code triggers when the conditions required to win the game are met.
- The scene name is split up into a list so I can refer to the number values in it. The name format is 'Area 1 Stage 1'
- Local list attribute is set to the correct global list attribute (called 'Area 1', 'Area 2', etc.) by pulling the number from the previous list.
- The player's current score is compared to the existing one, and if it's higher, then it updates.

This works with the scene name 'Area 1 Stage 1', but not others e.g. 'Area 1 Stage 2'.  It always updates the first item in the list.

I'm completely stumped.

Any ideas?

EDIT: I've tried a different method of updating the attribute (see attached image) but still only the first item in the list updates.

« Last Edit: December 28, 2017, 03:25:23 pm by JeffreyDriver »

mdotedot

  • Posts: 1640
What I would do is to use a lot of print blocks so you can view the value in the console for all those things you compare.
It isn't really related to the issues you are having but you might want to investigate booleans a bit.
If an attribute is a boolean you don't have to use the <boolean variable> = false  but you can use <not <boolean variable>.
Also, in the succeed you do a trigger if it is either true or false. There are no other possibilities so you could omit the if  block alltogehter.

There is a code block used : getGameAttribute <-  This is only for the global game attributes = PURPLE colored attributes.

Hopefully you get grips on what is going on when you use the print blocks. I strongly recommend to use this a lot so you can follow what is going on.

You can print entire lists using the block so you can see what is actually in the list.


Good luck with it.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

JeffreyDriver

  • Posts: 2262
Thanks for your help. I took some time off from and came back to it with fresh eyes, and then suddenly the problem was apparent.