![]() |
||||
| |
Atpaw's MPI code Authenticate II - Simple modular 'authorisation' code for starship controls. Mr Cloak - 'Morph'-style MPI program for starships.
Authenticate II This is a much more modular, tidier and sleeker version of Authenticate, which was perhaps my first MPI 'program'. Authenticate was written for the CSA Raenne Corvidae, my first ship on FSM, to help prevent people from just walking on in and stealing the ship while people were offline. I never released the code for Authenticate because it was direly clunky and very inefficient - twenty if-thens one after the other. A few other features were added, too, such as announcing what ship the docking port was attached to, giving a random cabin temperature at around 295 degrees Kelvin, and a few other boring things. Then one day a friend asked me if I could build a ship for him, and really really liked the idea of Authenticate.. and shortly thereafter his ship was fitted with the very first 'copy' of the now-fit-for-human-consumption authentication code. Just a note - The docking-port code may not work at all on other MUCKs - in fact I'm quite certain it won't work, so if you're going to use this code elsewhere you may wish to the relevant bits, lest you receive many errors from a very confused MPI program. Yeah, Authenticate II's not much, and I'm sure it could be improved upon - but it's relatively compact, simple, and very easy to maintain.. And that's all that matters to me.
-------------- Locking your 'fly' action: @lock fly=locked:1 (This means the 'fly' action will be unlocked whenever the property 'locked' is set or stored to '1') @set fly=locked:1 (To unlock it for the time being) @fail fly=The computer beeps at you angrily. "The flight system is locked. Please authenticate your command over this ship" [authenticate] @ofail fly=tries to activate the ship's systems, but a soft metallic voice informs %o, "The flight system is locked." -------------- Installing the 'authenticate' action: #AUTHENTICATE is the #DBREF of 'authenticate'. @action authenticate=here @link authenticate=$nothing @succ authenticate=You ask the computer to authenticate your command.{if:{eq:authentic/_{name:me},{listprops:authentic,#AUTHENTICATE,_{name:me}}},{exec:authentic/_{name:me},#AUTHENTICATE},{exec:authentic/_badname}} @osucc authenticate=asks the computer to authenticate %p command over the ship. ---------------- Example prop: #DPORT is your docking port's #DBREF #FLY is your fly action's #DBREF NAME is a player-object's name. (ie: 'Atpaw') @set #AUTHENTICATE=authentic/_Atpaw:{null:{delay:1,{lit:{otell:A synthetic voice says\, "Authenticating.... Authenticated. Welcome to the bridge\, Captain Atpaw Xavier. All systems are nominal\, and reactor temperatures are within acceptable limits\. Internal ship temperature is a moderate {add:293,{dice:5}} degrees Kelvin\, and we are currently docked to {if:{prop:~dock/ship,#DPORT},{name:#{prop:~dock/ship,#DPORT}},no vessels}}."}}}{null:{store:1,locked,#FLY}{null:{delay:2,{lit:{otell:The ship's control systems chirp\, to show they have unlocked.,#AUTHENTICATE}}}}}
If Atpaw then tries to Authenticate his command over the ship, the following will occur: (Spoofed into the room he's standing in) A synthetic voice says, "Authenticating.... Authenticated. Welcome to the bridge, Captain Atpaw Xavier. All systems are nominal, and reactor temperatures are within acceptable limits. Internal ship temperature is a moderate 297 degrees Kelvin, and we are currently docked to no vessels." The fly command is unlocked. (Spoofed into the room he's standing in) The ship's control systems chirp, to show they have unlocked.
You will need greeting prop for each person you wish to be authorised to unlock the controls. So, one for Atpaw, one for Jayson, etc etc etc. Customise the general one (written below) and @set them all. This is very modular - if you want to add a new person, just add a new prop. If you want to remove a person, just @set #AUTHENTICATE =authentic/_NAME: (one space, then hit enter) and they will no longer be able to 'take command' and unlock the fly action. @set #AUTHENTICATE=authentic/_NAME:{null:{delay:1,{lit:{otell:A synthetic voice says\, "Authenticating.... Authenticated. Welcome to the bridge\, INSERT RANK AND NAME HERE. All systems are nominal\, and reactor temperatures are within acceptable limits\. Internal ship temperature is a moderate {add:293,{dice:5}} degrees Kelvin\, and we are currently docked to {if:{prop:~dock/ship,#DPORT},{name:#{prop:~dock/ship,#DPORT}},no vessels}}."}}}{null:{store:1,locked,#FLY}{null:{delay:2,{lit:{otell:The ship's control systems chirp\, to show they have unlocked.,#AUTHENTICATE}}}}} -------------- Failure: @set #AUTHENTICATE=authentic/_badname:{null:{delay:1,{lit:{otell:A synthetic voice says "Authenticating.... Failure. You are not authorised to command this vessel.".,#AUTHENTICATE}}}} Feel free to change the text there, just remember to put a backslash (\) after any commas you add. (See the other examples) ------------ Disabling: @action disable=here @link disable=$nothing @succ disable=You disable the ship's systems.{store:locked,2,#FLY} @osucc disable=disables the ship's systems. Mr Cloak 6000 - for holocloak ships and general prop-swappin' action. This code, like most of my stuff, revolves around three pieces of mpi:
Store, Force, and Exec (execute). These are described in the MPI Docs
of the MUCK (info mpidocs and info mpidocs2), so if you don't understand
how those MPI commands work, a read through the appropriate sections in
the mpidocs should help a little. And without further adu, on with the show. |
|||