Fido and Rex

 

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!)

rex.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

help fido

Help me Fido, please.

Will you please be a sweetie, and help me out, Fido?

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:

Command

Action

help

Fido whispers all the public commands to the user.

good

Fido dons a halo.

bad

Fido dons a pitchfork.

sit

Fido just dons his usual cute doggy prop and removes any others.

come

Fido comes and sits just below you.

go to <username>

Fido goes to that user. Note that the username need not be the full username, but can be any subset of letters which match. E.g. If the user is "Belladonna_X", then saying "Fido, go to bella" will work.

move

Fido moves in some random direction. This is useful for moving him off people when he lands on them by accident. I did have a script which made sure Fido would not land on anyone, but it was too laggy. A non-laggy script here would be nice.

play

Fido makes ten random jumps around the room as if running around.

speak

Fido says "woof woof <username> woof woof woof" where the username is that of the person issuing the command.

beg

Fido slides up to you from below and whines in an attempt to annoyingly obtain your attention.

roll

Fido flips back and forth between his right- and left-facing avs.

count to <number>

Fido counts up to that number by barking. E.g. "Fido count to 3" ... "woof woof woof". He cannot count to integers below 1 or above 10.

attack <username>

This is like "go to", except only the master can issue this command, and Fido sits on top of the user attacked and says "rrrrrrrrrr". (How cute!)

 

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:

Mode

Action

jittering

When Fido is in this mode, he will periodically (every 400 ticks, about 5 seconds) switch between his right- and lef- facing av, and make a small move in the same room. This gives Fido a life like quality, as if he is jostling about inside the room. It is a bit laggy, and so should not be used when the lag is high.

reporting

When Fido is in this mode, he will esp the master whenever he enters another room for whatever reason. This is useful when Fido is in wandering mode and is moving room to room on his own. The master need only look in the log to see what room Fido is currently in.

detailing

When Fido is in this mode, he will esp the master whenever he hears his name said by some user in the same room. He will esp the entire CHATSTR which contains his name. This is also useful in wandering mode because it esps back to the master what people are saying to Fido, and how they are interacting with him. I have never used it to "spy" on people, but it did give me satisfaction to see how people reacted to Fido. Also, when they were becoming annoyed at him, I could always go in and remove him.

wandering

When Fido is in this mode, he will periodically (every 3600 ticks, about 1 minute) move from the current room to another random room. When Fido enters the new room, he greets people by saying:

"I am a wondering bot"

"If you want me to stay and play, just say my name and the word 'stay'"

"If you want me to leave, just say my name and the word 'leave'"

"If you say nothing, I will leave of my own accord in one minute"

The users in that room can then have Fido stay or leave as they please. If someone asks Fido to stay, he then enters staying mode and does not leave that room. He is still in wandering mode, but his wandering is suspended until he exits staying mode.

staying

When Fido is in this mode, he will stay in a room as long as people keep chatting his name, even if his name is not used in conjunction with a recognized command. Every 3800 ticks (a little over one minute), Fido checks to see if his name has been chatted in the previous minute. If it has he, he continues to stay in that room. If it hasn't, he leave and continues wandering. He will also exit staying mode if someone asks him to leave, by saying "Fido leave".

Command in staying/wandering

Action

fido stay

This causes Fido to enter staying mode, remain in the room as long as his name is mentioned in any context, and suspend wandering.

fido leave

This causes Fido to exiting staying mode, leave the room, and continue wandering.

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.

Command

Action

fido allscrae <iptscrae>

This is the allscray backdoor. Unlike allscray placed in a room, this allscray is placed directly in the Cyborg.ipt file. Only the master can use it on Fido, and need not be in wiz or god mode. This backdoor can also be used to dynamically reprogram the bot as discussed in the next section. Note the spelling of allscrae --- I Latinized the ending for both aesthetic reasons, and so that the command would not be confused with the traditional "allscray". Note also that the parsing here is very sensitive to the order of the words --- "fido allscrae ..." must appear at the beginning and in that order.

to virtual, to paradox

