Joined: 19 Mar 2004 Posts: 42 Location: New Zealand
Posted: Mon Apr 12, 2004 7:31 am Post subject:
now i need help lol ok you type !add profile do ya profile bits here n there but now i want some 1 to type !view profile email@hotmail.com and then the bot prints out the profile of that person. its saved in Lib/Store/profiles/$username.txt can some 1 help?
if ($msg =~ /^view profile (.*)$/)<br />{<br /> open (PROFILE, "Lib/Store/profiles/$username.txt") || ($self->sendmsg("Sorry $username hasn't made a profile yet.") && return);<br /> @profile = <PROFILE>;<br /> close (PROFILE);<br /><br /> $self->sendmsg(join("\n",@profile));<br />}
Since I have never coded a command for Morph Im not shore exactly how to do the command structure but from what I've seen and can remember, that is what I could come up with. Some variables may be named wrong and you may not use $self or return. But that should work.
Joined: 15 Mar 2004 Posts: 661 Location: Manchester, UK
Posted: Mon Apr 12, 2004 8:46 pm Post subject:
wud it b posible if you cud tell the me the !add profile command so i can use your command???? _________________ MSN: gavin [at] gavinbrittain [dot] co [dot] uk
E-Portfolio: www.gavinbrittain.co.uk (New version comming soon)
Joined: 19 Mar 2004 Posts: 42 Location: New Zealand
Posted: Tue Apr 13, 2004 11:18 pm Post subject:
Ok that view profile works but how do i stop it putting a whole line over the next...like this..
Quote:
John Doe
13
Male
John_Doe@Jd.com
Quote:
*lazy*!
Because thats what the profile comes out like <_< and in the profiles/$username.txt it is layed out like this..
Quote:
John Doe 13 Male John_Doe@Jd.com
how do i fix this?
And for Gavin,( if hes the 1 that wanted add profile ) Just edit Add Smod,Add Admin its just the same except Different locations and Different names, ill post the code tho
Code:
<br />if ($msg eq "add profile")<br />{<br /> if (!exists $self->{callback})<br /> {<br /> $self->{callback} = 'add profile';<br /> &send($self, "please type your, Name,Age,Gender,Email,Interests with , in the middle of each");<br /> return;<br /> } <br />}<br /> else<br />{<br /> if ($self->{callback} eq 'add profile')<br /> {<br /> if ($msg eq "stop")<br /> {<br /> &send($self, "You have stopped.");<br /> delete $self->{callback};<br /> return;<br /> }<br /> foreach $name (split (/,/, $msg))<br /> {<br /> $name =~ s/ //g;<br /> $name = lc($name);<br /> open (FILE, ">>./Lib/Store/profiles/$username.txt");<br /> print FILE "$name\n";<br /> close FILE;<br /> $reply .= "$name\n";<br /> }<br /> &send($self, "You added this to your profile \n\n$reply");<br /> delete $self->{callback};<br /> $reply = undef;<br /> }<br />}<br />
Joined: 15 Mar 2004 Posts: 661 Location: Manchester, UK
Posted: Wed Apr 14, 2004 9:45 am Post subject:
thank you i'll try it. _________________ MSN: gavin [at] gavinbrittain [dot] co [dot] uk
E-Portfolio: www.gavinbrittain.co.uk (New version comming soon)