|
|
Leaving a message on a server.How can one leave a message on a server so that some other user can retrieve that message later? One of the easiest ways is to write the message in the room using the draw utility of palace. Another way is to encrypt the message as the spot state values of spots in a room. This works as follows: by running an encoding script, the message is translated into numerical values which are then stored in spots who retain these values as their spot states on the server; then, by running a decoding script, the values of the spot states are decoded and the message is given to the user as a local message in the room. The following link leads to the scripts for a room which can be added directly to your pserver.dat (or Mansion Script) file --- make sure there is no duplication of room number ids. Please note that this script will work on any server, but only works consistently with the Mac client. The Windows client sometime crashes upon entering the room. message.txt (Please read the terms of use!)
|
|
How to use the script.1. The person enters the room and leaves a message by saying "rec" followed by the message. E.g. rec Hello Jeff, I was here at noon but I missed you. Unfortunately, due to code limitations, only lower case letters can be encoded. Upper case letters are converted to lowercase. 2. Anyone can now retrieve the message by saying "play". If the previous message was recorded, then you will see the following local message played back: hello jeff, i was here at noon but i missed you. |
|
The Algorithm.The message is divided into groups of three letters, and then each group is mapped onto a value between 1 and 32768. This value is then stored as the spot state of a spot. The current room makes use of 40 spots for a maximum message length of 120 characters. The following characters are assigned the values between 1 and 32, respectively: a b c d e f g h i j k l m n o p q r s t u v w x y z " " . , ! ? ; So, for instance, the letter "h" is assigned the value 8, the letter "i" is assigned the value 9, and the symbol "!" is assigned the value 30. The group of characters "hi!" is then assigned the value 8 + 32*9 + 1024*30 = 31016 and this value is finally stored in a spot as its spot state --- note that 32*32 = 1024. The script repeatedly strips three letters at a time off the original message, and encodes them this way. To decode a message, the spot state values stored in the spots are converted back into groups of three letters, and the groups are then concatenated. Suppose a spot has spot state value 31016. The script first performs the following integer division 31016 / 1024 = 30 and the 30 is converted back to "!". The remainder from this division is given by 31016 % 1024 = 296 which the script then performs the following integer division on 296 / 32 = 9 The value 9 is mapped onto the letter "i". The remainder from this division is 296 % 32 = 8 which is mapped onto the letter "h". The group of three letters is then put together as "hi!". This is repeated until the entire message is retrieved. |