Since I have Fido living at these two palaces, and often have him switch between them, I added a command which would have him log off from one, and connect to the other. For this command, you do not need to say his name --- why I did it this way, I don't know. Also, sometimes I want to switch between palaces with Fido, and sometimes I wanted him to switch alone. So, any command string with the words "to virtual" or "to paradox" would do. In my own Cyborg.ipt, I require an additional charachter, a final "!". So, if I want only Fido to switch, I say "to virtual"; if I want to switch with him, I say "to virtual!".

fido room <roomid>

When Fido hears this command, he switches to the room with id number <roomid>.

fido relay <roomid>: <message>

This command causes Fido to enter the room with id number <roomid>, chat <message> out loud and then return. This is good for relaying commands to the other dog who will respond to them as if they had been issued by the master him/herself. The users in the room will also see the message, but Fido is usually very fast, and they will have to look in their log. You can delay Fido's return by adding an ALARMEXEC in the ON ENTER part of the relay command; thus, everyone in the room can see the message more easily. I chose not to do this because I mostly use relay to remotely issue commands to the other dog --- one dog I put in wandering mode, while the other I keep with me and use to relay and fetch --- see the next command. Incidentally, this is why I created the two bot team: ON INCHAT does not respond to esp, so I get the other dog to do the dirty work for me. Note the parsing here is order sensitive.

fido fetch <roomid>

This command causes Fido to enter the room with id number <roomid>, and issue a command which has Rex return to the first room with Fido. This is clearly useful for using the one dog to fetch the other while the latter is in wandering mode. Note the parsing here is order sensitive.

fido status

Upon hearing this command, Fido will report on the status of his modes --- which of five modes are toggled on, and which are toggled off. The parsing here is insensitive to order.

fido flags

Upon hearing this command, Fido will report on which of the ten flags are toggled on, and which are toggled off. This command is used in conjunction with reprogramming via the allscray backdoor. The parsing here is insensitive to order.

 

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

program1 GLOBAL { { "1 empty" SAY } lowchat "ptest" SUBSTR namesaid AND IF } program1 DEF

program2 GLOBAL { { "2 empty" SAY } lowchat "ptest" SUBSTR namesaid AND IF } program2 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

{ program1 EXEC } run1 IF

{ program2 EXEC } run2 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 =

{ "hi" SAY } CHATSTR "hello" SUBTSR namesaid AND IF

{ 100 GOTOROOM } CHATSTR "leave" SUBSTR namesaid AND IF

}

ON ENTER {

"I'm a bot" SAY

}

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

{ 1 flag = "purr" SAY } CHATSTR "start" == IF

{ 0 flag = } CHATSTR "stop" == IF

{{ "purr" SAY } 300 ALARMEXEC } CHATSTR "purr" == WHOCHAT WHOME == AND flag AND IF

}

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 =

randroom GLOBAL

{

[ 86 87 88 89 90 97 98 99 117 240 ] roomarray =

ROOMID target =

{ roomarray roomarray LENGTH RANDOM GET target = }{ ROOMID target == } WHILE

target GOTOROOM

} randroom DEF

}

ON INCHAT {

wandering GLOBAL

randroom GLOBAL

{ 1 wandering = randroom EXEC } CHATSTR "on" == IF

{ 0 wandering = } CHATSTR "off" == IF

{ randroom EXEC } CHATSTR "!" == WHOME WHOCHAT == AND wandering AND IF

 }

ON ENTER {

wandering GLOBAL

{ { "!" SAY } 3600 ALARMEXEC } wandering IF

 }

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 =

program GLOBAL { { "empty" SAY } CHATSTR "ptest" == IF } program DEF

}

ON INCHAT {

run GLOBAL

program GLOBAL

{ program EXEC } run IF

{ "$1" GREPSUB STRTOATOM EXEC } CHATSTR "allscrae (.*)" GREPSTR IF

{ 1 run = } CHATSTR "on" == IF

{ 0 run = } CHATSTR "off" == IF

}

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

allscrae { { "My name is Fido" SAY } CHATSTR "Who are you?" == IF } program DEF

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