The Daily Click ::. Forums ::. Klik Coding Help ::. INI masks
 

Post Reply  Post Oekaki 
 

Posted By Message

Robbert



Registered
  19/06/2003
Points
  420
18th February, 2006 at 10:30:05 -

For my isometric engine I need to have a few external files that are loaded into the game:

- texturemap
- heightmap
- savemap

basicly all the files are INI files. So when there you play a map that is 4x4 tiles (I know it's a bit small )... then you will have this:

Texturemap.ini :
[texturemap]
0=g-g-g-g
1=g-g-g-g
2=s-s-s-s
3=w-w-w-w

Where g is grass, s is sand and w is water. The engine will load this scenery to the maps surface. The same goes for the heightmap and the savemap (which is just the save file of the player with all the objects that are built in the game in it) ...

Now so far so good...

To give this game a more professional look I want to have different filetypes.

- Instead of texturemap1.ini I want it to be called texturemap1.txm
- heightmap1.ini will be heightmap1.hgm
- savemap1.ini will be savemap1.svm

As far as I know, these types don't exist. It is possible to still load these files with the ini-object, as long as they have an INI-layout inside. The question is... can I give these 3 filetypes their own icon?

 
Hey mates, I'm Iglo yeah =P!

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
18th February, 2006 at 10:36:11 -

I don't think you can give those types their own icons, without messing with the user's system somehow. But may I suggest it would be alot easier to use a 3D array to do this? Then you would only have 1 file, and no need for 3 messy inis.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
18th February, 2006 at 10:40:57 -

A file has the same contents no matter what its extension is, so you can certainly rename the files in that way. I've seen a lot of people do it, and it tends to make things a bit neater when you have more than one type of INI or save file that you want to use.

Icons are more difficult, though, as they have to be associated with file types through an installer that makes changes to Windows' file type directory.

 
http://www.davidn.co.nr - Games, music, living in America

Robbert



Registered
  19/06/2003
Points
  420
18th February, 2006 at 10:55:41 -

I am used to INIs I never worked with arrays. Do they come standard with MMF or is it an extension?

@David:

It's a pity that it is so hard. Is there a simple install-your-filetype-program that can run at the same time as the install file of the game ? I could do some setups in the Windows properties, but then it's only on my computer

 
Hey mates, I'm Iglo yeah =P!

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
18th February, 2006 at 12:49:01 -

Arrays

Yes, they come as an extension free with MMF. Although I think you can get extensions for TGF that work with them too.

Custom File Associations

These aren't too hard. To do this, you're going to need to think of:

1 - The file extension you want to use, like ".txm"
2 - An internal name for it, such as "IsoEngine.Textmap"
3 - A description for it, such as "Isometric Texture Map"
4 - The path for an icon you want to use, such as "C:\some folder\icon.ico"
5 - The path of your program (or possibly an editor program, like Notepad), such as "C:\some folder\MyApp.exe"

You're gonna want to use the Registry Object, which I believe also works in TGF.

STEP 1 -- Set the Root Folder of the Registry Object to HKEY_CLASSES_ROOT
This is an area of the registry specifically designed to hold the file type associations.

STEP 2 -- Using the 'Set key' action of Registry Object, set the key to ".txm"
For your info, a 'key' in RegEdit is shown like a folder.

STEP 3 -- Using the 'Set string' action, type in your internal name ("IsoEngine.Textmap")
You'll see what we use this name for in a second...

STEP 4 -- Now using the 'Set key' action, change the key to "IsoEngine.Textmap"
This will create a new folder/key. Stuff like the icon and the command lines are gonna go in THIS folder, not the ".txm" one.

STEP 5 -- Using the 'Set string' action, type in the description "Isometric Texture Map"
This will show up as a description whenever someone sees a .txm file in future.

STEP 6 -- Use 'Set key' again now and type "IsoEngine.Textmap\DefaultIcon"
This will create a sub-key.

STEP 7 -- Then use 'Set string' and type the path of your icon, like "C:\some folder\icon.ico"
This is the icon that will be given to your .txm files.

STEP 8 -- Use 'Set key' again and now type "IsoEngine.Textmap\shell\open\command"
This will create an 'Open' option when you right-click your .txm file.

STEP 9 -- Use 'Set string' and enter the command line for your program, like "C:\some folder\MyApp.exe %1"
The %1 is a system command. When you double-click a txm file, windows will run your app using this command, and it will replace the %1 with the file path of the txm file. You can then retrieve this from within MMF using its commandline functions.

STEP 10 -- Repeat step 8 for any other commands you want, like 'edit' or 'preview' (and replace the 'open' bit in the key with 'edit' or 'preview' or 'run' or whatever else you want). These will also appear when you right-click, as additional actions.



And that's it!!

Any folders with .txm files in them will need to be either re-opened or refreshed (right-click, press 'Refresh') before the changes show.

I might convert this into an example or an article, since it's got a lot longer than I expected. As usual, take care when using RegEdit.

 
191 / 9999 * 7 + 191 * 7

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
18th February, 2006 at 13:13:29 -

I had no idea about the Registry object. An article on this could be a good idea.

 
http://www.davidn.co.nr - Games, music, living in America

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
18th February, 2006 at 13:19:05 -

Wasn't there an associate object too? I never used it, but it might give you the option to associate the file with the app and give it an icon...

 
Old member (~2004-2007).

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
18th February, 2006 at 14:59:32 -

Associate doesn't quite do that. It's more powerful, but more risky, to do it manually with events.

 
191 / 9999 * 7 + 191 * 7

Robbert



Registered
  19/06/2003
Points
  420
19th February, 2006 at 04:13:21 -

Wow thank you very much. I never knew this was possible with MMF. I'll try it out this week

 
Hey mates, I'm Iglo yeah =P!
   

Post Reply



 



Advertisement

Worth A Click