|--------------------------------------------------------------------------------
|
| File 3mkey.mac
|
| Author: Dewey2461
| Release: Dec 28th 2007
|
| Fixed: 12/9/2022 by Dr00d69 aka ChicagoMedic to work with modern EQ
| Thanks Dewey
|
| Updated: April 26, 2026 by Onimal to fix some logic issues.
|
| 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 keySlot int outer
/declare baseline int outer 0
/declare current int outer 0
/declare checkDoor int outer 0
/declare checkTooth int outer 0
/declare checkTimer timer outer
/declare i int outer
/declare j int outer
/declare skipTo int outer
/declare zoned int outer 0
/if (!${FindItem[${key}].ID}) {
/echo ${key} not found -- 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
| Get initial baseline
/call CheckDoor
/if (${zoned}) /return
/varset baseline ${current}
/echo Baseline: ${baseline} teeth wrong
/for i 1 to 8
/echo ---------------------------------------------------------------
/echo Testing tooth ${i} -- Baseline: ${baseline} wrong
| Skip to tooth i: double-toggle teeth 1 through i-1
/varcalc skipTo ${i}-1
/if (${skipTo} > 0) {
/for j 1 to ${skipTo}
/echo Skipping tooth ${j}
/call ToggleTooth
/delay 1s
/call ToggleTooth
/delay 5s
/next j
}
| Toggle tooth i to test
/echo Toggling tooth ${i} to test
/call ToggleTooth
/delay 1s
| Check door
/call CheckDoor
/if (${zoned}) /return
/if (${current} < ${baseline}) {
| Count dropped -- this toggle fixed it
/echo Tooth ${i} FIXED. (${baseline} -> ${current})
/varset baseline ${current}
} else {
| Count went up -- tooth was already correct. Undo.
/echo Tooth ${i} was correct. Undoing. (${baseline} -> ${current})
/varcalc skipTo ${i}-1
/if (${skipTo} > 0) {
/for j 1 to ${skipTo}
/echo Skipping tooth ${j} (revert)
/call ToggleTooth
/delay 1s
/call ToggleTooth
/delay 5s
/next j
}
/call ToggleTooth
/delay 1s
/call CheckDoor
/if (${zoned}) /return
/varset baseline ${current}
}
/next i
| If we get here, all 8 tested. Try the door one more time.
/echo All 8 teeth tested. Checking door...
/call CheckDoor
/if (${zoned}) /return
/echo Still ${current} wrong. Restarting pass...
/return
sub CheckDoor
/varset checkTimer 10s
/varset checkDoor 0
/varset zoned 0
/keypress use
:CheckDoorWait
/doevents
/if (!${checkDoor} && !${checkTimer}) {
| No error message came back -- we probably zoned
/echo No response from door -- likely zoned. Success!
/varset zoned 1
/return
}
/if (!${checkDoor}) /goto :CheckDoorWait
/return
sub ToggleTooth
/varset checkTimer 3s
/varset checkTooth 0
/useitem "clockwork key"
:CheckToothWait
/doevents
/if (!${checkTooth} && !${checkTimer}) {
/echo No tooth response. Exiting.
/end
}
/if (!${checkTooth}) /goto :CheckToothWait
/return
sub Event_KeyCombo(string line, string numWrong)
/echo Door says: ${numWrong} teeth wrong
/varset current ${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