Read and Writing to a INI

LueLusten

Veteran
Veteran
Joined
Apr 9, 2015
Messages
67
Reaction score
8
First Language
English
Primarily Uses
I am trying to use Zeriab's ini example to read and right to the Game ini for now

module INI READ_INI = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l') WRITE_INI = Win32API.new('kernel32', 'WritePrivateProfileStringA', %w(p p p p), 'l') def self.Read(key_name, app_name = 'Game', filename = 'Game.ini', buffer_size = 256, default = '') buffer = "\0" * buffer_size READ_INI.call(app_name, key_name, default, buffer, buffer_size - 1, ".\\" + filename) return buffer.delete("\0") end def self.Write(key_name, value, app_name = 'Game', filename = 'Game.ini') return WRITE_INI.call(app_name, key_name, value.to_s, ".\\" + filename) endendThen I call it:

if !GCL.include?("BootLoader_0395") if GCL.include?("test") or GCL.include?("debug") msgbox(INI.Read("DTitle")) else exit endendGame.ini for now

[Game]RTP=Library=System\RGSS301.dllScripts=Data\Scripts.rvdata2Title=Launcher, Game, Maker testDescription=Custom Launcher what supports test/debugging test.CreationDate=[Launcher]DTitle=James BondI am not getting any errors but the message box that is prompted is blank no message in it saying James Bond, also how would I move the save's and get the ini to read from the documents folder of that logged in user.

I really don't get ruby at all, I am a Lua man myself and I just can't get my head around these calls at times, could you give us a hand.

Also another question how do I set the title of the message box or would I have to call a message box via the winapi to be able to set the message box title?
 

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses
Because the script doesn't do any kind of error checking. The default section is Game, but DTitle's section is Launcher:

msgbox(INI.Read("DTitle", 'Launcher')) 
would I have to call a message box via the winapi to be able to set the message box title?
Yes. Buttons, icons, caption, and so on can't be changed with Kernel#msgbox and Kernel#msgbox_p.
 

LueLusten

Veteran
Veteran
Joined
Apr 9, 2015
Messages
67
Reaction score
8
First Language
English
Primarily Uses
Because the script doesn't do any kind of error checking. The default section is Game, but DTitle's section is Launcher:

msgbox(INI.Read("DTitle", 'Launcher')) Yes. Buttons, icons, caption, and so on can't be changed with Kernel#msgbox and Kernel#msgbox_p.
 Or ya now reading the arguments again on here about you put that it makes sense lol

And OK its not two hard to make a windows call can RPG Maker call other files does it have a IO for running exe's if anyone knows? as I can do advansted dialog calls from my launcher so I could just add a command listener to it to call custom styled dialogs.

?

Edit:

Also how would I make it save to the docs folder and how would I drop the save options in to a ini file?

Edit 2:

OK I found out how to send arguments back to my Launcher using the system command, so I can now create custom dialog box's on my own tool, What I need to know now is there a way to call my first script before the window is drawn as I don't want the dirty black window before it does it's checks?
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,854
Messages
1,016,998
Members
137,562
Latest member
tamedeathman
Top