mIRC help system for you bot

By FordLawnmower on May 17, 2009

ImageImage

Image

This is a little help system that I put together that allows you to add and delete help entries from the bots dialogs. In edition, I included the first 345 commands/help topics.

I used pastebin and sockets to load the first 345 commands. Lame, I know, but it's better than telling people to download a separate text file ;/ When you first use the editor or trigger, it will take about 1 minute to download the file and initialize the hashtables. After that it is blazing fast :P

The trigger has an on/off switch that can be found on the menu under mirc help trigger. The editor is under mirc help editor and should be self explanatory after you open it.

The default triggers are @mirc - Ops only - Public response. & !mirc - Public - Private response.

;Help system by Ford_Lawnmower irc.mindforge.org #USA-Chat
dialog -l mirc_help_add {
  title "Mirc Help - - Add Mode"
  size -1 -1 128 208
  option dbu
  button "Add", 3, 7 194 33 12
  button "Clear Screen", 4, 49 194 35 12
  button "Close", 5, 91 194 33 12, Cancel
  box "Syntax/Definition", 8, 6 24 118 82
  box "Example", 9, 6 106 118 82
  edit "", 2, 8 32 112 72, multi vsbar
  edit "", 7, 8 112 112 72, multi vsbar
  edit "", 1, 8 11 114 10, autohs
  text "Topic Name", 6, 8 3 113 8, center
}
On *:Dialog:mirc_help_add:Sclick:3,4: {
  if ($did == 3) { addrecord mirc_help_add }
  if ($did == 4) { did -r mirc_help_add 2,7 }
}
dialog -l mirc_help_edit {
  title "Mirc Help - - Edit Mode"
  size -1 -1 128 208
  option dbu
  button "Save", 3, 7 194 33 12
  button "Clear Screen", 4, 49 194 35 12
  button "Close", 5, 91 194 33 12, cancel
  box "Syntax/Definition", 8, 6 24 118 82
  box "Example", 9, 6 106 118 82  
  text "", 1, 8 16 114 8, center
  edit "", 2, 8 32 112 72, multi vsbar
  edit "", 7, 8 112 112 72, multi vsbar
  text "Now Editing", 6, 8 8 114 8, center
}
On *:Dialog:mirc_help_edit:Sclick:3,4: {
  if ($did == 3) { addrecord mirc_help_edit }
  if ($did == 4) { did -r mirc_help_edit 2,7 }
}
dialog -l mirc_help {
  title "Mirc Help"
  size -1 -1 128 208
  option dbu
  combo 1, 10 8 107 12, sort drop
  text "", 2, 8 32 113 72
  button "Add", 3, 8 194 25 12
  button "Delete", 4, 37 194 25 12
  button "Edit", 5, 67 194 25 12
  button "Close", 6, 96 194 25 12, Cancel
  text "", 7, 8 114 113 72
  box "Syntax/Definition", 8, 6 24 118 82
  box "Example", 9, 6 106 118 82
}
On *:Dialog:mirc_help:Sclick:3-6: {
  if ($did == 3) { dopen mirc_help_add }
  if ($did == 4) && ($did(mirc_help,1).seltext) {
    if ($input(Are you Sure You Want to Delete this Record?,y)) {
      hdel mirchelp $iif($left($did(mirc_help,1).seltext,1) == $chr(36),$+(,$did(mirc_help,1).seltext,),$did(mirc_help,1).seltext)
      did -d mirc_help 1 $did(mirc_help,1).sel
    }
    else { return }
  }
  if ($did == 5) && ($did(mirc_help,1).seltext) {
    dopen mirc_help_edit
    did -a mirc_help_edit 1 $did(mirc_help,1).seltext
    if ($did(mirc_help,2).text) { did -a mirc_help_edit 2 $did(mirc_help,2).text }
    if ($did(mirc_help,7).text) { did -a mirc_help_edit 7 $did(mirc_help,7).text }
  }
}
On *:Dialog:mirc_help:init:*: {
  if (!$hget(mirchelp)) { BotHelp.init }
  else { mirchelp.init }
}
On *:Dialog:mirc_help:Sclick:1: {
  if ($did(mirc_help,1).seltext) { 
    if ($left($did(mirc_help,1).seltext,1) == $chr(36)) {
      if ($between($hget(mirchelp,$+(,$did(mirc_help,1).seltext,)),<ex>,</ex>,1)) {
        did -a mirc_help 2 $strip($remove($hget(mirchelp,$+(,$did(mirc_help,1).seltext,)),$between($hget(mirchelp,$+(,$did(mirc_help,1).seltext,)),<ex>,</ex>,1),<ex>,</ex>))
        did -a mirc_help 7 $strip($between($hget(mirchelp,$+(,$did(mirc_help,1).seltext,)),<ex>,</ex>,1))
      }
      else { 
        did -a mirc_help 2 $remove($strip($hget(mirchelp,$+(,$did(mirc_help,1).seltext,))),<ex>,</ex>)
        did -r mirc_help 7
      }
    }
    else {
      if ($between($hget(mirchelp,$did(mirc_help,1).seltext),<ex>,</ex>,1)) {
        did -a mirc_help 2 $strip($remove($hget(mirchelp,$did(mirc_help,1).seltext),$between($hget(mirchelp,$did(mirc_help,1).seltext),<ex>,</ex>,1),<ex>,</ex>))
        did -a mirc_help 7 $strip($between($hget(mirchelp,$did(mirc_help,1).seltext),<ex>,</ex>,1))
      }
      else { 
        did -a mirc_help 2 $remove($strip($hget(mirchelp,$did(mirc_help,1).seltext)),<ex>,</ex>) 
        did -r mirc_help 7
      }
    }
  }
}
#mirc_help.trigger on
On $*:Text:/(^[!@])mIRC +/Si:#: {
  if (!$hget(mirchelp)) { GetTxt }
  if ($regml(1) == @) && ($nick isop $chan) {
    var %search = $replace($iif($left($eval($2-,1),1) == $chr(36),$+(,$2-,),$2-),$chr(32),_)
    if ($hget(mirchelp,%search)) {
      if ($between($hget(mirchelp,%search),<ex>,</ex>,1)) {
        .msg $chan Syntax --- $remove($hget(mirchelp,%search),$between($hget(mirchelp,%search),<ex>,</ex>,1),<ex>,</ex>)
        .msg $chan Example -- $between($hget(mirchelp,%search),<ex>,</ex>,1)
      }
      else { .msg $chan $remove($hget(mirchelp,%search),<ex>,</ex>) }
    }
    else { .msg $chan %search has not been defined yet. }
  }
  else {
    if (!$timer(mirchelp $+ $nick)) {
      .timer $+ $+(mirchelp,$nick) 1 10 noop
      var %search = $replace($iif($left($eval($2-,1),1) == $chr(36),$+(,$2-,),$2-),$chr(32),_)
      if ($hget(mirchelp,%search)) {
        if ($between($hget(mirchelp,%search),<ex>,</ex>,1)) {
          .notice $nick Syntax --- $remove($hget(mirchelp,%search),$between($hget(mirchelp,%search),<ex>,</ex>,1),<ex>,</ex>)
          .notice $nick Example -- $between($hget(mirchelp,%search),<ex>,</ex>,1)
        }
        else { .notice $nick $remove($hget(mirchelp,%search),<ex>,</ex>) }
      }
      else { .notice $nick %search has not been defined yet. }
    }
  }
}
#mirc_help.trigger End
alias -l BotHelp.init {
  if (!$isfile(StarterHelp.txt)) { GetTxt }
}
alias -l GetTxt {
  echo -at 09Starting Download of Help Files. This could take as long a 60 Seconds.09 Please wait!
  if ($isfile(StarterHelp.txt)) { return }
  sockclose GetTxt
  sockopen GetTxt pastebin.com 80
}
On *:sockopen:GetTxt:{
  sockwrite -nt $sockname GET /pastebin.php?dl=f6a8bb282 HTTP/1.1
  sockwrite -nt $sockname Host: pastebin.com $+ $crlf $+ $crlf
}
On *:sockread:GetTxt:{
  if (!$sock($sockname).mark) {
    var %GetTxt.var | sockread %GetTxt.var
    if (%GetTxt.var == $null) { sockmark $sockname 1 }
  }
  else {
    sockread &File 
    bwrite StarterHelp.txt -1 -1 &File
  }
}
On *:sockclose:GetTxt:{
  unset %GetTxt.*
  echo -at Download of Help Files Complete.
  echo -at 09Initializing Hash Tables. Please wait.
  if (!$hget(mirchelp)) { hmake mirchelp 10 }
  var %eof = $lines(StarterHelp.txt), %count = 1 
  while (%count <= %eof) { 
    if ($left($read(StarterHelp.txt,%count),2) != **) { 
      if ($read(StarterHelp.txt,%count)) { hadd mirchelp $read(StarterHelp.txt,%count) }
    } 
    inc %count 
  }
  hdel mirchelp 0
  hdel mirchelp 75f8
  if ($dialog(mirc_help)) {
    var %count = $hget(mirchelp,0).item
    while (%count) && ($dialog(mirc_help)) {
      did -a mirc_help 1 $strip($hget(mirchelp,%count).item)
      dec %count
    }
  }
  echo -at HashTables Ready. This Script is Ready for Use :)
  .timer 1 5 .remove StarterHelp.txt
}
alias -l mirchelp.init {
  if ($dialog(mirc_help)) { did -r mirc_help 1 }
  var %count = $hget(mirchelp,0).item
  while (%count) && ($dialog(mirc_help)) {
    did -a mirc_help 1 $strip($hget(mirchelp,%count).item) 
    dec %count
  }
}  
alias -l addrecord {
  var %dscr = $prep($addmulti($1,2)), %ex = $+(<ex>,$prep($addmulti($1,7)),</ex>)
  hadd -m mirchelp $replace($iif($left($did($1,1).text,1) == $chr(36),$+(,$did($1,1).text,),$did($1,1).text),$chr(32),_) %dscr %ex
  mirchelp.init
}
alias -l addmulti {
  var %count = $did($1,$2).lines, %counter = 1, %return
  while (%counter <= %count) {
    %return = %return $did($1,$2,%counter).text 
    inc %counter
  }
  return %return
}
alias -l prep { return $replace($1-,$chr(36),$+(,$chr(36),),/,/,|,|) }
alias -l dopen {
  if ($dialog($1)) { dialog -v $1 $1 }
  else { dialog -m $1 $1 }
}
;alias by Gummo
alias -l between { 
  noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) 
  return $regml($4) 
}
On *:Start: { 
  hmake mirchelp 10 
  if ($exists(mirchelp.hsh)) { hload mirchelp mirchelp.hsh }
  else { GetTxt }
}
On *:Exit: {
  if ($hget(mirchelp)) { 
    hsave mirchelp mirchelp.hsh
    hfree mirchelp
  }
}
On *:Unload: {
  hfree mirchelp
}
menu * {
  mIRC hELP bOT
  .mIRC hELP Editor:dopen mirc_help
  .$iif($group(#mirc_help.Trigger) == On,$style(1)) mIRC hELP Trigger
  ..$iif($group(#mirc_help.Trigger) == On,$style(2)) On: .enable #mirc_help.Trigger
  ..$iif($group(#mirc_help.Trigger) == Off,$style(2)) Off: .disable #mirc_help.Trigger
}

Comments

Sign in to comment.
ChUcKst3r   -  Mar 13, 2013

for those whostill wanna use it

replace: On *:sockopen:GetTxt:{ sockwrite -nt $sockname GET /pastebin.php?dl=f6a8bb282 HTTP/1.1 sockwrite -nt $sockname Host: pastebin.com $+ $crlf $+ $crlf }

by

On *:sockopen:GetTxt:{ sockwrite -nt $sockname GET /download.php?i=f6a8bb282 HTTP/1.1 sockwrite -nt $sockname Host: pastebin.com $+ $crlf $+ $crlf }

More
 Respond  
Lenooox   -  Jul 11, 2011

hmm This script does not work for me! I think the files have been deleted from http://pastebin.com or not? :$

More
 Respond  
Xpl0reR   -  Jul 01, 2011

hmm, the script has not even one reply to it. where is the file, ill download it and add it to the bot.

More
 Respond  
FordLawnmower   -  Jun 29, 2011

@Xpl0reR I've actually added most of the mIRC help file to this script but I was waiting till I had it all added to post an update. I'm building a deck on to my house with my spare time right now but I will update this script when I get it done. I'll try to get it posted in the next two weeks, with the triggers added to the script.

More
 Respond  
Xpl0reR   -  Jun 29, 2011

It would be nice if you could add stuff via IRC, my bot is on a dedicated Computer (Only the bot runs on it) there is no screen, and i have to login on TeamViewer everytime i need something done. adding a trigger for example !mirc + $nick $nick(#,N/nick,aohvr,aohvr) !mirc ++ $nick Returns Nth nickname in the channels nickname listbox on channel #.

(+ is to add the Syntax line) (++ is to add the example line)

that would be awesome! totally.

(10/10)

More
 Respond  
FordLawnmower   -  Jun 11, 2009

Thanks Cheiron :) There are so many irc related commands and identifiers, I just added some to get the help system started. IMO Building it yourself and phrasing the definitions in your own manner, is always much better anyway.

The stuff I added with the socket is really just for demonstration purposes :)

More
 Respond  
Cheiron   -  Jun 11, 2009

it is not working for me for some reason.. it is loaded on a blank mirc 6.35 and this is what i get

12<20912:251pm12> lets see if i got this working... 12<20912:252pm12> @mirc %var 12<20912:252pm12> %var has not been defined yet. 12<20912:252pm12> o.o 12<20912:252pm12> @mirc $ulevel 12<20912:252pm12> $ulevel has not been defined yet. 12<20912:252pm12> hmmm 12<20912:252pm12> @mirc $ulevel public 12<20912:252pm12> $ulevel_public has not been defined yet. 12<20912:252pm12> dam 12<20912:253pm12> @mirc $bnamask public 12<20912:253pm12> $bnamask_public has not been defined yet. 12<20912:254pm12> frikken thing 12<20912:255pm12> @mirc $bvar 12<20912:255pm12> $bvar has not been defined yet. 12<20912:255pm12> i give up

oh my bad.. i checked the files and var wasnt there that why it no worked.. it workies for what is there though grins gets a 9 and a like

More
 Respond  
FordLawnmower   -  May 19, 2009

Thanks ^Neptune. I changed the line to this

if ($dialog(mirc_help)) { did -r mirc_help 1 }

That line was a bugfix that I added at the last minute ;/

Thank You PATX :)

More
 Respond  
PATX   -  May 19, 2009

another one i love....

More
 Respond  
^Neptune   -  May 19, 2009

For say, if you want to reference to a website for help, or include some tips.

And the error was caused by me closing the main dialog when pressing Add. Maybe you should make a check with $dialog :P

More
 Respond  
FordLawnmower   -  May 19, 2009

How did you get that error? I tried to reproduce it and no error ;/

[16:13:46] @mirc != [16:13:47] Syntax --- An operator used in statements, means not equal to [16:13:47] Example -- Example - if ($nick != Bob) will return TRUE if the nickname is not Bob. I have this as line 175

var %count = $hget(mirchelp,0).item

It's possible to add another field, but the dialog is already rather giant. What would the Additional Text field be used for?

More
 Respond  
^Neptune   -  May 19, 2009
  • /did: invalid parameters (line 175, script2.mrc)

Topic name: != Syntax/Definition: Definition - An operator used in statements, means not equal to. Example: Example - if ($nick != Bob) will return TRUE if the nickname is not Bob.

Fail?

Would it be possible to add an "additional comments" field where, if something was added, it'd message that aswell?

More
 Respond  
FordLawnmower   -  May 18, 2009

How ever many you want to add ^Neptune :) I guess I should have called them topics ;/ You can add multiple word topics so you can make it as detailed as you want. For instance, you could add "Build a Fire" with a description "rub two sticks together for 200 straight hours" with the example "FordLawnmower rubbed two sticks together for 199 hours and froze to death just before it lit" It would be stored as Build_a_Fire rub two sticks together for 200 straight hours FordLawnmower rubbed two sticks together for 199 hours and froze to death just before it lit Then you could trigger it with @!mirc Build a Fire

[20:17:41] @mirc Build a Fire [20:17:41] Syntax --- Rub two sticks together for 200 straight hours [20:17:41] Example -- FordLawnmower rubbed two sticks together for 199 hours and froze to death just before it lit

More
 Respond  
^Neptune   -  May 18, 2009

First 345 commands? How many are there in total..?

More
 Respond  
FordLawnmower   -  May 18, 2009

Thanks Aucun50 :) Yea the dialog is just for adding,viewing and editing the help topics. mIRC's /help is awesome :)

More
 Respond  
Aucun50   -  May 17, 2009

That looks good, i couldn't see using the dialog over the /help command but the in channel commands could be handy.

More
 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.