Having two problems with webstorage

Get help using Construct 2

Post » Mon Jul 16, 2012 6:07 am

I'm working on a game with some friends, and I'm having two problems.

1: I have a planting system (akin to Pokemon's berries system) going on and it remembers each plant just fine, but upon loading a saved file; an extra plantspot appears in the topleft corner.
2: It seems to remember the values of the player just fine, but anything that's an event or non-player object (even set to global) doesn't seem to get remembered in it's last state, even if it's values are saved to webstorage and remembered. See in the capx, with the small animals and seeds.

Capx
Zelda Gamekit (my project)

Example capxs I have made:
Zelda-Style Inventory
Zelda Hearts System

The unwritten "How do I" capx etiquette! Nearly always provide a capx of the problem you have, and try to isolate the problem and/or no capx above 10 MB. :)
B
38
S
19
G
26
Posts: 438
Reputation: 16,581

Post » Thu Jul 19, 2012 7:28 pm

For the first problem, it turns out it has to do with creating instances upon loading but I'm not sure what is the actual problem further in. I figured this out earlier, when creating/destroying plantspot instances was messing with the instance variables.
As for the second one? I'm not sure...stumped.
Zelda Gamekit (my project)

Example capxs I have made:
Zelda-Style Inventory
Zelda Hearts System

The unwritten "How do I" capx etiquette! Nearly always provide a capx of the problem you have, and try to isolate the problem and/or no capx above 10 MB. :)
B
38
S
19
G
26
Posts: 438
Reputation: 16,581

Post » Thu Jul 19, 2012 10:16 pm

That plantspot creating loop:
For "trees" from 0 to TreeSaved.Width
should be
For "trees" from 0 to TreeSaved.Width - 1
That probably explains the extra plantspot at 0,0.


2. I haven't looked through all the code (there's a lot) but it looks like you're loading the values from webstorage on the title screen and then setting them to default values on start of layout.

B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Fri Jul 20, 2012 1:25 am

I'm getting closer, but haven't quite fixed the first or second.

1: Plantspot doesn't appear on first load, but on all loads after, it does
2: Got time system to work upon loading, will do more work.
Zelda Gamekit (my project)

Example capxs I have made:
Zelda-Style Inventory
Zelda Hearts System

The unwritten "How do I" capx etiquette! Nearly always provide a capx of the problem you have, and try to isolate the problem and/or no capx above 10 MB. :)
B
38
S
19
G
26
Posts: 438
Reputation: 16,581

Post » Fri Jul 27, 2012 5:19 am

Any more help, please? I really like to figure this out, then I think I would be able to understand webstorage fully.
Zelda Gamekit (my project)

Example capxs I have made:
Zelda-Style Inventory
Zelda Hearts System

The unwritten "How do I" capx etiquette! Nearly always provide a capx of the problem you have, and try to isolate the problem and/or no capx above 10 MB. :)
B
38
S
19
G
26
Posts: 438
Reputation: 16,581

Post » Fri Aug 17, 2012 1:51 am

Help, please?
Zelda Gamekit (my project)

Example capxs I have made:
Zelda-Style Inventory
Zelda Hearts System

The unwritten "How do I" capx etiquette! Nearly always provide a capx of the problem you have, and try to isolate the problem and/or no capx above 10 MB. :)
B
38
S
19
G
26
Posts: 438
Reputation: 16,581

Post » Fri Aug 17, 2012 5:45 am

[QUOTE=ramones]2. I haven't looked through all the code (there's a lot) but it looks like you're loading the values from webstorage on the title screen and then setting them to default values on start of layout.
[/QUOTE]

I haven't downloaded your code either, but I trust Ramones' judgement on this.
What he means is that you should make sure in your "On start of layout" to only set the default values once, the very first time you execute your program and not every time the layout starts otherwise you will be under the impression that only default values are saved when they are in fact overwritten.

I'd suggest you to read my tutorial Asteroid clone in less than 100 events, I explain a great deal about webstorage and it should be just what you need.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sat Aug 18, 2012 5:04 am

So, I could check for a placeholder key (like say "SaveFileExists") and set the values if it doesn't exist but with the Trigger once while true condition?
Zelda Gamekit (my project)

Example capxs I have made:
Zelda-Style Inventory
Zelda Hearts System

The unwritten "How do I" capx etiquette! Nearly always provide a capx of the problem you have, and try to isolate the problem and/or no capx above 10 MB. :)
B
38
S
19
G
26
Posts: 438
Reputation: 16,581


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests