IPTSCRAE SCRIPTING LESSON TWO
Hide and Seek Who is Everyone and Where is Everything
Palace - Parts is Parts
The Palace system consists, basically, of two separate programs. The Client is the software that is on your computer that you use to "log in" with. You are learning to write cyborg.ipt scripts, which are used by your client. The other program is the Server. It is on another computer that you call up by its address, such as "usr.thepalace.com:9998". From now on, when I am referring to the programs and files on your computer, I will be referring to them as the "client". When I am referring to the Palace you are calling, I will be calling it the "server". Every server has a "name" that is assigned to it by the "God", or owner of that server. You can use the following command to retrieve the name:
This is the name of the Server (as a string). The person who set up the server assigns this name in the Server Preferences dialog box. Typing:
will cause you to say the name of the server you're currently logged into.
Get a Life!
To begin your Palace existence, you use your client to log onto a server. Every person who logs onto a server is assigned a unique number, which lasts until they log off. If you log onto a server as a Guest, the number is obvious, you see it as part of your name. For example, Guest 123 is user number 123. When you log on as a member, you are also assigned a unique number...you just don't see it. Instead, you see your name. There are several Functions that return userIDs.
This function returns the user's own userID (as an integer). Typing:
will cause you to say your own userID. (ITOA means "Integer to ASCII". It is used to change a number to ASCII characters that you can then say. SAY will only say strings, not integers!)
This function returns the userID (as an integer) of the user who invoked an ON INCHAT event. It is used to find out WHO did the speaking.
This function returns the userID (as an integer) of the person you have selected for private chat (i.e. Whisper Mode or ESP). If you are not whispering or ESPing to anyone, it returns a 0. Click on another user as if you were going to whisper to them. Then type:
to see the userID of the person you've selected. If you type:
you will say their name.
This function returns the userID (as an integer) of RoomUser <number> in the current room. If you type:
you will say the userID of the first person who entered the room. (If you are in the room alone, it will be YOUR userID!) If you type:
You will say the name ofthe first person who entered the room. The users in a room are in a "queue", just like a line at a movie theatre. If one of them leaves the room, the rest of the line "moves up" to fill in the empty space. The first person in the queue is 0 ROOMUSER. The second person is 1 ROOMUSER, etc. (Remember, we start counting with 0, not 1!)
A Boy name Sue
While knowing someone's userID is important because that number is needed in Iptscrae to find other information, most people prefer to be addressed by their name, rather than a number. There are several Functions that can return userNames. They are:
This returns the user's userName (as a string). If you type:
you will say your own name.
This function returns the userName (as a string) of the specified user. Type:
and you will say your own name. Remember, WHOME returns your userID, so you use it as an argument for WHONAME. WHOTARGET WHONAME will return the name of the person you have selected for private chat. WHOCHAT WHONAME will return the name of the person who invoked the INCHAT handler.
In addition to finding out a user's userID and userName, you can also find out a little bit more about yourself. The following functions can be used to determine the "class":
This function returns TRUE (1) if you haveGod-level access, otherwise it returns FALSE (0). Type:
and you should see yourself saying "0". (Unless you are on your own server, and have typed in the god password!)
This function returns TRUE (1) if you have guest access, otherwise it returns FALSE (0). Type:
and you should see yourself saying "0", provided you are logged on as a registered member.
This function returns TRUE (1) if you haveWizard-Level access, otherwise it returns FALSE (0). If you type:
You will say "0", unless you are logged on as a wizard on the server you are on.
NOTE: These commands return the status of the CALLER. This means, when you use them in your cyborg.ipt script they will return YOUR status, not the status of anyone else.
Real Estate Signs
Just as each user has a unique userID and a name, each room on the server has a unique roomID and a name. In addition, each room knows how many people are in it. You can retrieve information about rooms by using the following functions:
This function returns the roomID, which is the room's number, (as an integer) of the current room. Type:
to say the roomID (room number) of the room you are currently in.
This function returns the name of the current Room (as a string). If you type:
you will say the name of the room you are currently in.
This function returns the number of users currently in the Room. The numbers start with 0. So if you are the first person in the room, you are roomUser number 0, NOT roomUser number 1! Type:
to see how many people are in the room you are in currently. If you type:
You will say the name of the last person who came into the room! If that's you, then you will say your own name. What you are doing here is finding out how many people are in the room. You subtract 1 from this number (remember, we start counting with 0!) <number> ROOMUSER WHONAME will give us the name of that particualr person in the room who is in that position in the queue of users for the room.
Where in the World is Carmen?
Everyone in the room you are in has a specific horizontal (X) and vertical (Y) position. You can retrieve this information with the following functions:
This function returns the X and Y positions of the user (as integers). Note that X is returned before Y, and is therefore set to be retrieved from the stack after the Y value. Type:
and you will see what your current position is. (Be sure to include all the quotes and spaces when you type this!) To retrieve a value that has just been put on the stack, you need to assign it to something. y = retrieves the first value on the stack and assigns it to the variable named y. x = retrieves the next value. To add two things together in Iptscrae, you use:
This adds <value1> and <value2> together and pushes the result onto the stack. You can add two strings together or two integers together with +, however, you cannot add an integer to a string!
This function returns the user's horizontal (X) coordinate (as an integer). Type:
to see your current X position.
This function returns the user's vertical (Y) coordinate (as an integer). Type:
to see your current Y position.
This function returns the current X and Y positions of the cursor (as integers). The cursor is where your mouse is pointed to on the screen. Note that the X is returned before Y, and is therefore set to be retrieved from the stack after the Y value. If you type:
you will see where your mouse is currently pointed.
<X> <Y> SETPOS
This command immediately moves the user's position to <X> <Y> in the viewing area. <X> must be an integer from 0 to 511. <Y> must be an integer from 0 to 383. Type:
and you will immediately move! The numbers you use for this command are referred to as ABSOLUTE coordinates. They are the actual pixel positions on the screen where you want the center of your AV to be.
<X> <Y> MOVE
This command moves the user X, Y pixels relative to the current position. To move to the right and down from your current location, Type:
To move to the left and up, type:
Remember, you are moving RELATIVE to where you are when you invoke this command! That means that the <X> and <Y> are going to be ADDED to your current x and y. By using negative numbers, the effect is to reduce the value of your x and y...moving you up and/or to the left.
1. Put the following routine in your INCHAT handler:
2. Create a routine which will make you say your userName when someone asks "Who are you?"
3. Create a routine which will tell someone their user name when they say "Who am I?"
4. Create a routine which will move you on top of someone when they say "Jump me!"
5. Create a routine which will spoof a person into saying "Ok, you asked for it!" when they say "Spoof me!"
6. Create a routine which will draw a line from you to the person you have engaged in private conversation when you say "hit". (Modify the routine given in the first assignment above. Be sure to get this in the right handler!)
7. Create a routine which makes you give the correct response to the question: "Who was here first?" when someone asks it.
Many people have a script that will greet everyone in the room when they type "roomhi". If you already have this script, look at it and see if you can figure out how it works. If you don't already have it, visit Dr. X's and download it. Do NOT add it to your cyborg.ipt! Save it as "roomhi.ipt".
Although this command is also discussed in Lesson 4, you may wish to use it for one of your homework assignments.
"< text >"<X> <Y> SAYAT
This command will "say" the text in the string at the X Y position on the screen. Position your mouse on the screen, then type:
And the words "my mouse is here" will appear where you mouse is.
Don't hesitate to ask your instructor for help with your homework, but don't expect the instructors "help" to be simply giving you the answer. In most cases, if you can't figure it out, you need to reread the class materials. The answers are all there.
Sometimes, if you're not sure, it helps to write down the steps of what you want to do, in plain English, first. Computer programmers refer to (these steps as an "algorithm", which means "a finite series of steps used to accomplish a task".) Then you can translate your steps into the correct Iptscrae commands.
If you are loosing your place as your are scripting, try putting each step on a line by itself, and indenting. This way, it is easier to see if you've given each command the correct arguments to make it work. It is also easier to find mismatched curlybraces if they are all lined up.
<Previous> <Iptscrae> <Next>