mIRC Home    About    Download    Register    News    Help

Print Thread
#107704 12/01/05 04:29 PM
Joined: Jan 2005
Posts: 25
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Jan 2005
Posts: 25
ok, I am trying to get it so if I say a command, my bot notices me with the text from a file

tenetive code
on *:TEXT:-show *:#: { if (($2 == info)) { //notice $nick

after the $nick part I don't know what to put

Joined: Mar 2004
Posts: 359
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
/help $read
$read(somefile.txt) will read a random line from the txt file

I think this is what your lookin for smile

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
on *:TEXT:-show info:#: play -nm1q3 $nick myfile.txt 1500

  • Will notice (-n) to the user who requests it with the contents of myfile.txt, with an interval of 1500 milliseconds.
  • There is a maximum request of 1 at a time for each user, so one user cannot do 2 requests (-m1).
  • There is a max queue of 3 users at the same time (-q3), which means any other users who try to request while you are playing the file and have 3 users queued, will be ignored. This is to prevent yourself from flooding off the server for continuously sending text to it.
  • Be aware, this only triggers on "-show info" so no variations on that, since no wildcards are specified in the matchtext.
  • Change the flags and their according numbers that I used with the play command like you wish. I just put them there as you might be interested in them.
  • More help can be found in mIRC's help file typing /help /play

Greets


Gone.
Joined: Jan 2005
Posts: 25
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Jan 2005
Posts: 25
thank you.

also, where would be the best place to find an identify script, so people can ident with the bot?

that being said, is there an easier way to do so?

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Something I did just before the holiday season, hope this is what you mean or at all helps in that respect.
/users add <nickname>
/users del <nickname>

They can only authorize into the bot if their nick they are using is in the database aslong as they append the password in correspondence with the users config file.

Once logged in they've been given level 100 access, I've wrote no 100 commands as I wouldn't know what you'd want. They have the ability to modify their password with changepass <oldpass> <newpass>.

Code:
on *:start: {  
  if ($exists(users.hsh)) {   
    hmake users 100
    hload -o users users.hsh
  }
  else { hmake users 100 }
}

alias users {
  if ($1 == add) {
    if ($hfind(users,$2)) {
      echo -a $2 is already in the database.
      halt
    }
    if (!$2) { 
      .echo -a No Account name specified. Access Denied.
      halt 
    }
    if ($2) &amp;&amp; (!$3) { 
      .echo -a No Account password specified. 
      halt 
    }
    if ($2) &amp;&amp; ($3) { 
      if ($hget(users)) { 
        hadd users $2 $3
        .echo -a Account name $2  with password $3 created.
        if ($hget(users)) { 
          hsave -io users users.hsh 
        }
        halt 
      }
      else { 
        hmake users
        .echo -a Account name $2  with password $3 created.
        halt 
      }
    }
  }
  if ($1 == del) {
    if (!$2) { echo -a You didn't specify an account. | halt }
    if (!$hfind(users,$2)) { 
      .echo -a $2 is not in the database and can't be removed.
      halt 
    }
    else { 
      .echo -a $2 has been removed from the database.
      hdel -w users $2
      .echo -a *** Now saving database.
      hsave -io users users.hsh
      .echo -a *** Database saved.
    }
  }
  else { 
    halt 
  }
}

on 1:Text:login*:?: {
  if (!$hfind(users, $nick)) { 
    .notice $nick Sorry, your nickname is not on my user database. 
    halt 
  }
  if ($hfind(users, $2)) &amp;&amp; (!$3) { 
    .notice $nick You didn't specify a password. 
    halt 
  }
  if ($hfind(loggedin_nicks, $2))  { 
    .notice $nick You are already logged in. 
    halt
  }
  if ($hfind(users, $2)) &amp;&amp; ($hget(users,$2) == $3) { 
    .notice $nick Authorization to your user " $+ $hfind(users,$2) $+ " with password  $+ $3 $+  has been accepted.
   .auser 100 $nick
    hadd -m loggedin_nicks $2 Yes
    hsave -i loggedin_nicks loggedin_nicks.hsh 
    halt  
  }
  if ($hfind(users, $2)) &amp;&amp; ($hget(users,$2) != $3) { 
    .notice $nick Password for account " $+ $hfind(users,$2) $+ " is incorrect. 
    halt 
  }
  if ($hfind(users, $2)) &amp;&amp; (!$3) { 
    .notice $nick You didn't specify a password. 
    halt
  }
}

on 1:text:logout*:?: {
  if ($hfind(loggedin_nicks, $nick)) { 
    hdel loggedin_nicks $nick 
    hsave -i loggedin_nicks loggedin_nicks.hsh
    .ruser 100 $nick
    .notice $nick You have successfully logged out.
    halt 
  }
  if (!$hfind(loggedin_nicks, $nick)) { 
    .notice $nick You are already logged out.
    halt
  }
  if (!$hfind(loggedin_nicks, $nick) &amp;&amp; $hfind(users,$nick)) { 
    .notice $nick You don't have an account so how can I log you out $nick $+ .
    halt
  }
}

on *:exit:{ 
  hsave -io users users.hsh
}

on *:Text:changepass*:?: {
  if (!$hfind(users,$nick)) { 
    .notice $nick You don't have an account. 
    halt
  }
  if (!$hfind(loggedin_nicks,$nick)) { 
    .notice $nick You are not logged in. 
    halt 
  }
  if ($hfind(loggedin_nicks,$nick) &amp;&amp; (!$2)) { 
    .notice $nick Usage: changepass &lt;oldpass&gt; &lt;newpass&gt; 
    halt 
  }
  if ($hfind(loggedin_nicks,$nick)) &amp;&amp; ($2 == $hget(users,$nick) &amp;&amp; (!$3)) { 
    .notice $nick changepass $2 &lt;new password&gt; 
    halt
  }
  if ($hfind(loggedin_nicks,$nick)) &amp;&amp; ($2 == $hget(users,$nick) &amp;&amp; ($3)) { 
    .notice $nick Password changed to: $3  
    .notice $nick For a future login type /msg $me login $nick $3 
    hadd users $nick $3 
    halt  
  }
  if ($hfind(loggedin_nicks,$nick)) &amp;&amp; ($2 == $hget(users,$nick) &amp;&amp; $3 == $hget(users,$nick)) { 
    .notice $nick your password is already $3 
    halt
  }
}

Joined: Jan 2005
Posts: 25
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Jan 2005
Posts: 25
thanks alot

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You're very welcome dude. smile


Link Copied to Clipboard