Learn bot

By ^Neptune on Oct 25, 2008

This was basically just a test to learn hash tables, and it worked great! So I figured I'd put it on here.

Load into your bots remotes (ALT+R).

As a "Learn bot", you can make it learn stuff and then recall back to information about the topic. Type !learn to make the bot "learn" it. You can then recall the information by using !remember .

You can also use !forget , but you need access level 10 to the bot to use that. Type:

/auser 10 YOUR_NICKNAME

in your bots screen to set that.

Oh, and if you type /viewlearn in your bots mIRC, you can view a list of all topics and data that are currently stored within the learn bot.

Enjoy!

on *:TEXT:!learn *:#: {
  if (!$3) {
    notice $nick You didn't specify the right parameters.
    notice $nick Syntax: !learn <topic> <description>
  }
  else {
    hadd -m learn $strip($2) $3-
    msg $chan Data $3- saved as topic: $strip($2)
  }
}
on *:TEXT:!remember *:#: {
  if (!$2) {
    notice $nick You didn't specify the right parameters.
    notice $nick Syntax: !remember <topic>
  }
  elseif (!$hget(learn,$strip($2))) {
    msg $chan No data was found for $2 $+ .
  }
  else {
    msg $chan Results for $strip($2) $+ : $hget(learn,$2)
  }
}
on 10:TEXT:!forget *:#: {
  if (!$2) {
    notice $nick You didn't specify the right parameters.
    notice $nick Syntax: !forget <topic>
  }
  elseif (!$hget(learn,$strip($2))) {
    msg $chan No data was found for $strip($2) $+ .
  }
  else {
    msg $chan Removed topic $strip($2) ( $+ $hget(learn,$strip($2)) $+ ) from the database.
    hdel learn $strip($2)
  }
}
alias viewlearn {
  window -a @Learn
  var %x = 1
  while (%x <= $hget(learn,0).item) {
    echo -g @Learn $hget(learn,%x).item $+ : $hget(learn,%x).data
    inc %x
  }
}
on *:EXIT: { hsave learn learn.txt }
on *:START: { 
  if (!$isfile(learn.txt)) {
    noop $input(The hash table for the learn bot could not be found.,uwo,Error!)
  }
  else {
    hmake learn 100
    hload learn learn.txt 
  }
}

Comments

Sign in to comment.
LordHawk   -  Oct 14, 2011

would it be possible to make the /viewlearn a command for the bot. So users added to the bot can see all whats learned?

 Respond  
Gummo   -  Jun 10, 2010

Haha, no, this is manual. You tell it to remember something specific and when asked again later it remembers.

 Respond  
Xaric   -  Jun 10, 2010

auto learning possible?

 Respond  
^Neptune   -  Jun 04, 2009

Totally forgot about that, was a noob at hash tables back here. Fixed.

 Respond  
mr_president   -  Jun 04, 2009

So, it deletes every thing every time is starts?
If thats the ase i think i like PATX one better that just sets varables.
It remembers them at restart.

 Respond  
Jonesy44   -  Jun 02, 2009

The script doesnt have an auto hash make unfortunately. run this command, mr_president and you should be ok from then on.

/hmake learn 1000
 Respond  
mr_president   -  Jun 01, 2009

can someone help me?
for me it always says,
"* /hload: no such table 'learn'"

 Respond  
a careful warchild   -  Mar 25, 2009

updated to 8/10 as i promised :) sorry for the late reply but i haven't been on hawkee in ages lol.

 Respond  
PATX   -  Mar 13, 2009

i have a script smaller than this one and it saves factoids as variables. also when i use this script the hash table does not carry over... anyway the script i came up with is http://www.hawkee.com/snippet/5853/ there. but now that script does not include a forget command so i amde another hash table one that is simpler than this also and when i saved it it worked :p that is somewhere on patx.pastebin.com lol anyway good script :: i must admit this was the first time i ound a working learn bot so i give i a 9 (would have given ten but i am having trouble with thats hash saving thing :p

 Respond  
xplo   -  Dec 02, 2008

it would be nice to !remember with a wildcard.

like
!learn test This is a test

!remember testing

 Respond  
Eugenio   -  Nov 13, 2008

ROFL @ jonesy

 Respond  
^Neptune   -  Oct 26, 2008

7/10 add $strip and i'll give you 8/10

Already been done in the latest update. :P

 Respond  
Bullet_Dodger   -  Oct 26, 2008

lolol

 Respond  
a careful warchild   -  Oct 26, 2008

lmao

 Respond  
Jonesy44   -  Oct 26, 2008

I think imma edit this code to make a retard bot which spouts out random bollocks for each person :]

 Respond  
a careful warchild   -  Oct 26, 2008

7/10 add $strip and i'll give you 8/10

 Respond  
napa182   -  Oct 25, 2008

abit pointless but it does'nt deserve a rate of 1 maybe 4/10 but not a 1

 Respond  
Lord-Harlot   -  Oct 25, 2008

Tis ok. 6/10

sure you can do more to it

 Respond  
Bullet_Dodger   -  Oct 25, 2008

Very Good Script i will rate when i test

 Respond  
Jace   -  Oct 25, 2008

Umm its a reason not an excuse , excuse implys lieing;p and don't blame me i can't rate yet.If i could rate id give it a 5 or a 6 you still need to silence those notices and messages and add flood pros (EL FTW) and you need to check if the learn file exist and create it before you /hload if (!$hget(learn)) { hmake learn amount} and other then $strip-ing everything else i haven't tested it myself.`-.-´

 Respond  
^Neptune   -  Oct 25, 2008

Who rated 1. Honestly, what's the point? Everything works on this script. Kinda sad if you don't come up with an excuse.

 Respond  
^Neptune   -  Oct 25, 2008

Small updates:

-The hash table will now carry over if you exit your mIRC.
-$strip has been used so colours won't have an effect (only in setting the description)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.