Page 1 of 1

Stop reading a data file [Solved]

Posted: Wed Jul 09, 2014 1:36 am
by Noobasaurus
Let's say that I have this in my lua.

Code: Select all

ReadDataFile("2muchspace.lvl")
And I don't want to read it anymore because it's taking up too much memory. Is there any way to do this?

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 2:16 am
by Marth8880
Based on this list of Lua callbacks, probably not.

Why *exactly* do you need to un-load the LVL file? What all does it contain? :o

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 11:43 am
by Noobasaurus
It contains a map. All the objects and stuff. I can't read another one because then the game runs out of memory, so I have to stop reading the first one.

Okay, so I'm thinking that I might be able to use ScriptCB_DoFile to load it, but I don't think that I'll be able to un-load it.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 11:44 am
by Marth8880
I see. Why exactly do you need to load more than one map in the same mission? :o There might be an easier way of doing what you might be trying to do.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 11:52 am
by Noobasaurus
Of course there's an easier way. I want to load the maps as people complete objectives. However, I need to keep the scores they have achieved from each world.
Hidden/Spoiler:
SITH LAWD

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 12:18 pm
by Marth8880
Hmm. Have you ever heard of/played Jaspo's One-Map Mappack? If the maps are modular (heck, I don't think they'd even have to be modular, seeing as how you could just use different terrain textures in the different "map" areas), you could try implementing similar concepts.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 12:34 pm
by Noobasaurus
Yeah, I've played that and thought about using a similar method. I'll probably end up doing that. I'm just too lazy to make a map but I guess I'll have to now.

What I'm going for will probably work better with a custom map anyways.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 2:11 pm
by Teancum
Just to clarify, there is no "stopping" reading a data file. It reads it once and puts it in memory. It doesn't constantly stream it, nor is there a way to remove it from memory once its been loaded (aside from quitting to the menu or loading the next map).

Sorry if that bursts your bubble.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 2:41 pm
by Noobasaurus
It doesn't quite burst my bubble, but it brings up another question. Is there a way to load a map, have the player do stuff there, and then load another map through the same lua? The reason why I'm saying the same lua is so that if x=1 it will stay 1 in the next map.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 3:13 pm
by Teancum
What you'll want to do is create a custom Galactic Conquest like Maveritchell's The Dark Times. By its nature it can save data from the LUA you can carry over things from one map to the next.

Re: Stop reading a data file

Posted: Wed Jul 09, 2014 3:15 pm
by Noobasaurus
Oh, dang. Okay. I'll look into that. Thanks!

Re: Stop reading a data file

Posted: Thu Jul 10, 2014 10:28 am
by Locutus
Noobasaurus wrote:I want to load the maps as people complete objectives. However, I need to keep the scores they have achieved from each world.
Did you take a look at this: viewtopic.php?f=64&t=17867&p=309098#p309098 ?

Re: Stop reading a data file [Solved]

Posted: Thu Jul 10, 2014 10:36 am
by Noobasaurus
No I did not. That does look really interesting, and I would experiment with it if the source code link wasn't broken. Thanks.

And I also did look into a custom GC and it's a little bit over the top for what I'm trying to do. So now it's all in one map.

Re: Stop reading a data file [Solved]

Posted: Thu Jul 10, 2014 10:38 am
by Marth8880