|
| Author |
Message |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Sun Feb 22, 2004 2:41 am Post subject: |
|
|
| Quote: | if ($msg eq "chat") { if (!exists $msn->{chatroom}) { $msn->{chatroom} = $self; &send($self, "This is now the chat room. "); } elsif ($self eq $msn->{chatroom}) { &send($self, "Your in the chat room."); } else { $msn->{chatroom}->invite($username); &send($self, "Inviting you to the chat room now!"); } } |
ok thats the chatroom for morph from morph. when it runs in maya however when eveyone leaves the chat the socket still stays open so bot still tries to invite you to a empty socket
any ideas of how to stop this? |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Sun Feb 22, 2004 2:54 am Post subject: |
|
|
Here's code from my bot.
| Code: | | # See if the chatroom doesn't exist.<br />if (!exists $msn->{chatroom} or !exists $msn->GetMaster->{Socks}->{$msn->{chatroom}->{fn}}) {<br /> $msn->{chatroom} = $self;<br /> $msn->sendmsg ("This is now the chatroom.",Font => "Courier New",Color => "FF0000");<br />}<br />elsif ($self eq $msn->{chatroom}) {<br /> $msn->sendmsg ("You are already in the chat.",Font => "Courier New",Color => "FF0000");<br />}<br />else {<br /> $msn->{chatroom}->invite ($client);<br /> $msn->{chatroom}->sendmsg ("$client has joined the chatroom.",<br /> Font => "Courier New", Color => "990000");<br />} |
_________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Sun Feb 22, 2004 2:55 am Post subject: |
|
|
| thank you |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Sun Feb 22, 2004 3:00 am Post subject: |
|
|
cer it doesnt work
|
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Sun Feb 22, 2004 3:06 am Post subject: |
|
|
What did you type before it said "This is now the chatroom"
I was assuming you'd know to do this:
| Code: | | if ($msg eq "chat") {<br /> here is where you'd put my code in<br />} |
_________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Sun Feb 22, 2004 3:18 am Post subject: |
|
|
| sorry im a n00b |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Sun Feb 22, 2004 3:36 am Post subject: |
|
|
| that dont work either it just chrashes my bot?!?!?!? |
|
| Back to top |
|
 |
farkie God Like

Joined: 15 Nov 2003 Posts: 673
   
|
Posted: Sun Feb 22, 2004 12:20 pm Post subject: |
|
|
| same here... |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Sun Feb 22, 2004 5:48 pm Post subject: |
|
|
Perhaps a socket checker is needed for | Quote: | if ($msg eq "chat") { if (!exists $msn->{chatroom}) { $msn->{chatroom} = $self; &send($self, "This is now the chat room. "); } elsif ($self eq $msn->{chatroom}) { &send($self, "Your in the chat room."); } else { $msn->{chatroom}->invite($username); &send($self, "Inviting you to the chat room now!"); } } | any ideas of how to add a socket checker i am a n00b to perl  |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Sun Feb 22, 2004 6:09 pm Post subject: |
|
|
QUOTE(Cer @ Feb 21 2004, 09:54 PM) Here's code from my bot. | Code: | | # See if the chatroom doesn't exist.<br />if (!exists $msn->{chatroom} or !exists $msn->GetMaster->{Socks}->{$msn->{chatroom}->{fn}}) {<br /> $msn->{chatroom} = $self;<br /> $msn->sendmsg ("This is now the chatroom.",Font => "Courier New",Color => "FF0000");<br />}<br />elsif ($self eq $msn->{chatroom}) {<br /> $msn->sendmsg ("You are already in the chat.",Font => "Courier New",Color => "FF0000");<br />}<br />else {<br /> $msn->{chatroom}->invite ($client);<br /> $msn->{chatroom}->sendmsg ("$client has joined the chatroom.",<br /> Font => "Courier New", Color => "990000");<br />} | | You can't just do "if the MSN variable doesn't exist", you also have to check if the socket exists too.
Otherwise: A user creates the chatroom, $msn->{chatroom} is created. The user closes the chatroom, the socket is closed. Another user joins the chatroom. The socket doesn't exist. The bot crashes due to errors. _________________ Current Site (2008) http://www.cuvou.com/ |