The Most Humble Dump
Adding /msg's and Pop Up Prompts
We have made a simple chat with a pop up, a form message, and a whisper panel. Now we will Make a /msg input and make another pop up with a prompt so you can single someone out in a pop up message.
Our first pop up message looked like the one below. It is a straightforward message.
<script language="JavaScript">
function pop1( ) {
Chat.addChannelMessage(" Hey Look!! This stuff is fun. Or it is to me. Why doesn't everyone just make their own? Why 'steal' someone else's when this is soooo easy!! OH Man you Gotta make your own!! OH YEA!!!!")
}
</script>
You could change it to a /me, a or /msg *You* . The /msg *You* will only go out to the person who presses the button. No one in the room will see it..
<script language="JavaScript">
function pop2( ) {
Chat.addChannelMessage("/msg *You* Welcome to the Most Humble Dump")
}
</script>
here is the /me action message
<script language="JavaScript">
function pop2( ) {
Chat.addChannelMessage("/me waves goodbye as he stumbles out the door")
}
</script>
We could use either of the functions above for our, pop2( ) function but I want the next one to be a /msg pop up where you will be able to /msg a pop up tp someone. In this we will have to use prompt panels to input the name of the person being /msged. In the script we will need to call a prompt using a name which we will assign it. Since we will be asking for a nickname, we will call the prompt, "nick". So "nick" is our variable name and it's value would be what ever is typed into the prompt. In the "if" statement after the prompt, != means 'is not' or 'not equal to', && means 'and', null represents 'cancel' and two quotes ("") represent a blank prompt. This "if" statement says, "If the user doesn't press cancel, AND the user doesn't submit a blank prompt, then the Chat.addChannelMessage will be a /msg to which ever name("+name+") was entered in the prompt. And the message will be, "Hey where are you?" Notice that there is a space before and after "+name+" just as if it were the nick you would have to type into a text input.
<script language="JavaScript">
function pop2( ) {
var name=prompt("Who do you mant to /msg?")
if ((name != null) && (name != ""))
{
Chat.addChannelMessage("/msg "+name+" Hey where are you?")
}
}
</script>
You could make the pop2 function an action (/me).
In this we will just put the "+name+" in the middle of the message and start it out with /me. Notice that you will still need to have the space before and after "+name+". And notice that I use '' for quotes in the message. And this function definition goes in the
<head>
<script language="JavaScript">
function pop2( ) {
var name=prompt("whom do you greet?")
if ((name != null) && (name != ""))
{
Chat.addChannelMessage("/me runs over to "+name+" and says, 'Welcome to the new chat I made.' ")
}
}
</script>
To send that message, just use an <a href> int the <body> to call the function like we did before, or you could use a button.
<a href="javascript:pop2( )">Welcome Someone up</a>
The button would be like this:
<form>
<input type="button" onClick="B( )">
</form>
For the "/msg nick" message with a form, we will have to write a definition telling the function to use the values of two different forms for the message. Our function will be named B( ). The first form will be the one you type the nick into. The form id will be "c" and its input id will be "d". The second form will be the one you type the message into. The form id for this one will be "e" and its input id will be "f". by using, document.e.f.value = "", in the definition we will tell the function to dump the text in the second form after sending the message, but to keep the nick in its form. Notice that there is a space between the two colons in the function below. Make sure you have that space. And as always, put the function definition in the head.
<script language="JavaScript">
function B( ) {
Chat.addChannelMessage(document.c.d.value+" "+document.e.f.value)
document.e.f.evalue = ""
}
}
</script>
the form you would put in the body would be like the one below. You will need to put them in a table to put them on the same row. And notice the space in the value of the /msg form ("/msg ") That will put a space between the /msg and the nick that is typed in.
<table7gt;<tr><td>
<form id="c" action="javascript:B( )">
<input id="d" type="text" value="/msg " width=150>
</form>
7lt;td>
<form id="e" action="javascript:B( )">
<input id="f" type="text" width=450>
</form>
</td></tr></table></form>
That is the entire thing. Now look at the improved chat with the prompt pop up and the /msg input. There is a textarea below the chat which contains all of the codes. Now go to the next page work on the looks of the chat and put in something that will allow you to change servers and rooms
[ IRC list ] [ Server List ] [ First page ] [ last page ] [ next page ]
T