Game Development Community

How to access environement variables?

by Dmitriy Stukalov · in Torque Game Builder · 09/18/2007 (5:25 am) · 9 replies

Hello,

As far as I know the correct place for a temporary game data is "\Documents and Settings\User\Application Data\MyGame". My question is how to access environement variable which contain the Application Data path using TGB.

Thank you.

#1
09/27/2007 (10:12 pm)
Is there any other metods to store some game data in a safe place? :)
#2
09/28/2007 (10:50 am)
If you are using 1.5.1 I think you can use the function 'getDataDirectory'. However, be aware that this function is going away in 1.5.2 update. The reason being that in the future, writing to the application data directory will be transparent to the user.
#3
09/28/2007 (11:52 am)
Quote:writing to the application data directory will be transparent to the user.
Can you be more precise about that ?
I still have needs for my code to be able to write in the game directory (I have a lot of self-write .cs by code in the non-compiled game).
#4
09/28/2007 (1:55 pm)
There's a function getPrefsPath(%file) which could help.

For instance, if you use getPrefsPath("prefs.cs"), it returns "C:\Documents and Settings\User\Application Data\GameCompany\GameName\prefs.cs", assuming you have the company and name set correctly.

Not sure it will still be there in 1.5.2, however.
#5
09/28/2007 (7:53 pm)
It would be nice to know what else is going away in 1.5.2 so we can try not to waste our time using it.
#6
09/30/2007 (10:29 pm)
Thank you for your answers.

I use 1.1.3 for my game. It looks like booth functions getDataDirectory and getPrefsPath are not available in this version. The problem still persist :(
#7
10/04/2007 (2:31 am)
Well, looks like it task is more difficult than I've supposed.

Desision I found at this moment is to store game data in "C:\Documents and Settings\All Users\Application Data\My company\My Game\Player Name". Here "Player Name" is the name or nick of the Player in the game.

Is this path correct for Windows Vista?
Is there other problems for me if I will use this approach?
#8
10/04/2007 (9:44 am)
I'd recommend "CompanyName's GameName" because someone looking at the folders will probably recognize the game's name moreso than the company's.
#9
10/04/2007 (10:23 pm)
Thank you for advice Nikos,

But I can't see any reason to open the game data folder. May be for cheating or hacking only!