Top

Hash Script Options from a config file


mIRC Code
+ 0 likes
Please Register to submit score.
Average Score  4.0
Scores Submitted  1
Date Added  Dec 23, 2006
Last Updated  Dec 27, 2006
Tags  hash  options  script  tables 
  Bookmark and Share

Introduction

READ THE DIRRECTIONS below, write in your scripts name where I tell you to below, copy and paste this into your script, adjust as needed. I kinda ripped this out of my latest project, so if I didn't wipe all my script's specific material, sorry.

Essentially this is hash tables for dummies. This allows you have user set options for your script, that are read from a config file. Maksure you change the text between the <>s to whatever it tells you.

1. Your script MUST be an INI, no .mrcs.
2. create the file <yourscript's name>.conf
3. put the text [options] at the top and
thisismyoption=myoptions value, and use ";"'s for comments explaining
what they are for the user to edit.
4. make sure all the <yourscriptnames> are the same thing, with NO SPACES ALLOWED
5. Again make sure you edit this properly, look at it in notepad before pasting.
6. options added
7. use this in ANY script you want. This gave me a few headaches figuring it out, so hopefully I saved you said headache.


edit: I don't use global variables simply because mIRC only can handle one variable file at a time.

If this variable file is unloaded, or someone's script that loads its own variable file is loaded, my code would cease to function.

edit2: besides hash tables rock my socks off. just cut paste, and use the fucking identifiers.

edit: forgot, the custom identifiers $yourscrip_options(option)
and $yourscript_version(name|version|original file) are used to access your data.

Grab the Code

Comments

  (4)  RSS
RoninWarrior
Comments: 252
 
mIRC Snippet:  Hash Script Options from a config file
Posted on Dec 23, 2006 6:30 pm
why not set it to were you can set your scriptname with % it will take an hour to change all of that .
Marshtomp
Comments: 39
 
mIRC Snippet:  Hash Script Options from a config file
Posted on Dec 24, 2006 6:55 am
RoninWarrior: Read the author notes.
It looks nice, but i have no experince in hash files.
xDaeMoN
Comments: 696
 
mIRC Snippet:  Hash Script Options from a config file
Posted on Dec 25, 2006 11:28 pm
Then create a custom identifier so it would be easier for the user to edit the configurations needed ;)

Sample:

alias _Scriptname return Script_name_here
alias _Scriptver return Script_version_here

Usage: $_Scriptname & $_Scriptver
Disturbed
Comments: 32
 
mIRC Snippet:  Hash Script Options from a config file
Posted on Dec 26, 2006 1:28 am
;o

Please Register or Login to start posting comments.
Bottom