The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with List Object & Arrays (MMF)
 

Post Reply  Post Oekaki 
 

Posted By Message

Rick (AntiMatter Entertainment)

Possible psychotic

Registered
  18/10/2002
Points
  814

VIP Member360 OwnerWii Owner
27th May, 2005 at 23:52:11 -

Howdy, everyone! It's been a while since any of you heard from me, but that's because at the moment my internet connection at home is not available, and could be for weeks to come. But I'm not here to fill you in just yet, I'm the one that needs answers. I have two problems right now.

The first problem:

I've used Arrays in my games for a while now, but right now I'm working on something that needs to save the Array in several different sub-directories of the program, which for one reason or another is something I've never done. How can you save the Array in a directory different to the game's original directory? Using the file object to open a new directory doesn't seem to work, or perhaps the 'order of events' bug for MMF is screwing it up.

What I've got:

CONDITION
+ Player clicks on "Save" button
EVENT
+ Set directory to original
+ Change current directory to <sub-directory>
+ Save the Array file as "Filename"

So, even with the above setup, it still seems to save in the original directory (or possibly not at all, the original directory could still hold Arrays from earlier versions of the program when I didn't try this method).

The second problem:

Also, for the same project, I'm using a List object, and I need it to detect when you add something to the list that's already there, and it should be obvious but I can't find how to do it. I tried messing with the "Compare two general values" and using the List Object's "Find String" function, but I don't completely understand how this works, especially the value on the end.

Warning: Help with either or both of these problems will result in excessive use of the words "thank you".

 

Fifth

Quadruped

Registered
  07/05/2003
Points
  5815

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
28th May, 2005 at 01:39:59 -

Unless I'm misunderstanding, the first one sounds easy enough. You can just use a variable pathname for the array file, like such:

appdrive$ + appdir$ + "/subdirectory/array.arr"

The list problem sounds like you'll need to create a function of sorts. Before you add a line to the list, run a fastloop to go through each of the list's lines and compare, one-by-one, to the entry you're adding. I think that would be the most reliable way of doing it, but I've never used "Find String" function...

 
Go Moon!
   

Post Reply



 



Advertisement

Worth A Click