-
NPCs and INI files
I have two more things I can't figure out. I'm trying to make an RPG-ish NPC system complete with text that appears one level at a time. To do this, I used a tutorial and got the application to transfer a letter every 5 100ths of a second from one string object to another. Unfortunately, I have not been able to make a condition to test for when the two strings are equal (meaning the dialogue has all of the needed letters added to it). I've tried using a global string and comparing to that, but it didn't work- I can't figure out how to use the expression editor for anything but numbers.
I'm also making an INI based save system, but I can't figure out what directory to put save files in- if they're in C:, the directory varies depending on the OS. I'd like to save them in a folder right outside the application, but I don't know how to save files in a non-specific location relative to the application.
Sorry for the wall of text. Can anyone help?
-
Re: NPCs and INI files
For saving you can do apppath$+"game.ini" and it will be in the same directory as your game.
-
Re: NPCs and INI files
The AppPath$ part of the file path isn't needed; simply using "Save.ini" will save/load to the current directory.
As for the string comparison, you can easily compare strings; in the Special object, Compare Two General Values, you can compare two expressions to each other. You can compare teo values, or you can compare two strings, as you want to do.
Also, for future reference, Val(>String<) takes a number in string format (eg "100") and converts it to a number value, and Str$(>Value<) takes a number (eg 100) and converts it to string format.
-
Re: NPCs and INI files
Save.ini actually saved to C:\WINDOWS. Still, Apppath$+"Save.ini" worked. I'd like to know how to put the save file in a folder next to the application, but this is fine for now. The "compare two general values" expression editor will make things much easier, so thanks for the advice, but it turns out I was just grabbing the text of "paragraph 1" instead of the text object's current displayed text. Anyway, thanks for the help!
-
Re: NPCs and INI files
Yeah I was thinking you had to have a file path for the directory. Although I was under the impression it saved in AppData by default but apparently not. I know the hi-score object saves in AppData without a file path.
As for a folder, you would just have to have Apppath$+"\folder\"+"save.ini".
-
Re: NPCs and INI files
Ahh, yes, sorry, I was think of objects in general when I said that it saves like that. For the INI object in specific, it breaks this rule of thumb and saves to the Windows directory like you said.