Array Saving Problem

For questions about using Classic.

Post » Mon Nov 16, 2009 2:17 pm

I'm having a strange issue when trying to save an array to a file. Basically, I have a button that should save the array to a file when clicked. The event call I'm using works, but it seems like where I call it from is causing trouble. Presently, when the button is clicked, the file is saved, but the array it saves is completely zeroed-out. However, if I use the exact same line in a "Start of Layout" condition instead, it saves correctly. I have double checked the entire event sheet and there is nothing else that accesses the array, and I know the data is good going in to the layout and up to the point where the button is clicked, so I'm at a loss. Is there an issue with saving arrays during certain events, and is there a workaround?

I'd rather not provide a .cap file, as the project directory is kind of a mess and rather large, but I can give screen shots of the events if needed.
B
1
G
3
Posts: 6
Reputation: 837

Post » Mon Nov 16, 2009 2:58 pm

Are you using a windows button? if so, don't. Also, there's really no way of telling what's going on without a cap file. You may say you double checked all your events, but that's hardly effective when looking for bugs. Many a times i've said that my events were fine after double checking them, when in reality, they weren't. A programmer looking at his own code may think it's fine, but when another looks at it the bugs may be blatantly obvious. You say that where you call your action changes things... Many things can be the problem: Accidental subevent picking, order of actions, etc. There's no way of helping without a cap.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Mon Nov 16, 2009 3:28 pm

It's not a Windows button; it's actually just a sprite. What's strange is that my save-game screen in the same project uses most of the same events, and it works just fine. I'll show you what I mean.

Here is the event layout. I deleted everything irrelevant for purposes of this example while keeping the same functionality. There's nothing else in the layout; it ends at the bottom. Here's how it looks, but does not work (the saved array ends up all zeroed-out). The important bit is highlighted in yellow:



And here, the only difference is the important lines (yellow again) were moved to the start. This one works:



(The Timeline bit doesn't make a difference; that was just leftover from me trying something. It behaves the same either way.)

For the life of me I can't figure why clicking on the sprite would wipe the array out.
B
1
G
3
Posts: 6
Reputation: 837


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests