Keypad EventsUploaded by Jetz
Apr 22nd 2019, 5:47 PM
This is an event mod which allows the creation of keypads with input and output events. Its main feature is the ability to store passwords in a way that makes them resistant to saving the build and examining the events. However, this feature means it is slightly more complicated to use than an ordinary event.
You can view the full details and see an example save in the original thread, here: https://forum.blockland.us/index.php?topic=314727
The fast version is that you cannot set a keypad's password directly through the wrench events menu. You do it by looking at the brick and using a server command, which will take the password you give it and mix it with a secret password provided by the server, creating a hash that won't work on any other server.
It utilizes four primary events:
- fxDTSBrick::keypadInputChar - Output - Takes a single character, and adds it to the client's input text. Works with any Torque supported character, and is case sensitive.
- fxDTSBrick::keypadTest - Output - Checks the client's input against a hash and calls the appropriate input event on this brick. See below for more details. Leaving the hash blank will instead clear the client's input text.
- fxDTSBrick::onKeypadCorrect and fxDTSBrick::onKeypadIncorrect - Inputs - Called by keypadTest depending on whether or not the client's input was correct.
It also offers three server commands:
- /setBrickPassword [password] - Sets the value of the keypadTest event on the brick you're looking at. Must be holding a wrench, must have access to the brick's wrench events, and the brick must have exactly one keypadTest output event enabled.
- /setKeypadSalt [salt] - Super Admin only. Sets the server's salt string, which is used in the hash function for every brick password.
- /keypadSaltHelp - Displays a summary of how salt strings work. Super Admins should educate themselves with this before meddling with the server's salt string.
Quick Start Guide
For server hosts:
First, install and enable the mod. When you start the server, type "/setKeypadSalt abc123", substituting in a unique password. This password will be visible to your super admins. If you ever load your keypads on a different server, or if your server preferences ever get cleared, you will have to use the same keypad salt when you enter the command again. If you lose your keypad salt, all keypad test events in your build will have to be manually reset.
To build a keypad:
To build your keypad, you can start by creating a bunch of buttons with prints on them, using "onActivate->Self->keypadInputChar->X" where X is the brick's letter or number. You can also add events for any effects or sounds you want the button to have when you press it. Optionally, add a clear button that has the event "onActivate->Self->keypadTest->[empty string]". Then, set up an enter button with "onActivate->Self->keypadTest->[hash]", plus further onKeypadCorrect and onKeypadIncorrect events. Finally, fill in the "hash" portion of the keypadTest event by looking at the enter button, equipping a wrench, and typing in "/setBrickPassword 321password", substituting in your brick's password. You can then test your keypad by typing in the password on it, and pressing the enter button.