User Control Panel
Advertisements

HELP US, HELP YOU!

i created a !add profile command

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
m4g3_o_f4t3
Newbie
Newbie


Joined: 19 Mar 2004
Posts: 42
Location: New Zealand
Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Mon Apr 12, 2004 7:31 am    Post subject: Reply with quote

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? Very Happy
Back to top
GiL
Not Yet a God
Not Yet a God


Joined: 06 Jan 2004
Posts: 344

Reputation: 35.3Reputation: 35.3Reputation: 35.3Reputation: 35.3

PostPosted: Mon Apr 12, 2004 8:40 am    Post subject: Reply with quote

yes, try:

Code:
 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.
Back to top
Gavin
God Like
God Like


Joined: 15 Mar 2004
Posts: 661
Location: Manchester, UK
Reputation: 36.2Reputation: 36.2Reputation: 36.2Reputation: 36.2

PostPosted: Mon Apr 12, 2004 8:46 pm    Post subject: Reply with quote

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)
Back to top
m4g3_o_f4t3
Newbie
Newbie


Joined: 19 Mar 2004
Posts: 42
Location: New Zealand
Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Tue Apr 13, 2004 11:18 pm    Post subject: Reply with quote

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 Razz

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 />


If you see any flaws plz tell me Wink
Back to top
Gavin
God Like
God Like


Joined: 15 Mar 2004
Posts: 661
Location: Manchester, UK
Reputation: 36.2Reputation: 36.2Reputation: 36.2Reputation: 36.2

PostPosted: Wed Apr 14, 2004 9:45 am    Post subject: Reply with quote

thank you i'll try it.
_________________
MSN: gavin [at] gavinbrittain [dot] co [dot] uk
E-Portfolio: www.gavinbrittain.co.uk (New version comming soon)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help All times are GMT
Page 1 of 1

 



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