mIRC Homepage

Info

Posted By: KidSol

Info - 11/01/06 06:42 AM

How do i make a bot to pm someone if it triggers it?

like @find <name>

and then i want to build a database so i can add in the info?
Like
Name : Nickname:
Contacts Number: Icq: Msn:

the bot only respon to certain nick only.
is it possible?
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 06:53 AM

its entirely possible
Posted By: KidSol

Re: Info - 11/01/06 09:33 AM

how could i do that?
mind to teach me?
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 09:49 AM

tell me what u want the trigger to be
what nick you want it to work for
how you want to store the lists
and ill see what i can hammer out

i guess ill go ahead and knock out a hash based one for you
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 10:54 AM

i got this far its not quite done
i imagine someone else might pick up the job for you
if not ill work on it some more tomorrow
as not to leave you in suspense
Code:
#Hf on
alias Hfon {
  if ($group(#find) == off) {
    .enable #find
    echo 5 -a Hash Find has been turned on.
  }
  else {
    echo 5 -a Hash Find is already on.
  }
}
alias Hfoff {
  if ($group(#find) == on) {
    .disable #find
    echo 5 -a Hash find has been turned off.
  }
  else {
    acho 5 -a Hash find is already off.
  }
}
alias Hfadd {
  if ($hget(find)) {
    var %hf.sub = $$?="Enter the subject's name."
    var %hf.dat = $$?="Enter the information you want for $1 $+ ."    
    hadd find %hf.sub %hf.dat  
    echo 5 -a Entry created for %hf.sub $+ .
    hsave find " $+ $scriptdirfind.hsh"
  }
  else {
    hmake find 100
    var %hf.sub = $$?="Enter the subject's name."
    var %hf.dat = $$?="Enter the information you want for $1 $+ ."    
    hadd find %hf.sub %hf.dat  
    echo 5 -a Entry created for %hf.sub $+ .
    hsave find " $+ $scriptdirfind.hsh"
  }
}
alias Hfdel {
  if ($hget(find)) {
    var %hf.sub = $$?="Name to delete?"
    hdel find %hf.sub
    echo 5 -a Entry for %hf.sub deleted.
  }
  else {
    echo 5 -a Table cannot be found.
    echo 5 -a Entry cannot be present.
  }
}
alias Hfclear {
  if ($hget(find)) { 
    hfree find
    echo 5 -a Table cleared.
  }
}
menu nicklist {
  Hash find
  .On Off
  ..Hf on:Hfon
  ..Hf off:Hfoff
  .Table  
  ..Add:Hfadd 
  ..Delete:Hfdel 
  ..Clear:Hfclear
}
#Hf end

#find on
on *:start: {    
  if ($isfile(find.hsh)) {      
    hmake find 100    
    hload -o find find.hsh  
  }  
  else { 
    hmake find 100
  }
}
on *:exit: { 
  hsave -o find " $+ $scriptdirfind.hsh"  
  hfree find 
}
on *:text:@find &amp;:#: { 
  if (((%aa != on) &amp;&amp; ($hfind(find, $2)) &amp;&amp; ($ulevel &gt;= 4))) {  
    msg $nick : $+ $hget(find, $2) 
    set -u10 %aa on  
  }
  else { 
    if ((%aa != on) &amp;&amp; ($hget(find) == $null)) {   
      msg $nick Subject not found.
      set -u10 %aa on    
      hmake 100 find  
    }
  }
}
#find end


its function as is i guess
i need to look into appending to entries rather than overwriting
and offer that option

for right now it will work you have to set the name of the person you want to have access to level 4 in your user list
im sure the help file can get you there
and as it stands once you make a entry anything else made under the same name will overwrite what was previously there.

goodnight
Posted By: KidSol

Re: Info - 11/01/06 02:28 PM

If it possible to register their nick to get access??

Code:
 

on *:text:!register &amp;:?: {
  write users.txt $nick $2
}
on *:text:!login &amp;:?: {
  if ($read(users.txt,s,$nick) == $2) {
    commands to mark user as logged in (variable maybe)
  }
}

 
Posted By: KidSol

Re: Info - 11/01/06 03:07 PM

adding info to the list works fine
but when i try @find
it wont trigger it
not sure what's wrong

I'm still noob hehe
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 07:44 PM

Quote:

Hash Find has been turned on.
<I{a|ser> @find nickname
<str|fe> :Contacts Number: Icq: Msn:

works fine for me
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 07:46 PM

well first of all
i put a check in there that sees if the person trying to use it is level 4 or higher in your userlist
secondly you cant trigger a on text event of yours yourself
Posted By: MikeChat

Re: Info - 11/01/06 08:09 PM

unless you add an "on input" so you can trip the rest
or use an alias
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 08:23 PM

Code:
#login on
on *:text:!register &amp;:?: {
  write users.txt $nick $2
  notice $nick you are now registered; you pass is $2 $+ .
}
on *:text:!login &amp;:?: {
  if ($read(users.txt,s,$nick) == $2) {
    set -u6000 $+(%,hf,$nick) on
    notice $nick Login succesful.  
  }
} 
#login end

#Hf on
alias Hfon {
  if ($group(#find) == off) {
    .enable #find
    echo 5 -a Hash Find has been turned on.
  }
  else {
    echo 5 -a Hash Find is already on.
  }
}
alias Hfoff {
  if ($group(#find) == on) {
    .disable #find
    echo 5 -a Hash find has been turned off.
  }
  else {
    acho 5 -a Hash find is already off.
  }
}
alias Hfadd {
  if ($hget(find)) {
    var %hf.sub = $$?="Enter the subject's name."
    var %hf.dat = $$?="Enter the information you want for $1 $+ ."    
    hadd find %hf.sub %hf.dat  
    echo 5 -a Entry created for %hf.sub $+ .
    hsave find " $+ $scriptdirfind.hsh"
  }
  else {
    hmake find 100
    var %hf.sub = $$?="Enter the subject's name."
    var %hf.dat = $$?="Enter the information you want for $1 $+ ."    
    hadd find %hf.sub %hf.dat  
    echo 5 -a Entry created for %hf.sub $+ .
    hsave find " $+ $scriptdirfind.hsh"
  }
}
alias Hfdel {
  if ($hget(find)) {
    var %hf.sub = $$?="Name to delete?"
    hdel find %hf.sub
    echo 5 -a Entry for %hf.sub deleted.
  }
  else {
    echo 5 -a Table cannot be found.
    echo 5 -a Entry cannot be present.
  }
}
alias Hfclear {
  if ($hget(find)) { 
    hfree find
    echo 5 -a Table cleared.
  }
}
menu nicklist {
  Hash find
  .On Off
  ..Hf on:Hfon
  ..Hf off:Hfoff
  .Table  
  ..Add:Hfadd 
  ..Delete:Hfdel 
  ..Clear:Hfclear
}
#Hf end

#find on
on *:start: {    
  if ($isfile(find.hsh)) {      
    hmake find 100    
    hload -o find find.hsh  
  }  
  else { 
    hmake find 100
  }
}
on *:exit: { 
  hsave -o find " $+ $scriptdirfind.hsh"  
  hfree find 
  unset %hf*
}
on *:text:@find &amp;:*: { 
  if (((%aa != on) &amp;&amp; ($hfind(find, $2)) &amp;&amp; ($($+(%,hf,$nick),2) == on))) {  
    msg $nick : $+ $hget(find, $2) 
    set -u10 %aa on  
  }
  else { 
    if ((%aa != on) &amp;&amp; ($hget(find) == $null)) {   
      set -u10 %aa on    
      hmake 100 find  
    }
  }
}
#find end
Posted By: NeUtRoN_StaR

Re: Info - 11/01/06 11:03 PM

let me know if the above suits your needs
it does allow everyone access to your "database"
i hope you realize that
a better way might be to set a global variable to your desired password and then just give that out to the people u want to have access to the database
Posted By: KidSol

Re: Info - 12/01/06 05:45 AM

how do i set global?

strange thing was i try to register, it wont move a thing
like !register user pass

Hash Find is already on.
Entry created for ian.
< Ian > @findname ian

i change the trigger to @findname since i have other triger

so far the hfadd works fine with add and deleting
Posted By: KidSol

Re: Info - 12/01/06 05:49 AM

If i want to add more info
i'll just have to add

var %hf.etc = $$?="Enter the information you want for $1 $+ ."

hadd find %hf.sub %hf.dat %hf.etc

right?
Posted By: NeUtRoN_StaR

Re: Info - 12/01/06 07:18 AM

the variables are local and therefore cease to exist once the script is done running
so no
i didnt figure the overwriting thing would be a big hurdle for you

based on your login system you have a firm enough grasp that you could make it run off .txt rather than hash thereby making it easier to edit

if not let me know and ill do it
as far as editing goes with .txt you can just open the damn thing and type it in
simple is good
Posted By: KidSol

Re: Info - 12/01/06 02:21 PM

I guess i'll let it open for everyone to use it so i don't have to make the register script.

so far i had install 2 mirc in my pc.
1 is for my personal use and 1 as a bot.
I put in the script in the bot but doesn't respon to me when i use my personel use mirc. like i use @find(before i change it to @findname
Did i do anything wrong?

Posted By: NeUtRoN_StaR

Re: Info - 12/01/06 09:10 PM

Code:
#login on
on *:text:!login &amp;:?: {
  if (%hfpass == $2) {
    set -u6000 $+(%,hf,$nick) on
    notice $nick Login succesful.  
  }
} 
#login end
#Hf on
alias Hfon {
  if ($group(#find) == off) {
    .enable #find
    echo 5 -a Hash Find has been turned on.
  }
  else {
    echo 5 -a Hash Find is already on.
  }
}
alias Hfoff {
  if ($group(#find) == on) {
    .disable #find
    echo 5 -a Hash find has been turned off.
  }
  else {
    acho 5 -a Hash find is already off.
  }
}
alias Hfadd {
  if ($hget(find)) {
    var %hf.sub = $$?="Enter the subject's name."
    var %hf.dat = $$?="Enter the information you want for $1 $+ ."    
    hadd find %hf.sub %hf.dat  
    echo 5 -a Entry created for %hf.sub $+ .
    hsave find " $+ $scriptdirfind.hsh"
  }
  else {
    hmake find 100
    var %hf.sub = $$?="Enter the subject's name."
    var %hf.dat = $$?="Enter the information you want for $1 $+ ."    
    hadd find %hf.sub %hf.dat  
    echo 5 -a Entry created for %hf.sub $+ .
    hsave find " $+ $scriptdirfind.hsh"
  }
}
alias Hfdel {
  if ($hget(find)) {
    var %hf.sub = $$?="Name to delete?"
    hdel find %hf.sub
    echo 5 -a Entry for %hf.sub deleted.
  }
  else {
    echo 5 -a Table cannot be found.
    echo 5 -a Entry cannot be present.
  }
}
alias Hfclear {
  if ($hget(find)) { 
    hfree find
    echo 5 -a Table cleared.
  }
}
menu nicklist {
  Hash find
  .On Off
  ..Hf on:Hfon
  ..Hf off:Hfoff
  .Table  
  ..Add:Hfadd 
  ..Delete:Hfdel 
  ..Clear:Hfclear
  .set pass:set %hfpass $$?="Set your new pass."
}
#Hf end

#find off
on *:start: {    
  if ($isfile(find.hsh)) {      
    hmake find 100    
    hload -o find find.hsh  
  }  
  else { 
    hmake find 100
  }
}
on *:exit: { 
  hsave -o find " $+ $scriptdirfind.hsh"  
  hfree find 
  unset %hf*
}
on *:text:@find &amp;:*: { 
  if (((%aa != on) &amp;&amp; ($hfind(find, $2)) &amp;&amp; ($($+(%,hf,$nick),2) == on))) {  
    msg $nick : $+ $hget(find, $2) 
    set -u10 %aa on  
  }
  else { 
    if ((%aa != on) &amp;&amp; ($hget(find) == $null)) {   
      set -u10 %aa on    
      hmake 100 find  
    }
  }
}
#find end

there it is with the password thing your too lazy to write wink
i dont know why it wouldnt be working for you
© 2021 mIRC Discussion Forums