Req/bug: /ini

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Req/bug: /ini

Post by kagonis » Wed Nov 05, 2003 5:19 am

The /ini command suffers from a few drawbacks, that I would either like to request, or fixed :)

First of all, the /ini command have no error checking what so ever.

Code: Select all

/ini
will create a file called ".ini" with the contents:

Code: Select all

[]
=

Code: Select all

/ini "file.ini"
will create a file called "file.ini" with the contents:

Code: Select all

[]
=

Code: Select all

/ini "file.ini" "section"
will create a file called "file.ini" with the contents:

Code: Select all

[section]
=

Code: Select all

/ini "file.ini" "section" "key"
will create a file called "file.ini" with the contents:

Code: Select all

[section]
key=
Alle the above examples should produce an error, or perhaps intelligently remove the key that has no value, or all keys from the section where no keys are defined etc. wich brings me to the actual request.

I would love to be able to remove at the very least keys from an ini file with a simple MQ command, perhaps even entire sections.

Hope it's possible :)

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Nov 05, 2003 9:21 am

Forgive me if this sounds harsh kagonis, but you can do that with notepad. I don't understand the need to add complexity to the program for something that can be done by hand just as easily.

If you could give me an example of where/when/why you would want to do this with MQ?
MQ2: Think of it as Evolution in action.

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Nov 05, 2003 9:28 am

With possibly only a minor amount of adjustments, you could do this with the in-game macro editor. It may be possible with the code Plazmic already has there (I'm not sure since last I looked, I believe it was putting .mac on the end of the file names if it didn't see it)

LordGiddion
a snow griffon
a snow griffon
Posts: 352
Joined: Sat Sep 13, 2003 6:12 pm
Contact:

Post by LordGiddion » Wed Nov 05, 2003 9:49 am

We have functions to set these in macros why not the ability to remove. If you want an example, in Genbot we've sometimes moved a ini setting from combat to core, it would be nice to be able to remove the setting from combat if it's still there just to clean things up and not confuse users.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Wed Nov 05, 2003 12:09 pm

Mckorr wrote:
I don't understand the need to add complexity to the program for something that can be done by hand just as easily.
Well, in that case let me just as blunt.
Why did you add the ini support in the first place then? It could be done just as easily by hand anyway.
You know just as well as I that your excuse is a bad excuse ;)
Every macro that has ini support would benefit from in-game key removal.

The tracking macro that I added in-game add/edit handling to would benefit from being able to remove as well.

The item linker I wrote would also benefit from it.

But more to what I was thinking, I would use the ini file for stuff like buff/debuff handling.

I bet that a numerous other handy pros could be found given the option, but limiting it with the reason "You can use notepad" is just plain wrong, and you know it, then the entire idea of /ini in the first place is lost.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Nov 05, 2003 12:15 pm

I'll be even more blunt. I didn't add it. I don't use it. So when I ask for an explanation of why you want it changed, perhaps you should explain it to me before I spend my time trying to recode it.

Better yet, fix it yourself and post the changes. The devs will check it for malicious code, test compile it, and if everything works we'll put it in.

Even better, think before you flame a dev who is only asking for more information.
MQ2: Think of it as Evolution in action.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Wed Nov 05, 2003 2:33 pm

I eh, would like that feature actually... maybe ill do something about it when I have time unless someone beats me to it...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Wed Nov 05, 2003 4:04 pm

Well I would use a feature like that in my collect macro. I store the yew leafs that are unreachable in an INI file so I can preserve them from session to session. Would be nice to clean out the INI file after a server reset.

Of course I could do this in notepad as suggested.

GeoffreyF67
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Nov 04, 2003 6:07 pm

Re: Req/bug: /ini

Post by GeoffreyF67 » Wed Nov 05, 2003 4:59 pm

kagonis wrote:The /ini command suffers from a few drawbacks, that I would either like to request, or fixed :)

... examples removed...

Alle the above examples should produce an error, or perhaps intelligently remove the key that has no value, or all keys from the section where no keys are defined etc. wich brings me to the actual request.

I would love to be able to remove at the very least keys from an ini file with a simple MQ command, perhaps even entire sections.

Hope it's possible :)
I believe this should at least generate an error and stop an incorrect entry from being written. I can't test this atm because I don't have a working MacroQuest but the addition is pretty trivial. This would go in the IniOutput function in the EQLib_Commands.cpp file before

Code: Select all

if (!WritePrivateProfileString(szArg2,szArg3,szArg4,szArg1)) {

Code: Select all

   if ((strlen(szArg1)==0) || (strlen(szArg2)==0) || (strlen(szArg3)==0) || (strlen(szArg4)==0))
   {
	   sprintf(szOutput,"IniOutput Write Failed Due to Missing Parameter(s).");
	   WriteChatBuffer(szOutput, CONCOLOR_RED);
   } else {
Edit: I have no idea how to get this into the CVS if it does work as advertisd later...if someone would like to send me a PM and kindly point me in the right direction I could help with that.

Edit 2: Oops...Should have used == instead of = above :)
Last edited by GeoffreyF67 on Thu Nov 06, 2003 9:45 am, edited 1 time in total.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Wed Nov 05, 2003 5:15 pm

Mckorr, it wasn't a flame. I just gave back with the same currency, pointing out that by your logic the /ini write function shouldn't even exist, cause you can do that with notepad. And I gave you information / examples as you asked for.

It was a simple and polite question / request, and you start out be using a poor example as to why it wasn't / shouldn't be added, talking down to me in the process.

Basically any macro that uses an ini file to store information in, could benefit from being able to remove keys or entire sections as well.

To give specific examples from existing macros...

The tracking macro with ini support.
It's a great macro, to wich I added support for adding new mobs from within EQ. Now when you are no longer interested in having a specific mob in your current zone anymore, wouldn't it be much simpler to just be able to remove a key as well as you can add it?

The link storage macro I wrote.
When you no longer have any use for a macro in the file, to free up space (so the list isn't that big), wouldn't it be nice to be able to remove a key as well as add it?

Forage macro with ini support..
Again it's easy to add support for adding new forages to the ini, from within EQ, wouldn't it be equally nice to be able to remove forages you no longer wants from within EQ as well?

The same goes for the tradeskill macro that someone added ini support for. Being able to add an entire recipe as well as remove a faulty recipe from within EQ would be nice.

As for the buff/debuff (mostly debuff) macro I had in mind using it for, the idea was to add a key based on the mobs/NPCs/PCs id.
ie:

/ini "debuff.ini" "Name of the Spell" "$target(id)" "timestamp or expire time"
Now it would be kinda lame if I had to tab out and remove a key manually for every spell and every mob in this case.

GeoffreyF67
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Nov 04, 2003 6:07 pm

Post by GeoffreyF67 » Thu Nov 06, 2003 5:50 pm

I've added 2 new commands as well as the code above:

/INIDeleteSection <INI Filename> <Section Name>

Deletes the entire section including all keys in that section from the specified INI file.

/INIDeleteKey <INI Filename> <Section Name> <Key Name>

Deletes the key from a section in the specified INI file.

Here's a link to the 3 files that are affected. These were obtained from the 11/06/03 source.

http://www.team-maja.com/drplump/deletesectionkey.zip

DrPlump is graciously hosting the file because I'm paranoid about doing it on my own domain :)

Let me know if you have any problems with this.

G-Man