The Daily Click ::. Forums ::. Klik Coding Help ::. How to save a 1000-value object?
 

Post Reply  Post Oekaki 
 

Posted By Message

Wormware



Registered
  20/05/2003
Points
  1031
22nd January, 2004 at 06:49:17 -

I'm working on a game that has many values. Like 200 or so.. Sounds weird but it's true. I want to make a save option in the game, How can I save easily 1000 values in for example an Ini-file? Or are there better sollutions/extensions??

 
www.freewebs.com/wormware

Shen

Possibly Insane

Registered
  14/05/2002
Points
  3497
22nd January, 2004 at 07:57:30 -

It's times like these that you wish you'd used Data Store 2 for info holding, before you started coding

 
gone fishin'

Wormware



Registered
  20/05/2003
Points
  1031
22nd January, 2004 at 08:02:11 -

And where can I download that object?
Because (smart as I am ) I didn't start coding.. yet

 
www.freewebs.com/wormware

jast



Registered
  03/01/2014 01:12:19
Points
  186
22nd January, 2004 at 10:16:14 -

You could just use an array.

 
n/a

Wormware



Registered
  20/05/2003
Points
  1031
22nd January, 2004 at 11:51:51 -

Thanks! And where was that site with all those extentions?

Image Edited by the Author.

 
www.freewebs.com/wormware

Wormware



Registered
  20/05/2003
Points
  1031
22nd January, 2004 at 12:34:33 -

Just 1 more question:

An array, does it save all the values evey level automatic? Or do I have to save the values in level one, to load them in level 2?



 
www.freewebs.com/wormware

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
22nd January, 2004 at 14:33:22 -

you can make an array global to the whole app... so you won't need to save every time you change levels.

 
www.thenatflap.co.uk

jast



Registered
  03/01/2014 01:12:19
Points
  186
22nd January, 2004 at 14:49:31 -

And if you ever decided to close your app there's still the super-easy to use save action.

 
n/a

Rycon



Registered
  20/09/2002
Points
  996
23rd January, 2004 at 01:54:55 -

If your using the 1000 GLOBAL values object, DESTROY IT! Program it no longer! It doesnt work. I forget when it doesnt work but it doesnt work at the worst time.. lol, its like when you save a value then skip a frame and try to get it out.

 
We are the music makers, we are the dreamers of dreams...

Tiles

Possibly Insane

Registered
  06/12/2002
Points
  2339

GOTM 3TH PLACE WINNER - JANUARY 2010
23rd January, 2004 at 05:15:31 -

LOL, i love this "donīt use it" answers ...

i am using the 1000 global value object since a while. around 400 GV in use. and no problems here ... but i am using MMF 1.5 . maybe you all talking about the 1000GV object for tgf ... tgf always crashed at my pc. so i never used it

if you still want to use the 1000GV object and want to save it all to an array, use this:

you need two counters( .one for loading ,one for saving. i always use counters to have a control at which stage i made a mistake ), an normal array( setup: numerical, X=1000, Y=1, Z=1,and two buttons. and then there is fastloop ...

the stuff between the "-" means a symbol in the code. i wish that mmf 2 will have a way to copy code from the events list editor to normal rtf ...

here is the loading code:

Button -load button- clicked
+ -load counter- is 0
... -array- Load array from file Appdrive$+Appdir$+"savegame1.arr"
... set -load counter- to 1

-load counter- is 1
+only one action when event loops
... start loop "load" 1000 times

On Loop "load"
... Set Global Value LoopIndex("load") to ValueAtX("array",LoopIndex("load") )

-load counter- is 1
+every 1 second
... set -load counter- to 0

this was the loading code.now the savecode:

Button -save button- clicked
+ -save counter- is 0
... set -save counter- to 1

-save counter- is 1
+only one action when event loops
... start loop "save" 1000 times

On loop "save"
... -array-: Write Value getgloval("-1000GV-",LoopIndex("save"))to(LoopIndex("save"))

-save counter- is 1
+every 1 second
... set -save counter- to 2

-save counter- is 2
... -array- Save array to file Appdrive$+Appdir$+"savegame1.arr"
... set -save counter- to 0

now it should work

Image Edited by the Author.

 
Free graphics,Free Games
http://www.reinerstilesets.de

Rycon



Registered
  20/09/2002
Points
  996
23rd January, 2004 at 13:20:38 -

Yes I was talking about it for TGF, forgot to mintion that, so it works for mmf eh, hmmm I should give that a try...

 
We are the music makers, we are the dreamers of dreams...

Wormware



Registered
  20/05/2003
Points
  1031
23rd January, 2004 at 13:28:07 -

I didn't start, so I'll be using the Array. Thanks for all the infotmation, people!

 
www.freewebs.com/wormware
   

Post Reply



 



Advertisement

Worth A Click