![]() |
loadlines
Is it possible to use loadlines to read from say a key in an ini file?
Having a little trouble figuring out how if it is possible, this is what im talking about. Quote:
Then i wanted to load the contents of the file, and only get the values under [Move]. I tried loading the lines and searching for "[Move]' then just isolating the contents under that, trying to find the = signs, and hunt the stuff on each side, but I discovered I am doing that either, wrong, or too complicated. Can GS2 do this easier? |
loadvars() dumps them into an object as variables.
keyconfig.loadvars("file"); keyconfig.up=w keyconfig.down=s And so on I heard from someone that the [] labels have some effect on how it loads, but I haven't tried. |
Quote:
Just add a value to it and it should be fine |
Quote:
keyconfig.movement.up=w Although now I guess I see the way I can do it is much easier then what i was thinking in the first place, thanks. |
IŽll give you another example.
Say that the file looks like this: NPC Code: NPC Code: Although you maybe dont need yet another example, here you go! :] |
Quote:
|
What you can do is use loadlines to search for the [Move], and then isolate all things under move by doing a check for another [ or so (or perhaps even doign something like: [Move] {
crap here } and checking for '}') and put that stuff into another array using temp.blah.add(temp.lines[i]); or so. You can then use var.loadvarsfromarray(temp.blah) to convert all of the = lines into members of the object. |
Quote:
|
All times are GMT +2. The time now is 04:15 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.