Re: Can I move an image between cards?
Posted: Mon Sep 11, 2017 3:07 pm
I don't see why you'd need a database, you can save LC arrays to disk as either binary or text files and read them in directly.
I would envision the array with room names as keys and any moveable inventory objects on the card as each key's element. Each array would represent a single game.
Arrays are fast, and all you need to do on preopencard is create the elements listed for that corresponding key. There would also be one additional key that stores the current card name (updated on each card change) that allows the app to know where to resume on next launch.
Except for the database part, your steps seem right. When the game begins, check for an array on disk (no array means it's a new user) and store it in a script local or global variable. Read and update the array as the user navigates and does things. On quitting/closestack, write the array back to disk. If you want to be cautious, write the array to disk on every card change so the current state is preserved if something unexpected happens.
This method wouldn't require a launcher stack since all data can easily be stored in the array on disk. A launcher stack is always an option, but you'd need to create a whole new stack for every new game which seems like overkill for something like this.
I would envision the array with room names as keys and any moveable inventory objects on the card as each key's element. Each array would represent a single game.
Arrays are fast, and all you need to do on preopencard is create the elements listed for that corresponding key. There would also be one additional key that stores the current card name (updated on each card change) that allows the app to know where to resume on next launch.
Except for the database part, your steps seem right. When the game begins, check for an array on disk (no array means it's a new user) and store it in a script local or global variable. Read and update the array as the user navigates and does things. On quitting/closestack, write the array back to disk. If you want to be cautious, write the array to disk on every card change so the current state is preserved if something unexpected happens.
This method wouldn't require a launcher stack since all data can easily be stored in the array on disk. A launcher stack is always an option, but you'd need to create a whole new stack for every new game which seems like overkill for something like this.