≡

Please disable your ad blocker to support our website.

M

MMM Key Clicker

MQ2 Resource

Download
Authordr00d69
First releaseDec 10, 2022
Last updateDec 10, 2022

Configs the MMM key for you.

Have key in inventory slot. Be in first person in front of the door. Type /mac mmmkey

It's old, and I didn't update all of it to be more efficient, but it works.

|--------------------------------------------------------------------------------
|
| File mmmkey.mac
|
| Author: Dewey2461
|
| Release: Dec 28th 2007
|
| Fixed: 12/9/2022 by Dr00d69 aka ChicagoMedic to work with modern EQ
| Thanks Dewey
|
| Purpose : As part of the Meldrath's Majestic Mansion key process you get a
|    Clockwork Key which must be configured by each person.
|
|    To do this you put your key in one of your primary slots (ie clicky)
|    and press 'U' at the entrance to MMM and get a message like:
|
|    There are 5 teeth placed incorrectly with ...
|
|    You then get to play a guessing game which involves clicking the key
|    to insert and remove teeth, pausing 2sec to move to next tooth then
|    clicking once to chance or twice to keep the same.
|
|    I'm not sure which was worse, writing this or doing it by hand ...
|
|--------------------------------------------------------------------------------
|
|  USAGE : Place your Clockwork key in your inventory NOT in a bag.
|          Stand in front of the MMM door.
|          /mac 3mkey
|          Go get a coffee .
|
|--------------------------------------------------------------------------------


#event KeyCombo "There are #1# teeth placed incorrectly with #*#"
#event KeyCombo "There is #1# tooth placed incorrectly with #*#"
#event ToothIns "Tooth #1# Inserted."
#event ToothDel "Tooth #1# Removed."

sub Main
    /declare key string outer Clockwork Key
    /declare keyPos  int outer 0
    /declare keyGood int outer 0
    /declare keySlot int outer

    /declare keyLastPlaced int outer
    /declare keyCurrPlaced int outer
   

    /declare checkDoor int outer 0
    /declare checkTooth int outer 0
    /declare checkTimer timer outer
   
    /declare i int outer

    /if (!${FindItem[${key}].ID}) {
        /echo ${key} not found so exiting ...
        /return
    }

    /varset keySlot ${FindItem[${key}].InvSlot}
   
    /if (${keySlot} < 23 || ${keySlot} > 30) {
        /echo Move key from bag to open inventory slot and run again
        /return
    }

    /doevents
    /doevents

    /call CheckDoor

    /echo Starting key configuration -- Please stand by.



    :TestNextKey
    |-- At this point we just press use and got number.
    |-- So need to cycle to next keyPos

    /echo -----------------------------------------------------------------------
    /echo keyPos = ${keyPos} | Last = ${keyLastPlaced} | Curr = ${keyCurrPlaced}

    |-- This loop keeps all teeth we have flipped the same

    /varcalc keyGood ${keyPos}-1
    /if (${keyGood}>0) {
        /for i 1 to ${keyGood}
            /call ToggleTooth
            /call ToggleTooth
            /delay 6s
        /next i
    }

    /echo |-- Was the last one correct change?

    /if (${keyLastPlaced}==0) {
        /echo first time so don't know.
        /echo last = ${keyLastPlaced}
    } else /if (${keyCurrPlaced} >= ${keyLastPlaced}) {
        /echo Got worse so reset tooth ${keyPos} back
        /call ToggleTooth
        /doevents
        /delay 4s
    } else {
        /echo Got better or same so leave tooth ${keyPos} same
        /call ToggleTooth
        /call ToggleTooth
        /doevents
        /delay 4s
    }
    /doevents
    /echo Set next tooth
    /call ToggleTooth
    /doevents

    /varcal keyPos ${keyPos}+1
    /varset keyLastPlaced ${keyCurrPlaced}

    /delay 6s
    /call CheckDoor
    /goto :TestNextKey



/return


sub CheckDoor
    /varset checkTimer 3s  
    /varset checkDoor 0

    /echo Using Door
    /keypress use

    :CheckDoorInRange
        /doevents
        /if (!${checkDoor} && !${checkTimer}) {
            /echo Must be in front of the door to configure key.-- Exiting.
            /end
        }
    /if (!${checkDoor})    /goto :CheckDoorInRange
/return


sub ToggleTooth
    /varset checkTimer 2s  
    /varset checkTooth 0

    /echo Clicking tooth
    /useitem "clockwork key"

    :CheckToothInRange
        /doevents
        /if (!${checkTooth} && !${checkTimer}) {
            /echo No tooth response in 2s -- Exiting.
            /end
        }

    /if (!${checkTooth})    /goto :CheckToothInRange
/return




sub Event_KeyCombo(string line, string numWrong)
    /echo There are ${numWrong} teeth placed inncorrectly
    /varset keyCurrPlaced ${numWrong}
    /varset checkDoor 1
/return

sub Event_ToothIns(string line, string numTooth)
    /echo Tooth ${numTooth} inserted.
    /varset checkTooth 1
/return

sub Event_ToothDel(string line, string numTooth)
    /echo Tooth ${numTooth} removed.
    /varset checkTooth 1
/return