User Control Panel
Advertisements

HELP US, HELP YOU!

Chatroom help?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 2:41 am    Post subject: Reply with quote

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
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sun Feb 22, 2004 2:54 am    Post subject: Reply with quote

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
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 2:55 am    Post subject: Reply with quote

thank you
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 3:00 am    Post subject: Reply with quote

cer it doesnt work

Quote:
[Solubot] says:
This is now the chatroom.
[Calum] [Add Serverchild@hotmail.com] [ My Bot : Solubot@hotmail.com ] says:
?
[Solubot] says:
has joined the chatroom.
[Calum] [Add Serverchild@hotmail.com] [ My Bot : Solubot@hotmail.com ] says:
ok
[Solubot] says:
has joined the chatroom.
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sun Feb 22, 2004 3:06 am    Post subject: Reply with quote

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
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 3:18 am    Post subject: Reply with quote

sorry im a n00b
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 3:36 am    Post subject: Reply with quote

that dont work either it just chrashes my bot?!?!?!?
Back to top
farkie
God Like
God Like


Joined: 15 Nov 2003
Posts: 673

Reputation: 3.4Reputation: 3.4Reputation: 3.4

PostPosted: Sun Feb 22, 2004 12:20 pm    Post subject: Reply with quote

same here...
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 5:48 pm    Post subject: Reply with quote

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 Sad
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sun Feb 22, 2004 6:09 pm    Post subject: Reply with quote

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/
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Sun Feb 22, 2004 6:11 pm    Post subject: Reply with quote

so if i use that as it is now it should work?
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sun Feb 22, 2004 6:12 pm    Post subject: Reply with quote

Well... if you use the code I posted, make sure you remember (unlike somebody) to put an if ($msg =~ /^chat/i) { or whatever before it and a } after it.

Otherwise it would think every message is the chat command.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Keenie
Almost An Agent
Almost An Agent


Joined: 31 Oct 2003
Posts: 1071

Reputation: 52.4

PostPosted: Mon Feb 23, 2004 2:17 am    Post subject: Reply with quote

you could use the Chat_Room_Closed() event, and delete $chat if its the chat room closing
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Mon Feb 23, 2004 3:43 am    Post subject: Reply with quote

how?
Back to top
Keenie
Almost An Agent
Almost An Agent


Joined: 31 Oct 2003
Posts: 1071

Reputation: 52.4

PostPosted: Mon Feb 23, 2004 4:19 am    Post subject: Reply with quote

i forget my ftp details but something like this

at the top
Code:
$msn->set_handler("Chat_Room_Closed" => \&Chat_Room_Closed);


then a sub for it

Code:
sub Chat_Room_Closed<br />{<br />   my $self = shift;<br />   undef $chat if ($self eq $chat);<br />}


something like that anyways, would need to edit maybe to fit your bot
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group