Array Saving Problem

This forum is currently in read-only mode.
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)