Message Board


Message Board > Fenix / Bennu / Gemix / DIV > save() and load()

January 3, 2006, 17:14
Tovi
I love you!
75 posts

What's so different about saving and loading structures and arrays in Fenix compared to DIV?

Code:
GLOBAL
 STRUCT map
  STRUCT graphicx[100]
         graphicy[48];
  END
  STRUCT hardnessx[100]
         hardnessy[48];
  END
  STRUCT specialx[100]
         specialy[48];
  END
 END

//
//
//...
//
//

load(filepath+"level"+itoa(position)+position2+".lvl",&map);


Gives me the following error: Variable Required "MAP".

The code used to work in DIV... I know Fenix isn't DIV, but it would be handy to know the exact differences.

Anyone?

P.S.: Yes, the filepath is correct. I checked that with another program...

[Edited on January 3, 2006 by Tovi]
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 3, 2006, 17:24
Rincewind
programmer
1546 posts

It seems that you shouldn't use offset (&). So that would become:

load(filepath+"level"+itoa(position)+position2+".lvl",map);

And wherever you save it; there shouldn't be an offset there before the variable.
____________
Personal website: http://www.loijson.com
#
January 3, 2006, 17:33
Tovi
I love you!
75 posts

D'oh! Right... I should have been able to guess that myself.

My game still doesn't work though, but it's getting closer.

One more question then: Am I not allowed to define a private array? I get this error at:

Code:
PRIVATE
 anim1[14]=34,34,34,35,35,35,36,36,36,37,37,37,38,38,38;
 anim2[19]=17,17,17,17,17,18,18,18,18,18,17,17,17,17,17,19,19,19,19,19;


It gives me an "Data type not accepted here (34)" error on the third line of that code. (And mysteriously, not on the first array)
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 3, 2006, 17:38
Sandman
F3n!x0r
1194 posts

"Data type not accepted here (34)"
Fenix always gives the line after the line with the error, but sometimes it gets messed up even more. Don't trust it. ;)

[EDIT]
Plus, I'd recommend the file functions fenix has for variables other than structs, or more variables/structs in one files.

[Edited on January 3, 2006 by Sandman]
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
January 3, 2006, 17:38
Rincewind
programmer
1546 posts

That feature of filling arrays that way just doesn't exist in Fenix. So you'll have to do it with a loop or something else creative.
____________
Personal website: http://www.loijson.com
#
January 3, 2006, 17:43
Tovi
I love you!
75 posts

Bummer. I'll try to work around it. Thanks.

Sandman -> Thanks for the advice. I'll remember it when I'm coding in Fenix. Right now all I'm trying to do is port an old DIV game of mine. And I need the levels I saved in the editor I made in DIV, so I need compatability.

[Edited on January 3, 2006 by Tovi]
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 3, 2006, 18:02
Fiona
games are terrible
-9616558 posts

Quoting Rincewind:
That feature of filling arrays that way just doesn't exist in Fenix. So you'll have to do it with a loop or something else creative.
Really? I didn't know this, that fucking sucks.
____________
laffo
#
January 3, 2006, 18:16
Rincewind
programmer
1546 posts

Quoting Tovi:
And I need the levels I saved in the editor I made in DIV, so I need compatability


I hope fenix and div create the same kind of files with those functions. Wasn't Fenix doing it with whitespaces or something?
____________
Personal website: http://www.loijson.com
#
January 3, 2006, 18:36
Tovi
I love you!
75 posts

That would be a MAJOR bummer.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 3, 2006, 20:05
Woody
HEAD BLACK MAN
722 posts

I don't think Fenix likes string tomfoolery inside function parameters. Try this:
Code:
foo=filepath+"level"+itoa(position)+position2+".lvl";
load(foo,map);

And if that doesn't work, give fread a shot. Load is being phased out I think.

[Edited on January 3, 2006 by Woody]
____________
boredome is the bitter fruit of too much routine
#
January 3, 2006, 22:20
Tovi
I love you!
75 posts

Rubbish, Fenix handles tomfoolery perfectly. I just got it to work that way, so there :P :D

In fact, I just found out that when you remove "offset" and the "sizeof" command in save and load, DIV save-files are fully compatible with the Fenix load command! Hoorah! I get to keep all my levels!

Well, that's the case for my editor anyway. I can load all my old maps, edit them and save them without problems.

