INI files? what's that?, welp!, When a script means ini files, he/she is talking about the text files with the extension .ini, ini isn't just a ordinary text file it has a certain structure, which make's it great for reading/writeing data, so how doe's this structure look like?
The structer:
[Topic]
Item1=Data
Item2=Data
Item3=Data
A example:
[Animals]
Dog=Yes
Cat=No
Fish=Yes
If you open up your mirc.ini file, from you'r mirc directory. You can see mIRC it self, use's this too, to read/write settings. There is 2 stuff you only really need to know, when your using INI files. The /writeini command, which write's into a ini file. And the $readini identifier which read's the data.
Let's make a little short script, which writes to a ini file, and then read's from it. Goto your alias section and use this.
memo {
writeini $mircdirmemo.ini MyMemo Saturday Going to a Party..
writeini $mircdirmemo.ini MyMemo Sunday Pick up some freinds..
}
Now the alias is being trigged by using /memo as command, it then writes. 2 lines to a file called memo.ini in your mirc directory, "MyMemo" is the Topic. And Saturday and Sunday, are sub item's under the topic "MyMemo", The data of Saturday is "Going to a Party..", and the data of Sunday is "Pick up some freinds.."
The structer of the following above would look like:
[MyMemo]
Saturday=Going to a Party..
Sunday=Pick up some freinds..
Now we need to read from the ini files, let's say you wan't to know what your doing on saturday, by using a /command. Again go to your alias section and use:
memoread {
%memo = $readini($mircdirmemo.ini,MyMemo,$1)
; saveing the data in %memo variable.
if (%memo) echo -a * Your doing the following on $1 - %memo
; IF memo contains data, then echo what your doing.
else echo -a * Another boring day?
; else just say "another boring day?"
}
You can now use /memoread day, to check what your doing the following day. For example: /memoread saturday
The "If" that's being used in /memoread i will tell you about later, But for now
it's important that you understand the structer of ini files, and how to write to them
and reading from them.
? Discuss This Article here.
|