Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Wed Dec 31, 2003 4:44 pm Post subject:
That code wont work for many reasons MickyG.
First its not getting anything thats pasted to it so all the variables in there must be global to do anything, and global variables are not good.
Second its not using sendmsg or invite so its liable to break anytime the MSN protocol changes (often)
Third, its using $1 without an regex before it. $1 is not magic, it gets the first match of some previous regex (a match is something between parenthsis in the regex)
Something more like
Code:
<br />sub invite {<br /> my ($username,$msg,$self) = @_; # get whatever was passed to it<br /> $msg =~ s/\!invite //g;<br /> $self->sendmsg("Inviting $msg.. please wait");<br /> $self->invite("$msg");<br /> return "User $msg invited.";<br />}<br />1;<br />
this code assumes that you are calling the sub like
@cheatsfp its for any command that needs $self, with using the wiredbots template, the leave was just an example command to show how it works, and to shut people up
@cheatsfp its for any command that needs $self, with using the wiredbots template, the leave was just an example command to show how it works, and to shut people up
@n00b
Code:
$msg =~ s/\/invite //ig;
lol, okay. Thanks! I think I got it covered from here
Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Wed Dec 31, 2003 5:39 pm Post subject:
title changed to "Where do you put commands?" The title of the topic should give people an idea what you are asking. Please refraim from using sensless titles in the future.
Thnks _________________ Eric256
Proud previous owner and current admin of Bot-depot.com