Bash.org script with Dialog setup

By GrimReaper on Apr 10, 2011

I was looking around for a good bash.org script, but couldn't see one that Suited my needs.. So thought why not make one..

Just load the script's into your bot's remotes in the script's editor.. Then when you have saved it, Right click in a channel to open up the Setup dialog.

Once you have done that, You need to add channel's, a Trigger, and two colors for the output.

Then hit Ok/Save and it should all be saved into the settings file.

Then just use the trigger you specified..

Syntax:

: Will show the quote for that number. : will show a random quote. I would like to thank FordLawnmower for help on the regex and getting the Random quote to work. ![Image](http://iTechNet.info/screengrab/Image1302436957.png) **Caution:** Some of the quote's may contain racist comments.. But then again.. they may not. I have sorted out the channel's problem, Only other thing I need to sort out now to get it working fully is the removeprefix alias, as it misses some and get's the other's. ```mirc menu channel { &Bash.org Setup:dialog $iif($dialog(bashdotorg),-v,-m bashdotorg) bashdotorg } dialog bashdotorg { title "Bash.org Setup" size -1 -1 170 151 option dbu box "Channel Setup:", 3, 3 3 65 144 button "Add", 4, 17 14 37 12 button "Delete", 5, 17 32 37 12, disable button "Refresh", 6, 17 49 37 12, disable list 7, 7 66 56 76, size box "General Setup", 8, 74 3 92 71 text "Trigger Setup:", 9, 79 13 35 8 edit "", 10, 117 12 44 10 text "First Color:", 11, 79 26 27 8 edit "", 12, 109 25 52 10 text "Second Color:", 13, 79 39 34 8 edit "", 14, 115 38 46 10 button "Help", 15, 100 55 37 12 button "Ok/Save", 16, 78 80 37 12 button "Cancel", 17, 125 80 37 12, cancel text "This Bash.org addon was created by GrimReaper and Zetacon of the GeekShed IRC Network.. Should you need to contact them about anything, Feel free to join irc.GeekShed.net channels: #Hell and #Zetacon", 18, 78 97 87 49 menu "File", 1 item "Exit", 2, 1, ok cancel } dialog bashdotorghelp { title "Bash.org Help" size -1 -1 170 97 option dbu box "Help Sections:", 1, 3 3 62 72 list 4, 7 11 53 60, size box "Information:", 5, 69 3 97 72 text "", 6, 73 11 88 59 button "Ok", 7, 42 80 37 12, ok button "Cancel", 8, 91 80 37 12, cancel menu "File", 2 item "Close", 3, 2 } on *:DIALOG:bashdotorghelp:init:*: { didtok $dname 4 124 Add|Delete|Refresh|Trigger|Color 1|Color 2|About|Thanks } on *:DIALOG:bashdotorghelp:sclick:4: { if ($did(4).seltext == Add) { did -ra $dname 6 The "Add" button is there to provide the use of adding another channel to the setup. All channels should start with $+($chr(35),$chr(46)) } if ($did(4).seltext == Delete) { did -ra $dname 6 The "Delete" button is for when you would like to delete a channel from the setup of the script. Thus, halting any further command being triggered. } if ($did(4).seltext == Refresh) { did -ra $dname 6 The "Refresh" button is there so that you can refresh the channel's that have been added to the setting config. } if ($did(4).seltext == Trigger) { did -ra $dname 6 The "Trigger" edit box is there for you to enter a command trigger to use, Any trigger can be used, Input it like !Bash or @bash depending on Preference. } if ($did(4).seltext == Color 1) { did -ra $dname 6 The "Color 1" section is for the main color choice that you would like to use, i.e. the main quote from Bash.org's database of quotes. } if ($did(4).seltext == Color 2) { did -ra $dname 6 The "Color 2" section is the setting for the "Bash Quote" text at the beginning of the quote. You can set this to whatever preference you like. } if ($did(4).seltext == About) { did -ra $dname 6 This Bash.org addon was created by GrimReaper and Zetacon of the GeekShed IRC Network.. Should you need to contact them about anything, Feel free to join irc.GeekShed.net channels: #Hell and #Zetacon. } if ($did(4).seltext == Thanks) { did -ra $dname 6 This Bash.org addon would not be possible without help from some people, Namingly FordLawnmower for help on all the regex section. A HUGE thanks to him. } } on *:DIALOG:bashdotorg:init:*: { if ($readini(bashdotorg.ini,settings,channels) != $null) { did -e $dname 5,6 var %a = $readini(bashdotorg.ini,settings,channels), %b = 1 while (%b <= $numtok(%a,44)) { did -a $dname 7 $gettok(%a,%b,44) inc %b } } did -a $dname 10 $readini(bashdotorg.ini,settings,trigger) did -a $dname 12 $readini(bashdotorg.ini,settings,color1) did -a $dname 14 $readini(bashdotorg.ini,settings,color2) } on *:DIALOG:bashdotorg:sclick:4-6,15,16: { if ($did == 4) { if ($readini(bashdotorg.ini,settings,channels) == $null) { writeini bashdotorg.ini settings channels $$?="Please enter a channel to add." refreshchanlist did -e $dname 5,6 } else { var %c = $readini(bashdotorg.ini,settings,channels) writeini -n bashdotorg.ini settings channels $+(%c,$chr(44),$$?="Please enter a channel to add.") refreshchanlist } } if ($did == 5) { var %c = $remtok($readini(bashdotorg.ini,settings,channels),$did(7).seltext,44) remini bashdotorg.ini settings channels $iif(%c != $null,.timer 1 1 writeini bashdotorg.ini settings channels %c) $iif($readini(bashdotorg.ini,settings,channels) == $null,.timer 1 1 did -b $dname 5,6) .timer 1 1 dialog -x $dname } if ($did == 6) { refreshchanlist | .timer 1 1 noop $input(Refreshing of the channel list has been completed.,o,Refresh!) } if ($did == 15) { dialog $iif($dialog(bashdotorghelp),-v,-m bashdotorghelp) bashdotorghelp } if ($did == 16) { if ($did(10) == $null) || ($did(12) == $null) || ($did(14) == $null) { noop $input(Not all fields have been $+(filled,$chr(44)) Please fill in all field.,o,Error!) } else { $iif($readini(bashdotorg.ini,settings,trigger) == $null,writeini,writeini -n) bashdotorg.ini settings trigger $did(10) $iif($readini(bashdotorg.ini,settings,color1) == $null,writeini,writeini -n) bashdotorg.ini settings color1 $did(12) $iif($readini(bashdotorg.ini,settings,color2) == $null,writeini,writeini -n) bashdotorg.ini settings color2 $did(14) } } } alias -l refreshchanlist { did -r bashdotorg 7 var %a = $readini(bashdotorg.ini,settings,channels), %b = 1 while (%b <= $numtok(%a,44)) { did -a bashdotorg 7 $gettok(%a,%b,44) inc %b } } on *:TEXT:*:$($readini(bashdotorg.ini,settings,channels)): { if ($1 == $readini(bashdotorg.ini,settings,trigger)) { if ($sock($+(bash,$chan))) { msg $chan Please wait till the current search has finished. } else { set -u10 %bashchan $chan bashopen $iif(!$2,random,$2) .timerbash 1 2 msg $chan * Error: Bash quote number $+(",$2,") does not exist. } } } on *:SOCKOPEN:bash: { tokenize 32 $sock(bash).mark if ($sockerr) { $2-3 * Error: Can't connect to the server. } else { var %var = sockwrite -n $sockname %var GET $+(/?,$1) HTTP/1.0 %var Host: bash.org %var $crlf } } on *:SOCKREAD:bash: { tokenize 32 $sock(bash).mark var %bashread | sockread %bashread if ($1 isnum) { if (( isin %bashread) || (
isin %bashread)) { $2- $RemovePrefix($replace($htmlfree(%bashread),$chr(9),$chr(32),$chr(10),$chr(32),<,<,>,>,",$chr(34), ,$chr(160))) .timerbash off } elseif ( isin %bashread) { .sockclose $sockname } } else { if ($regex(%bashread,/#([\d]{1,})<\/b>/)) { sockclose $sockname | bashopen $regml(1) } } } alias -l bashopen { sockopen bash bash.org 80 sockmark bash $iif(!$1,random,$1) msg %bashchan $+($chr(3),$bashcol2,:,$chr(3),$bashcol1,[,$chr(3),$bashcol2,Bash,$chr(3),$bashcol1,],$chr(3),$bashcol2,:,$chr(3),$bashcol1) } alias -l bashcol1 { return $readini(bashdotorg.ini,settings,color1) } alias -l bashcol2 { return $readini(bashdotorg.ini,settings,color2) } alias -l RemovePrefix { return $regsubex($1-,/(#(?:[\d]{1,})\s\+\((?:[\d]{1,})\)-\s\[X\])/i,$null) } ```

Comments

Sign in to comment.
napa182   -  Jun 15, 2011

commy you can message me on here the link to the site where the info you are trying to pull is an i can see what i can do to help.

 Respond  
napa182   -  Jun 06, 2011

yes you can commy as long as you know sockets.

 Respond  
GrimReaper   -  Apr 10, 2011

That's weird, It's supposed to remove the > #724+(2)-[X] section..

I will have a look at it again in a second..

 Respond  
henbone11   -  Apr 10, 2011

[ 10:06:35 ] [@nick] !bash
[ 10:06:37 ] [@bot] yellow:green[yellowBashgreen]yellow:green #724+(2)-[X]EFXatleastI'mnotblackwithahugepenis
[ 10:07:46 ] [@nick] !bash 100
[ 10:07:47 ] [@bot] yellow:green[yellowBashgreen]yellow:green #100+(38)-[X]KayemDon'ttellanyone,but...I'MtheonewhogaveStellahergrooveback

this is the output I get

 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.