|
|
Bots:A bot is nothing more than a palace client running with a sufficiently complex cyborg.ipt file that you can control the bot client from another client. Thus, bots are like robots in palacespace. Fido and Rex were my first major iptscrae creation, and I am still very much emotionally attached to them. They mostly evolved over a three week period in January of '99 until they reached the form that they now have. Only tiny modifications were made after that, until today, Sept. 9, 1999, when I added and tested the dynamically reprogramable feature which makes used of the allscray backdoor (explained below). Fido and Rex are a two bot team which can be run seperately, or in conjunction with one another. They mostly simulate two dogs which will do simple tricks for the general public, and can be put into various functional modes by the master. In these modes, Fido will jostle about as if he were alive (jittering mode), go room to room and ask people if they want to play with him (wandering mode), stay if people do (staying mode), report back to the master via esp of his whereabouts (reporting mode), and inform the master via esp what people in another room are saying about him (detailing mode). Fido and Rex also switch rooms and/or palaces upon command from the master; and, through a built in allscray backdoor, they can be made to execute any iptscrae. In fact, through this backdoor, you can reprogram Fido and Rex on the fly, without having to edit their Cyborg.ipt file, or reload scripts!!! Fido and Rex were originally created to live at Main, but I quickly discovered that there were enough snerts there to cause me no end of trouble. Before one of my bots might be killed by a Main Wiz, I figured enough is enough and took them elsewhere. I have had Fido continuously active for up to several weeks on end without ever touching the bot client program, and only directing its actions through commands issued within the palace environment from a master client. They've lived mostly at Classic (now defunct) and at Virtual (palace://virtual.dyc.edu:9998). They can now sometimes be seen at Paradox (palace://neon.communities.com:10180). The following two links are for Fido and Rex's Cyborg.ipt files. fido.txt (Please read the terms of use!) You will also need to get the props for them. These, as well as a demonstartion of how Fido and Rex operate are available here. You can also email me at noname@virtual.dyc.edu |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Documentation:0. Fido and Rex are identical in every respect, save one. Whereas Fido will say "woof", Rex says "arff". Their Cyborg.ipt files are identical, except "woof" is replaced by "arff", "fido" by "rex" and "rex" by "fido" in Rex's Cyborg.ipt file. Please note that all strings are converted to lower case in the scripts, so all strings, including the master's name, must be entered in lower case in the Cyborg.ipt file. (Lol ... what happens if you don't? Look at the scripts and think about it.) Below, I only discuss how Fido works, since Rex is the same. 1. The Public Commands. The first set of commands are straight forward ones which anyone can have Fido do. They are meant to simulate dog tricks. If you say Fido's name and the command anywhere in the same sentence, the dog will execute the command. For example, if you say any of the following Fido help then Fido will whisper to you how he works. The key words are 'fido' and 'help' --- as long as any of the two words are in the same sentence, Fido will execute the command. The scripts do a rudimentary parsing of English to interpret the command, and also ignore case. The list of Public Commands follows:
2. The Five Modes. Fido has four different modes which can be toggled on/off by the master (jittering, reporting, detailing, wandering), and one which can be toggled by any user when Fido is in wandering mode (staying). To put Fido into jittering mode, for example, the master need only say fido jittering on Of course, because of the parsing and case-insensitivity, this command can also be issued as Fido, I'd like you to turn jittering on, if you don't mind or even on fido jittering To turn jittering off, the master need only say fido jittering off The other four master controlled modes work the same. The stay mode is different and will be explained. Let's look at what each mode does:
The rooms which Fido will visit in wandering mode are randomly chosen from a preset array. This array can be found in the ON SIGNON section of the Cyborg.ipt file.
3. Auxiliary Master Commands. In addition to the above modes, there are some master-only auxiliary commands which are used for controlling Fido. In some cases, the master must say Fido's name in the command, in other cases no --- I was sloppier here because these commands were dynamically changed to fit my needs at the time. Also, the order of the words in parsing is more sensitive, so be careful. Look at the Cyborg.ipt for guidance. I've tried to indicate this as best I can in the following table.
4. Reprogramming on the fly. I had put Fido and Rex aside for quite some time since early April, and while I used them, I really did not develop them further, except for some tweeking. When I finally felt that I could emotionally give them up, I decided to write this web page. On the very day I did, Sept. 9, I realized that I could reprogram Fido on the fly via the allscray backdoor. It only took me a few minutes to confirm that one could redefine global variables and atoms via the allscrae command. Eureka! I quickly added ten trivial global atoms and corresponding flags which are meant to be redefined on the fly. Now Fido and Rex's scripts can be modified without editing the Cyborg.ipt file and reloading scripts. Before I describe how this works, be warned. If you do not have a thorough understanding of iptscrae and how Fido works, you will probably cause a crash. This may not be so bad, and you are invited to play, but keep this warning in mind. This is especially important when it comes to turning the flags on, so that the newly defined global atoms can be executed in the ON INCHAT section. 4a. Redefining the reprogrammable atoms and executing them purely via the allscray backdoor. There are ten trivial global atoms defined in the ON SIGNON section which look as follows: program0 GLOBAL { { "0 empty" SAY } lowchat "ptest" SUBSTR namesaid AND IF } program0 DEF Why these are defined as they are, we shall see in the next section. For now, it is sufficient to realize that they can be redefined via the allscrae command. Thus, if the master says fido allscrae { "hehe" SAY } program0 DEF then the definition of program0 changes and becomes { "hehe" SAY }. Fido can now be made to execute this atom by the master saying fido allscrae program0 EXEC at which Fido will say "hehe". This atom can be repeatedly executed now by rechatting the above line. If the master wants to change what program0 does, he can redefine the atom again as above. For example, fido allscrae { 0 i = { i IOTA SAY i++ }{ i 10 < } WHILE } program0 DEF This atom programs Fido to count from 0 to 9, but is not executed until Fido is commanded to do so by fido allscrae program0 EXEC At present, Fido has 10 such trivial global atoms meant for reprograming, program0 to program9. Although you could also reprogram the global atom randroom, it is not recommended that you do so because this is the atom which Fido uses for wandering mode. However, it is sometimes useful to redefine some of the standard global variables Fido uses. For example, fido allscrae "the hunter" master = changes the master to the user called "The Hunter" --- the master's name can be in any case, but when setting this variable, the string must be completely in lower case. Since any of the global variables can be changed this way, you have complete control over the status of Fido's internal state. Careful though! Think about what you are doing because you can mess him up this way --- reloading scripts and relogging onto the server will restore him. (What happens if you define a global atom that redefine other global variables or atoms, including itself?) 4b. Redefining the reprogrammable atoms and allowing them to be executed via the ON INCHAT section. There are 10 flags associated with the ten reprogrammable atoms, run0 for program0, run1 for program1, etc. By default, these flags are off, i.e. set to zero, but any flag can be turned on. For instance, to turn flag 2 on, the master need only say fido flag 2 on and, to turn it off, fido flag 2 off with the usual freedom due to the parsing and case-insensitivity. The action of turning on the flags can be seen from the following code which is in the ON INCHAT section: { program0 EXEC } run0 IF Thus, if flag 2 is turned on, then run2 is set to 1 (true), and each time an INCHAT event occurs, program2 is executed. Now, program2 is by default set to { "2 empty" SAY } lowchat "ptest" SUBSTR namesaid AND IF Thus, if Fido hears his name and the word "ptest" in any sentence, he will respond with "2 empty". This is fairly trivial until you realize that program2 can be redefined via the allscrae backdoor. Thus, suppose you want Fido to say "My master is so-and-so" when he hears the command "Fido, who's your master?". You can redefine program2 as follows, fido allscrae { { "My master is " master & SAY } lowchat "your master?" SUBSTR namesaid AND IF } program2 DEF Using this technique, you can increase the number of public commands (or indeed, any other types of commands) that Fido can execute without ever touching his client program or editing the Cyborg.ipt file. In sum, via this technique, Fido is programmable on the fly!!! A final caveat about this technique. Suppose you have flag 2 on, and redefine program2 as follows: fido allscrae { "oh no!" SAY } program2 DEF In effect, what you've done is created a piece of code which looks like: ON INCHAT {"oh no!" SAY which acts as follows: whenever, Fido hears anything, including himself saying "oh no!", he says "oh no!". Thus, he is stuck in an infinite loop. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Nuts and Bots:Fido and Rex are complex scripts. There are two reasons for this: 1) They make use of some sublte techniques, some of which I've adopted, some of which I've invented myself. 2) These subtle techniques are interwoven with one another so that they are not obvious. Since the reason I am making Fido and Rex public domain is educational, I want to unravel these techniques in this section --- I am thinking here primarily of those young adults that I've befriended on palace and who will one day no doubt be excellent computer experts. 1. Responding to commands. Obviously, since the bot will not initiate anything itself, all of its action must originate from INCHAT events, even if these trigger other events in some chain reaction. Thus, two exemplary bot command may have the following form: ON INCHAT {CHATSTR "fido" SUBSTR namesaid = Here's what these lines do: the second line sets namesaid to true (value 1) if the name "fido" is said, otherwise its set to false (value 0). The third line responds "hi" to the word "hello" if said in conjunction with Fido's name. The forth line initiates a room change, and when Fido enters the new room, he says "I'm a bot". 2. Continuous rescheduling. Some of the modes operate by continuosly rescheduling an event in the future as long as certain conditions are met. In particular, jittering is a continuous rescheduling of an av switch and move, wandering is continuously rescheduling a room change, etc. This continuous rescheduling can be done either entirely within one event handler (like ON INCHAT) or between two event handlers (like ON INCHAT and ON ENTER). Here's an example of the former, based loosely on the jittering mode: ON ENTER { flag GLOBAL 0 flag = } ON INCHAT { flag GLOBAL } Here's how this code works: When entering a room, the flag variable is initially set to zero (false). If the command "start" is chatted by the master and heard by the bot, this script sets flag to one (true), and then says the word "purr". The bot hears itself saying the word "purr" and schedules itself to say "purr" again 300 ticks (5 seconds) in the future. It then hears itself again and repeats the process. The condition in the last line fails, however, if flag is set to zero (false), which the script will do if the bot hears the word "stop" said. This is the fundamental way in which the rescheduling works for jittering. The other technique, used in wandering mode, bounces the rescheduling between ON INCHAT and ON ENTER: ON SIGNON { wandering GLOBAL 0 wandering = } ON INCHAT { wandering GLOBAL } ON ENTER { wandering GLOBAL } The ON SIGNON initializes wandering to zero (false), and defines the room changing atom, randroom. When the bot hears the command "on", it sets wandering to one (true), and executes a random room changes. Once it enters a new room, the script schedules the bot to say "!" 3600 ticks (one minute) in the future. When the bot hears that "!", it again executes a random room change and again reschedules saying "!" in the future. This repeats until the bot hears "off". When it does, the script sets wandering to zero (false), and the condition in the last line of the ON INCHAT section fails when the bot hears itself say "!"; thus stops wandering. 3. The allscray backdoor and reprogrammable atoms. Consider the following short cyborg.ipt: ON SIGNON { run GLOBAL 0 run = } ON INCHAT { run GLOBAL } Line four in the ON INCHAT section is the allscray backdoor. When the bot hears "allscrae <iptscrae>", it greps out the <iptscrae> and executes it. This in itself is useful, because it means that you can make the bot do any iptscrae you want. Beyond just banal iptscrae, this backdoor allows the possibility of reprogramming the bot on the fly. Among the possible allscray commands, one can issue the following: allscrae { <atom list> } program DEF which redefines the atom, 'program', to { <atom list> }, and the latter can then be executed via allscrae program EXEC However, 'program' will not be executed at line three in the ON INCHAT section, unless run is set to one (true), which can be done via line five in the ON INCHAT section by the master issuing the command "on". This can be disabled by the master issuing the command "off". Thus, if the master issues the following two commands on then everytime the bot hears "Who are you?", it responds with "My name is Fido". There is a lot more to Fido and Rex, but the rest is less subtle, albeit complex. Have fun and email me comments: noname@virtual.dyc.edu |