Posted by: ZylonBane
« on: 10. May 2024, 16:07:06 »I thought it would be fun to play a little code golf with disabling keypads for which the code hasn't been found yet. This is the best I could come up with. Add to the keypad script.
Also, this setup can be extended to detect when a code is entered prematurely:
Code: [Select]
function OnFrobWorldBegin() {
local c;
local code = GetProperty("KeypadCode");
local codes = [[45100, "2_4"], [12451, "2_7"], [98383, "2_8"], [59004, "1_11"], [34760, "1_10"], [15061, "1_8"], [94834, "1_12"], [11111, "5_8"], [34093, "5_6"], [13433, "4_6"], [83273, "6_11"]];
foreach (c in codes)
if (code == c[0] || code == c[0] * 10)
SetProperty("KeypadCode", c[0] * (Quest.Exists("Note_" + c[1]) ? 1 : 10));
}
Doesn't handle the Rec deck art codes, of course. That would require a few more lines.Also, this setup can be extended to detect when a code is entered prematurely:
Code: [Select]
function OnKeypadDone() {
if (message().code == GetProperty("KeypadCode") / 10) {
print("cheater!");
}
}