lexkymbeth Posted March 20, 2012 Author Share Posted March 20, 2012 Ive never done this and trying to load a ini file that has msges in it [kinda like a news system] i want the ini file to look like this```[MSG]1=MsgHere2=MsgHere3=MsgHere4=MsgHere5=MsgHere```And My code is```Public SeverEventsDim msgI As IntegerDim msg As StringmsgI = Int(Rnd() * 3)Select Case msgICase 0msg = "INI MSG"Case 1msg = "INI MSG"Case 2msg = "INI MSG"Case 3msg = "INI MSG"Case 4msg = "INI MSG"Case 5msg = "INI MSG"End SelectCall GlobalMsg("SeverEvents: " & msg, Blue)Call TextAdd("SeverEvents: " & msg)End Sub```I want the msgs in ini file to replace the Ini msg of courseThanks Link to comment Share on other sites More sharing options...
crzyone9584 Posted March 20, 2012 Share Posted March 20, 2012 in EO2.0 you would use GetVar("MSG", 1) if im not mistaking. Just search the source code for the GetVar sub or a method that calls the GetVar like LoadOptions sub and see how they do it there. Link to comment Share on other sites More sharing options...
lexkymbeth Posted March 20, 2012 Author Share Posted March 20, 2012 like..? msg = getvar("data/data.ini", "MSG", 1) Link to comment Share on other sites More sharing options...
crzyone9584 Posted March 20, 2012 Share Posted March 20, 2012 thats it. i forgot that the filename had to be there.but instead of data.ini rename that to the ini you have your msgs in and make sure the filepath is correct. Link to comment Share on other sites More sharing options...
RyokuHasu Posted March 20, 2012 Share Posted March 20, 2012 you can also write to .ini files using PutVar.But you wouldn't want to make any major systems based off reading .ini files, just sub systems and such Link to comment Share on other sites More sharing options...
Robin Posted March 20, 2012 Share Posted March 20, 2012 INI should only be used for dynamic file flow or manual editing requirements. It should also be cached 100% in memory. Link to comment Share on other sites More sharing options...
lexkymbeth Posted March 20, 2012 Author Share Posted March 20, 2012 Well im useig it so i dont have to edit code every single time i want to change the messages, thanks for the feed back. How do i cache it? Like const it to the string when it loads? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now