Consent.mac with ini MQ2Data compliant

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Consent.mac with ini MQ2Data compliant

Post by Virtuoso65 » Thu Apr 22, 2004 3:31 am

Updated all new and shiny for the MQ2Data. New entrys auto append to the ini instead of overwrighting the first space now as old version did.

Code: Select all

|--- consent.mac V2 by Virtuoso65 ---
#define inipath "consent.ini"
#turbo
Sub Main
/zapvars
/declare rog global
/declare CG global 0
/declare a1 global
/varset a1 0
/declare c1 global
/varset c1 0
/declare e1 global
/varset e1 0
|--------------------------------------------
        /if (!${Defined[Param0]}) {
                /call Consentlist
        }
        /if (${String[@Param0].Equal[group]}) {
                /Call ConsentGroup
                /end
        }
        /if (${String[@Param0].Equal[list]}) {
                /Call ListINI
                /end
        }
        /if (${String[@Param0].Equal[help]}) {
                /call Help
                /end
        }
        /if (${Defined[Param0]}) {
                /goto :loop3
        }

|++++++++Adds new people into the consent list++++++++++++++++++++++++++++++++++++++

:loop3
/for c1 0 to 20
    /if (!${Bool[${Ini[inipath, consented, @c1]}]}) {
        /varset e1 @c1
        /goto :loop4
    }
/next c1

:loop4
/for a1 0 to 20
    /if (!${Defined[Param@a1]}) {
        /end
    }
    /ini "inipath" consented ${Int[@e1]} @Param@a1
    /echo ${Int[@e1]} - @Param@a1, Is being appended to the ini.
    /varadd e1 1
/next a1
/return

|-------Help for those who need it---------------------------------------

Sub Help
/echo If you add names by leaving params after mac call ie. /mac consent name1 name2 ...name(N).
/echo If you want to consent your group then /mac consent group.
/echo If you do not specify add params and it will consent the people in the ini.
/echo if you forgot who is on your consent list then type /mac consent list.
/return


|------Consents people on your list----------------------------------------

Sub Consentlist
/for c1 0 to 20
    /if (!${Bool[${Ini[inipath, consented, @c1]}]}) {
        /if (@c1<0) {
            /echo There is noone on your consent list. Try /mac consent help.
            /end
        } else /end
    }
    /echo Consenting ${Ini[inipath, consented, @c1]}.
    /varset rog ${Ini[inipath, consented, @c1]}
    /consent @rog
    /delay 3s
/next c1
/return

|-------Consents people in your group---------------------------------------

Sub ConsentGroup
    /if (!${Me.Grouped}) {
        /echo You do not have a group, go find one.
        /end
    }
/for CG 1 to ${Group}
    /if (!${Me.Grouped}) /end
    /varset rog ${Group[@CG]}
    /echo @rog is being consented.
|    /delay 3s
    /consent @rog
/next CG
/return

|-------Lists people on your ini---------------------------------------

Sub ListINI
/echo Players on Consent.ini list.
/for c1 0 to 20
    /if (!${Bool[${Ini[inipath, consented, @c1]}]}) {
        /if (@c1<0) {
            /echo There is noone on your consent list. Try /mac consent help.
            /end
        } else /end
    }
    /varset rog ${Ini[inipath, consented, @c1]}
    /echo @rog
/next c1
/return

Flea
a lesser mummy
a lesser mummy
Posts: 55
Joined: Fri Dec 26, 2003 4:56 am

Post by Flea » Thu Apr 22, 2004 10:40 am

Format for ini?

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Post by Virtuoso65 » Thu Apr 22, 2004 12:26 pm

The ini will auto generate when you run the macro and will look something like this.

consent.ini

Code: Select all

[consented]
0=name1
1=name2
2=name3

In my guild it is common practice to consent all rogues when you die on raids like time or what ever. Instead of manually typing them all out I went the more automated rout and just entered every rogues name into the mac so all I have to do is type /mac consent.