Removing an INI entry

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

EpicCamp
I like names that start with 'V'
Posts: 45
Joined: Wed Aug 11, 2004 8:39 pm

Removing an INI entry

Post by EpicCamp » Fri Feb 25, 2005 1:19 pm

Call me bored but I took a few minutes the other night to make a macro that is more or less a "Quote database". With Add/Remove commands via !commands in /tells or /gu people can add or remove quotes and !quote for a random one or !quote # for a specific #.

However, I need to know how to remove an INI entry from the file completely. So far all I know is how to null it basically but the value still exists. Due to the way my macro works it counts all the values as a quote, empty or not.

The INI is in format

[Custom]
1=quote here
2=quote here
3=quote here
4=

4= would be the one I just removed via setting it null from /ini.

Anyway to do this via macro or no?

-EpicCamp

User avatar
SimpleMynd_01
a lesser mummy
a lesser mummy
Posts: 71
Joined: Thu May 08, 2003 3:16 pm

Ever find a solution?

Post by SimpleMynd_01 » Thu Mar 10, 2005 2:15 pm

Hey Epic,

Did ya ever figure out how to remove the entry? I've come across a situation where I'd like to do the same thing...

Thanks!
-SimpleMynd

EpicCamp
I like names that start with 'V'
Posts: 45
Joined: Wed Aug 11, 2004 8:39 pm

Post by EpicCamp » Thu Mar 10, 2005 7:00 pm

I ended up just having the macro re-random if it encountered a null field. And to delete something, I just set the field to null.

Code: Select all

Sub CustomQuote(string thename, int specific, int chattype)
  :wait
  /if (${QuoteChatDelay}) /goto :wait

  /declare amtofquotes int local ${Ini[CustomQuotes.ini,Custom,-1,NO].Left[-1].Count[|]}
  /declare number int local 0

  :reroll
  /varcalc number ${Math.Rand[${amtofquotes}]} + 1

  /if (${specific}) /varset number ${specific}

  /if (${String[${Ini[CustomQuotes.ini,Custom,${number}]}].Equal[NULL]}) {
    /if (${specific}) {
      /if (${chattype} == 1) /gu Invalid or Blank Quote! (#${number})
      /if (${chattype} == 2) /tell ${thename} Invalid or Blank Quote! (#${number})
      /return
    } else {
      /goto :reroll
    }    
  }

  /echo Quote Spew! ${chattype}

  /if (${chattype} == 1) /gu #${number}: ${Ini[CustomQuotes.ini,Custom,${number}]}
  /if (${chattype} == 2) /tell ${thename} #${number}: ${Ini[CustomQuotes.ini,Custom,${number}]}

  /varset QuoteChatDelay 3s
/return
Not the prettiest thing. That function is in my quotes.inc include. Uses #Event's in my main macro to call it. There also remove and add quote functions. But you get the idea. Worked well enough for my implementation.

-EpicCamp

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:52 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:53 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:55 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:56 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:57 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:58 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 3:59 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 4:00 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 4:01 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 4:03 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 4:04 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Removing an INI entry

Post by xyilla » Wed Apr 16, 2025 4:05 am