[Edited on January 3, 2006 by Tovi]
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 4, 2006, 03:00
Rincewind
programmer
1546 posts

Quoting Tovi:
DIV save-files are fully compatible with the Fenix load command!


Ok good good. Are you porting a known game of you?
____________
Personal website: http://www.loijson.com
#
January 4, 2006, 03:27
Sandman
F3n!x0r
1194 posts

If it didn't work, it would have been creatable using the file commands of Fenix.

Strings inside functions perform like you would like em, no problem there. But watch out with strings inside switches!
like
Code:
switch(my_string)
  case "BANG":
    //do stuff
  end
  case "FAEC":
    //do other stuff
  end
end

...well actually larger ones cause total failure. :cry:
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
January 4, 2006, 05:25
Fiona
games are terrible
-9616558 posts

BANG FAEC
Best code ever.
____________
laffo
#
January 4, 2006, 08:40
Tovi
I love you!
75 posts

Quoting Rincewind:
Quoting Tovi:
DIV save-files are fully compatible with the Fenix load command!

Ok good good. Are you porting a known game of you?


Kensuo...

Debugging in Fenix is a pain though, as it tends to crash for no reason, without errors. And the "Say()" command doesn't seem to do very much at all.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 4, 2006, 08:59
Fiona
games are terrible
-9616558 posts

Change the character graphic!

Remember my review...
____________
laffo
#
January 4, 2006, 11:57
Tovi
I love you!
75 posts

I remember nothing.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 5, 2006, 22:07
Tovi
I love you!
75 posts

I just want to do some further ranting on the differences between DIV and Fenix, which I do not appreciate.

So now that I got Kensuo running-ish, you'd think everything would be ok, right?

Wrong.

It seems Fenix handles priorities differently from DIV... Like in Kensuo when I use one process to put() tiles, and another process to display an enemy, then essentially... somehow... enemies start lagging behind on the map, even though the exact same code worked with DIV.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 5, 2006, 22:17
PB
Defender of the faith
630 posts

I've not used DIV in quite a long time, but if I recall well, although that DIV used to execute processes from the same code always in the same order, this was not guarantied when all processes had the same priority value (which was a predefined local variable). I don't know if Fenix supports it, but if it does, try giving the processes the right priority values.
____________
#
January 5, 2006, 22:43
Tovi
I love you!
75 posts

I forgot to mention that all the processes have the correct priority attached to them, so that everything would work in DIV. In other words: "priority" is assigned for each process seporately.

And should work in theory.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 5, 2006, 23:38
PB
Defender of the faith
630 posts

Yes, you'd think so :S

(as I said, I'm not really into DIV anymore, I waited for DX for a while and can't really be bothered for Fenix at the moment)
____________
#
January 6, 2006, 02:32
Woody
HEAD BLACK MAN
722 posts

Fenix is a nightmare in general. 0.84 much more so than previous versions.
____________
boredome is the bitter fruit of too much routine
#
January 6, 2006, 08:32
Tovi
I love you!
75 posts

Ah good. I thought it was just me. It really would seem like Fenix does random things for no apparent reason.

For instance, drawing a line with draw_line causes a very unstable line that tends to dissapear and reappear at random times when I start walking around with my character.

Or when I used a process to inniate a process that would just initiate another process and kill itself, it didn't work. But when I used THE EXACT SAME CODE to initiate the last process from the first process, it did work.

I'd love to have the DIV debugger again. Man that was a great tool. And so underestimated.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
January 6, 2006, 15:08
Rincewind
programmer
1546 posts

Quoting Woody:
Fenix is a nightmare in general. 0.84 much more so than previous versions.


Woody for my sake be an emancipated woman. This is nothing. There are two 0.84 versions, version A and version B. They are totally different.

Fenix 0.84b has a bug that makes priorities not work. Fenix 0.84a has it all working and in my opinion is the superior version of this moment. I'm not alone in this opinion. Download it here. :)

[Edited on January 6, 2006 by Rincewind]
____________
Personal website: http://www.loijson.com
#
January 6, 2006, 15:58
Tovi
I love you!
75 posts

OMG THANK YOU

That's WAHAAAAAAAY better.


The only thing I don't like about 0.84a is that signal() is carried out before the process reaches frame, but at least I can work around that.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#

Page 1 , 2


Message Board > Fenix / Bennu / Gemix / DIV > save() and load()

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!