Pannel Posted May 12, 2011 Share Posted May 12, 2011 I've been working on a mod which changes the values of armor when it is equipped. I'd like to provide an ini file to allow players to make changes in the mods parameters for the game. I tried to do this for a few hours and could not seem to make the ini and scrips communicate. Does anyone have some advice on how to get the scrips and ini files to communicate? Appreciate your wisdom here. Link to comment Share on other sites More sharing options...
AndalayBay Posted May 12, 2011 Share Posted May 12, 2011 (edited) You need to use OBSE with the RunBatchScript command to read in the ini file. Basically all an ini file does for Oblivion is to set a bunch of variables in a quest script. So your ini file would look like this: Set ObXPSettings.attributePointsPerLevel to 13 Set ObXPSettings.skillPointsPerLevel to 48 That's just a sample. Then your main script would load that in: ;run batch ini settings script if ( fileExists "Data\ini\Oblivion XP Settings.ini" == 1 ) runBatchScript "Data\ini\Oblivion XP Settings.ini" else let tempString := mqGetMenuGlobalStringValue "Obxp\_iniMissing" messageBoxEx "%z" tempString return endif You need to put that in an "if ( GetGameLoaded )" block so that it's only run when the game is loaded or reloaded. The ObXPSettings that you saw in the ini file is the name of the quest that has the script with all those variables in it. Then whenever you need one of those variables elsewhere in your mod, you would reference them using the same dot notation. You'll probably need to read up on the OBSE documentation if you're not familiar with OBSE. Pluggy can also read ini files, but Pluggy is an OBSE plugin, so you might be better just sticking with OBSE. If you use Pluggy, then players will have to load that up too. Edit: Ignore the mqGetMenuGlobalStringValue command. I'm using MenuQue to make translation of my mod easier. Just set the tempString to the error message you want to display if the ini file isn't found. Edited May 12, 2011 by AndalayBay Link to comment Share on other sites More sharing options...
Astymma Posted May 13, 2011 Share Posted May 13, 2011 (edited) To expand on what AndalayBay said: With OBSE and runBatchScript you are technically NOT creating an ini file using the common definition of an ini file. What you are creating and runningis a batch script file that can be executed. As AndalayBay's example illustrates you are loading a file and then executing it as if you had done somethinglike "bat my_console_commands.txt". See here. The OBSE Plugin called Pluggy does, however, have a fully featured ini file implementation that allows you to create a file of sectioned name-value pairs that can be read into your script and/or written back to the ini file. See here. So it depends greatly on what implementation you need.You can also make a pseudo implementation using just OBSE by implementing your settings asa quest, as AndalayBay has done above, and using runBatchScript to populate the quest's variables on demand. Edited May 13, 2011 by Astymma Link to comment Share on other sites More sharing options...
Pannel Posted May 14, 2011 Author Share Posted May 14, 2011 Thanks a bunch Astymma and Andalaybay, Sounds like I may have been mixing the pluggy and OBSE ini implications that I was studying in various scrips. I'll give this a try and let you know how it goes. Link to comment Share on other sites More sharing options...
fore Posted May 18, 2011 Share Posted May 18, 2011 There is another big restriction to runBatchScript: you cannot use full OBSE fuctionality. So you cannot set array elements, which makes it pretty cumbersome to pre-set like a list of string elements. Link to comment Share on other sites More sharing options...
Pannel Posted May 19, 2011 Author Share Posted May 19, 2011 Thanks Fan, I think that I did want to work with some array elements so perhaps dependence on Pluggy may be worth it. Link to comment Share on other sites More sharing options...
AndalayBay Posted May 19, 2011 Share Posted May 19, 2011 RunBatchScript only replicates what you can do in the console. If you can type the command in the console, you can put it in a RunBatchScript. That's all it does. Pluggy is a great tool, but a lot of players can't run it. Unfortunately I must include myself in those ranks. It crashes my game every time. Link to comment Share on other sites More sharing options...
Astymma Posted May 20, 2011 Share Posted May 20, 2011 (edited) You may want to explicitly state what it is you're doing that might require Pluggy. Myself, and I'm sure AndalayBay and Fore, have experience working with OBSE runBatchScript solutions to problems specifically tailored to eliminate the Pluggy requirement since it IS quite installation dependent and many users cannot seem to get it to function no matter what they try. Perhaps we can find an alternative that is OBSE reliant only? Edited May 20, 2011 by Astymma Link to comment Share on other sites More sharing options...
Recommended Posts