patxbot

By PATX on Mar 11, 2009

patxbot by patx@patxbot.tk

~learn -- to add a factoid.
~ -- to recall a factoid.
~forget -- to delete a factoid.

go to http://patxbot.tk for more info/news on this snippet. and now their is a version w/ user levels for security (just go to the site :p)

Hash table and Ini versions of this script have also been submitted:
~ Hash - http://bitbucket.org/patx/patxbot/wiki/Hash_Tables
~ .Ini - http://bitbucket.org/patx/patxbot/wiki/Ini

ALSO: patxBot new official site http://patx44.appspot.com/patxbot

; factoid script by patx (patx@patxbot.tk) (http://www.patx.tk)
; the code it licensed under the patx license version 3!!!!!!!!
; http://www.iolanguage.com/paste/p/07f3dc4a0.html <<< license.

; patxbot version 13
; by patx@patxbot.tk
; http://patxbot.tk
on *:text:~learn*:#: { %patx [ $+ [ $2 ] ] = $3-
msg $chan topic saved. }
on *:text:~forget*:#: { unset %patx [ $+ [ $2 ] ]
msg $chan the factoid $2 has been deleted. }
on *:text:~*:#: { msg $chan %patx [ $+ [ $remove($1,$left($1,1)) ] ] }

Comments

Sign in to comment.
PATX   -  Jun 14, 2009

@napa182 Seeing how I am extremely busy coding Python crap (which is really pretty fun, but it is a lot to do with a a lot of errors...) at the moment I was not going to redo this script `till like next week, I will put the one you posted up (and on bitbucket.org/patx/patxbot/wiki/Ini). Thanks.

 Respond  
napa182   -  Jun 14, 2009

you can make it use ini's like this an also make it channel specific an if you dont want it channel specific you can change the # to learn in the ini set up. just a fast remake no error checks added.

on $*:text:/^~(learn|forget|factoid)\s(\w+)\s?(\w.+)?/iS:#: { 
  if (!$($+(%,factoidflood,$nick),2)) {
    set -u3 $+(%,factoidflood,$nick) on
    if ($regml(1) == learn && $regml(3) && !$readini(learn.ini,-n,$regml(2),#)) { writeini -n learn.ini $regml(2) # $regml(3) | msg # the factoid has been saved. } 
    if ($regml(1) == forget && $readini(learn.ini,-n,$regml(2),#)) { remini  learn.ini $regml(2) # | msg # the factoid $regml(2) has been deleted. } 
    if ($regml(1) == factoid && $readini(learn.ini,-n,$regml(2),#)) { msg # $readini(learn.ini,-n,$regml(2),#)) }  
  }
}
 Respond  
PATX   -  Jun 14, 2009

ty FordLawnmower. i start working on that asap. tho u didnt have to give me a 10. this script is not nearly as good as urs are, but thanks never the less :)

 Respond  
FordLawnmower   -  Jun 14, 2009

Who gave the 1 rating ;/
I added 10 to balance it. I hate that shit.
If you don't like messing with the hash tables, I would go with ini's PATX.
Speed is not a issue here, so a PATX.ini, IMO , would be the best choice.
Good Scripting :)

 Respond  
PATX   -  Jun 13, 2009

meh just put it as a wiki page... http://bitbucket.org/patx/patxbot/wiki/Hash_Tables

 Respond  
PATX   -  Jun 13, 2009

yay thanks guys. :)

 Respond  
napa182   -  Jun 13, 2009

lol ;x

 Respond  
Slickone   -  Jun 13, 2009

yeah go ahead also i got help on that from napa182

 Respond  
PATX   -  Jun 13, 2009

maybe, i have grown to like the vars tho.... at first yes i liked hash tables but vars just seem so much easier ya know. anyway. @Slickone i like that snip u suggested it works. i'll keep it up here. also i may wanna put it as a branch to patxbot... if thats ok w/ u jus let me know... or u can also do it urself: http://bitbucket.org/patx/patxbot/fork/ :)

 Respond  
Slickone   -  Jun 13, 2009

maybe do

on *:disconnect:{ .hsave learn $qt($scriptdirlearn.hsh) } 
on *:exit:{ .hsave learn $qt($scriptdirlearn.hsh) }
on *:start:{ if (!$hget(learn)) { .hmake learn 100 | .hload learn $qt($scriptdirlearn.hsh) } }
on *:load:{ if (!$hget(learn)) { .hmake learn 100 | .hload learn $qt($scriptdirlearn.hsh) } }
on $*:text:/^~(learn|forget|factoid)\s(\w+)\s?(\w.+)?/iS:#: { 
  if (!$($+(%,factoidflood,$nick),2)) {
    set -u3 $+(%,factoidflood,$nick) on
    if ($regml(1) == learn && $regml(3) && !$hget(learn,$regml(2))) { hadd -m learn $regml(2) $regml(3) | msg # the factoid has been saved. } 
    if ($regml(1) == forget && $hget(learn,$regml(2))) { hdel learn $regml(2) | msg # the factoid $regml(2) has been deleted. } 
    if ($regml(1) == factoid && $hget(learn,$regml(2))) { msg # $hget(learn,$regml(2)) }  
  }
}
 Respond  
PATX   -  Jun 12, 2009

@mr_president i did go with hash tables when i was first making this script. but i kept on having an error with /hsave resulting in not being able to save the factoids when you exit mirc. with vars the code is shorter and it saves the info. the same basic script with hash is on http://bitbucket.org/patx/patxbot/src/tip/versions. feel free to use it.

 Respond  
mr_president   -  Jun 01, 2009

wow, This is good but it would be ALOT of varibles..
why not go with hash tables?

 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.