You are here

Need help with Portable Game

5 posts / 0 new
Last post
D4vid
Offline
Last seen: 15 years 10 months ago
Joined: 2006-08-25 17:01
Need help with Portable Game

Hello

Im trying to make game portable and i need some help.
To make it work i need some kind och batch or nsis script that edits a certain file called Hospital.Cfg
The contents of the file:

INSTALL_PATH=[the path to where the game and file is located]
INSTALL_TYPE=MAX
LANGUAGE=ENG

The thing i need the script to do is to when it's run it changes the INSTALL_PATH value to the current location. This way the game can be run from anywhere.
Someone know how to do this?

allesklar
Offline
Last seen: 15 years 9 months ago
Joined: 2007-01-03 06:48
I guess you've already

I guess you've already tested this, but just in case, did you tried with a relative path?
If that's not working, please try to describe a little bit what's the directory structure of the game and where is that cfg file placed.

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 13 years 1 month ago
Joined: 2006-01-06 21:27
Looks sorta like

an INI file...
Try something like

WriteINIStr "$EXEDIR\Hosptial.cfg" "" "INSTALL_PATH" "$EXEDIR"

Tell us if it works.
----
Ryan McCue
Person 1: Oh my god. You will never believe what just happened.
Person 2: What?
Person 1: I can't remember, I've forgotten.

"If you're not part of the solution, you're part of the precipitate."

allesklar
Offline
Last seen: 15 years 9 months ago
Joined: 2007-01-03 06:48
No section

Correct me if I'm wrong, but I think it's not possible to write to an INI file with no section heading using WriteINIStr.
I'd rather use this macro from the TextFunc.nsh include

${ConfigWrite} "$EXEDIR\Hospital.cfg" "INSTALL_PATH=" "$EXEDIR" $R0
Ryan McCue
Ryan McCue's picture
Offline
Last seen: 13 years 1 month ago
Joined: 2006-01-06 21:27
Good idea

I didn't think my code would work, but t'was just putting it out there.
----
Ryan McCue
Person 1: Oh my god. You will never believe what just happened.
Person 2: What?
Person 1: I can't remember, I've forgotten.

"If you're not part of the solution, you're part of the precipitate."

Topic locked