Jump to content

chain

Administrators
  • Posts

    5,964
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by chain

  1. Just another socket from me ;x this one looks up a random tweet from twasted tweets. copy/paste into a new remote. Trigger is @twasted or @twast May not be right for +G rated channels As always rip strip this snippet how ever you see fit. I can care less. ex: <~napa182> @twasted <&Sick0> TwastedTweets: RT @rsmallbone My erection lasted for 4 hours +. I called my doctor but he didnt seem too impressed so I showed it to some ppl at the mall <~napa182> @twast <&Sick0> TwastedTweets: RT @shariv67 The most tedious part of being an Afghani phone sex operator is describing what I'm wearing. <~napa182> @twast <&Sick0> TwastedTweets: RT @ruthakers Man at Walmart asked me the name of "Mommys Lil Helpers". Judging by his face "Xanax & Vodka" wasnt the reply he was looking 4 on $*:text:/^@(twast(ed)?)$/iS:#: { if (!$($+(%,f,#),2)) { inc -u4 $+(%,f,#) if ($sock($+(Twast,#))) sockclose $+(Twast,#) sockopen $+(Twast,#) api.twitter.com 80 sockmark $+(Twast,#) $r(1,20) $& $+(/1/statuses/user_timeline/TwastedTweets.rss?page=,$r(1,26)) msg # } } on *:sockopen:Twast*: { sockwrite -nt $sockname GET $gettok($sock($sockname).mark,2,32) HTTP/1.1 sockwrite -nt $sockname Host: $+($sock($sockname).addr,$str($crlf,2)) } on *:load:{ echo 12 -a You Have Just Loaded Napa182's Twasted Tweets Snippet echo -a 08!!04WARNING08 This snippet may04/08will say curse04/08foul words 04WARNING08!! } alias -l twast return $regsubex($1-,/(&quot;|&amp;)|\46\43(\d+)\73/g,$iif(\1 isnum,$chr(\1),$iif(\1 = &quot;,",&))) on *:sockread:Twast*: { var %Twast | sockread %Twast if ($regex(%Twast,/<title>(Twa.+?)<\/title>/)) { inc -u4 %tw 1 if (%tw = $gettok($sock($sockname).mark,1,32)) { $gettok($sock($sockname).mark,3-,32) $twast($regml(1)) sockclose $sockname } } }
  2. Copy the code below and paste into an empty Remote file in mIRC (alt+r to view Remotes) Click ok, and either right click anywhere in a channel or type /autoreply Follow the instructions in the dialog and create your own custom auto-response message! I hang out in #script on Gamesurge and by far the most common question (especially recently) is "how do I set up a query auto response?". I know that when I was starting out scripting I was much more comfortable with dialogs as they ease the process and make it more understandable (at least for me), so I thought it would be useful to create this. Obviously many of this site's frequenters won't have any use for it, but it's made for people who are either new to scripting or can't script at all. Thank you to FordLawnMower for the (http://www.hawkee.com/snippet/6047/) which I borrowed (and slightly modified) due to mIRC not allowing you to open up the color dialog any way other than control+k As somebody who has never used an auto-reply myself I didn't know exactly what would be best for this dialog, so if anyone has a suggestion on what I could add/remove please let me know! Thanks! //Auto-reply creator dialog by tv3636 //Version 1.0 7/26/09 alias autoreply { dialog -m autoreply autoreply } menu channel { Auto-Reply Creator .Auto-Reply Creator:/autoreply } dialog autoreply { title "Auto Reply Creator" size -1 -1 195 175 option dbu edit "", 1, 1 97 192 38, multi return button "Done", 3, 76 160 37 12, ok cancel text "Type your desired auto-reply in the text box below. To wrap a section in bold, color, underline, or reverse text simply check the box at the beginning of the section and uncheck it at the end. On top of the text box is a list of common identifiers you may want to use. These are dynamic and will return values rather than being displayed as they are. For instance, the auto-reply 'Hi $nick' would auto reply to Chanserv with 'Hi Chanserv'. To insert an identifier simply double click on it (or manually enter it). Be warned that an identifier must have a space before and after it to evaluate correctly.", 4, 5 2 186 54 list 6, 1 56 193 39, size check "Bold", 7, 20 137 24 10 check "Color", 8, 56 137 24 10 check "Underline", 9, 94 137 34 10 check "Reverse", 10, 145 137 30 10 } On *:Dialog:autoreply:init:*: { did -a $dname 6 $!nick - Returns the nickname of the user who messaged you did -a $dname 6 $!query(0) - Returns the number of query windows you have open did -a $dname 6 $!duration($idle) - Returns the time you have been idle did -a $dname 6 $!awaymsg - Returns your away message did -a $dname 6 $!awaytime - Returns your away time } On *:Dialog:autoreply:dclick:6: { if ($did($dname,6).sel == 1) did -a $dname 1 $!nick else if ($did($dname,6).sel == 2) did -a $dname 1 $!query(0) else if ($did($dname,6).sel == 3) did -a $dname 1 $!duration($idle) else if ($did($dname,6).sel == 4) did -a $dname 1 $!awaymsg else if ($did($dname,6).sel == 5) did -a $dname 1 $!awaytime } On *:Dialog:autoreply:sclick:*:{ if ($did == 7) did -a $dname 1 else if ($did == 8) { if ($did($dname,8).state == 0) did -a $dname 1 else { ColorPicker } } else if ($did == 9) did -a $dname 1 else if ($did == 10) did -a $dname 1 } On *:Dialog:autoreply:close:*: { var %x = 1 var %out write -c autoreply.mrc On *:Open:?:*: $chr(123) while (%x <= $did($dname,1).lines) { write autoreply.mrc msg $!nick $did($dname,1,%x) | inc %x } write autoreply.mrc $chr(125) load -rs autoreply.mrc echo -a 07Auto-reply created successfully. To view/modify go to the Remotes tab of the mIRC scripts editor (alt+r), click on view, and select "autoreply.mrc" } alias -l MakeColorIcons { var %c 0 if (!$isdir($+($mircdir,ColorIcon))) { mkdir ColorIcon } while (%c <= 15) { if (!$window(@MakeColorIcons)) { window -hBpf +d @MakeColorIcons -1 -1 68 68 } drawfill @MakeColorIcons %c %c 0 0 68 68 if (!$isfile($+(ColorIcon\,ColorIcon,%c,.bmp))) { drawsave @MakeColorIcons $qt($+($mircdir,ColorIcon\,ColorIcon,%c,.bmp)) } inc %c } window -c @MakeColorIcons } alias ColorPicker { if (!$dialog(ColorPicker)) { dialog -m ColorPicker ColorPicker } else { dialog -v ColorPicker ColorPicker } } dialog ColorPicker { title "Color Picker" size -1 -1 90 45 option dbu icon 1, 2 2 8 8 icon 2, 13 2 8 8 icon 3, 24 2 8 8 icon 4, 35 2 8 8 icon 5, 46 2 8 8 icon 6, 57 2 8 8 icon 7, 68 2 8 8 icon 8, 79 2 8 8 icon 9, 2 15 8 8 icon 10, 13 15 8 8 icon 11, 24 15 8 8 icon 12, 35 15 8 8 icon 13, 46 15 8 8 icon 14, 57 15 8 8 icon 15, 68 15 8 8 icon 16, 79 15 8 8 button "", 17, 4 4 4 4 button "", 18, 15 4 4 4 button "", 19, 26 4 4 4 button "", 20, 37 4 4 4 button "", 21, 48 4 4 4 button "", 22, 59 4 4 4 button "", 23, 70 4 4 4 button "", 24, 81 4 4 4 button "", 25, 4 17 4 4 button "", 26, 15 17 4 4 button "", 27, 26 17 4 4 button "", 28, 37 17 4 4 button "", 29, 48 17 4 4 button "", 30, 59 17 4 4 button "", 31, 70 17 4 4 button "", 32, 81 17 4 4 button "Accept", 38, 30 30 29 12, ok } On *:Dialog:ColorPicker:Close:*: { unset %ColorPicker* } On *:Dialog:ColorPicker:Sclick:*: { if ($did >= 17) && ($did <= 32) { set %ColorPickerNum $calc($did - 17) } if ($did == 38) { did -a autoreply 1 $+ %ColorPickerNum } } On *:Dialog:ColorPicker:init:*: { MakeColorIcons var %c = 0 while %c <= 15 { did -g ColorPicker $calc(%c + 1) $+(ColorIcon\,ColorIcon,%c,.bmp) inc %c } did -c ColorPicker 35 set %ColorPickerFG $color(normal text) set %ColorPickerBG $color(background) }
  3. chain

    Update on Snippets

    So im getting a lot of the old snippets from hawkee's and never knew there was so many, but im going fourth and continue to move forward and add more and more each day. I really havent counted as to how many snippets have been added on hawkee but this i can tell you i will have all of them on coders-resources so we dont loose them all. we will have a huge range of archive snippets and scripts and continue to do so!! I will continue to keep you all posted and continue to add more and more 👍
  4. mIRC Kicking Clones Games for Server Zildjan.mine.nu:6667 by Team SpiralKinetics. A simple mIRC code intended to kick clones. Summary of the games detailed in the code dialog. ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] menu status,menubar,channel { - Spiralkinetics™ Dual Mode:/dialog $iif($dialog(dualmode),-o,-m) dualmode dualmode Spiralkinetics™ MassJoin Clear cloneMJ.TXT:/write -c cloneMJ.txt Spiralkinetics™ Flood Clear cloneFL.TXT:/write -c cloneFL.txt - } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] dialog dualmode { title "SpiralKinetics Dual Mode Sock Configuration" size -1 -1 210 180 option dbu ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] tab "Intro", 1, 5 2 200 150, box "", 10, 10 15 190 135 text "Script: SpiralKinetics Dual Mode", 11, 15 20 180 10, tab 1 enable text "Coder: Sabri", 12, 15 27 180 10, tab 1 enable text "Tester: ItikRock, Ahseng, Cloud, Kereei and m11x", 13, 15 34 180 10, tab 1 enable text "Disclaimer: This code belong to Team SpiralKinetics and we just lend it to whoever wish to use it.", 14, 15 41 180 20, tab 1 enable text "Advisor: Bioshock and zildjan", 77, 15 59 180 10, tab 1 enable text "Applications: Flooding and MassJoin Games at Server Zildjan.mine.nu:6667", 15, 15 65 180 10, tab 1 enable text "Channel: Flooding #FLOOD / MassJoin #BIRC", 78, 15 72 180 10, tab 1 enable text "Games Summary:-", 16, 15 82 180 10, tab 1 enable text "Flood - (#FLOOD) Basic understanding are kicking clone on syntax error display on channel by each clone such as Long text etc.", 17, 15 90 180 20, tab 1 enable text "MassJoin - (#BIRC) Basic understanding are kicking all join clone.", 18, 15 104 180 10, tab 1 enable text "Team: SpiralKinetics Establish in 2010.", 19, 15 115 180 10, tab 1 enable text "Team members comprise of: Bioshock (Founder) and Senior Members: Sabri, ItikRock, Kereei, Ahseng, Cloud and m11x", 20, 15 122 180 15, tab 1 enable text "Like Us:", 21, 15 140 20 10, tab 1 enable link "FaceBook Page: SpiralKinetics Productions", 22, 35 140 130 15, tab 1 enable ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] tab "MassJoin", 2, 5 2 170 130 box "MassJoin Configuration", 4, 15 20 180 125, tab 2 box "Groups", 23, 20 30 170 20, tab 2 text "Enable/Disable MassJoin Remote Groups:", 24, 25 38 99 10, enable tab 2 radio "Enable", 25, 127 36 25 10, left tab 2 box "", 26, 155 32 2 16, tab 2 radio "Disable", 27, 160 36 25 10, tab 2 box "Set Nick/Pass Sock`s", 28, 20 53 70 50, tab 2 text "Nick:", 29, 25 63 13 10, tab 2 edit "", 30, 40 63 45 10, center autohs tab 2 text "Pass:", 31, 25 78 13 10, tab 2 edit "", 32, 40 78 45 10, center pass autohs, tab 2 button "Set Nick/Pass", 33, 32 90 45 10, disable tab 2 box "", 34, 95 50 95 50, tab 2 text "Add Server eg.", 35, 125 55 40 10, tab 2 text "Zildjan.mine.nu PORT: 6667", 36, 109 62 68 10, tab 2 edit "", 37, 100 71 85 10, center autohs tab 2 edit "", 38, 118 85 25 10, center autohs tab 2 text "PORT:", 39, 100 86 15 10, tab 2 button "Add Server", 40, 146 85 40 10, disable tab 2 box "Set Channel e. #birc", 41, 20 105 63 37, tab 2 edit "", 42, 29 115 45 10, center autohs tab 2 button "Add Chan", 43, 32 128 40 10, disable tab 2 text "ON/OFF Your Sock`s", 44, 110 102 60 10, tab 2 button "Connect", 45, 95 112 40 15, tab 2 button "Disconnect", 46, 140 112 40 15, tab 2 text "Clear all MassJoin Setting:", 47, 85 132 70 10, tab 2 button "¤ Clear All ¤", 48, 152 130 40 12, tab 2 ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] tab "Flood", 3, 5 2 170 130 box "Flood Configuration", 5, 15 20 180 125, tab 3 box "Groups", 49, 20 30 170 20, tab 3 text "Enable/Disable Flood Remote Groups:", 50, 25 38 99 10, enable tab 3 radio "Enable", 51, 127 36 25 10, left tab 3 box "", 52, 155 32 2 16, tab 3 radio "Disable", 53, 160 36 25 10, tab 3 box "Set Nick/Pass Sock`s", 54, 20 53 70 50, tab 3 text "Nick:", 55, 25 63 13 10, tab 3 edit "", 56, 40 63 45 10, center autohs tab 3 text "Pass:", 57, 25 78 13 10, tab 3 edit "", 58, 40 78 45 10, center pass autohs, tab 3 button "Set Nick/Pass", 59, 32 90 45 10, disable tab 3 box "", 60, 95 50 95 50, tab 3 text "Add Server eg.", 61, 125 55 40 10, tab 3 text "Zildjan.mine.nu PORT: 6667", 62, 109 62 68 10, tab 3 edit "", 63, 100 71 85 10, center autohs tab 3 edit "", 64, 118 85 25 10, center autohs tab 3 text "PORT:", 65, 100 86 15 10, tab 3 button "Add Server", 66, 146 85 40 10, disable tab 3 box "Set Channel e. #flood", 67, 20 105 63 37, tab 3 edit "", 68, 29 115 45 10, center autohs tab 3 button "Add Chan", 69, 32 128 40 10, disable tab 3 text "ON/OFF Your Sock`s", 70, 110 102 60 10, tab 3 button "Connect", 71, 95 112 40 15, tab 3 button "Disconnect", 72, 140 112 40 15, tab 3 text "Clear all Flood Setting:", 73, 85 132 70 10, tab 3 button "¤ Clear All ¤", 74, 152 130 40 12, tab 3 ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] tab "Timing", 79, 5 2 170 130 box "MassJoin Timer/Isnum Tune", 80, 13 20 184 62, tab 79 box "Flood Timer/Isnum Tune", 81, 13 85 184 62, tab 79 text "Default setting isnum is 467-487 and larger than > 497. Isnum: Setting must be in different between 20 - 22 lines. i.e:min-100-120, max-100-122. Larger than that may cause you excessing. Delay: Setting must be in different of 10 lines after direct isnum last line. i.e if direct isnum 100-120 you may set your starting delay line: 130. Try default setting.", 82, 15 28 180 33, enable tab 79 button "Use Default Setting", 83, 15 66 55 10, tab 79 box "", 84, 73 60 121 20, tab 79 text "Isnum:", 85, 75 67 17 10, tab 79 edit "", 86, 93 66 28 10, center autohs tab 79 text ">", 87, 123 67 4 10, tab 79 edit "", 88, 130 66 15 10, center autohs tab 79 button "Use My Own", 89, 150 66 40 10, disable tab 79 text "Same as MassJoin. Default setting isnum is 367-387 and larger than > 397. Isnum: Setting must be in different between 20 - 22 lines. i.e:min-100-120, max-100-122. Larger than that may cause you excessing. Delay: Setting must be in different of 10 lines after direct isnum last line. i.e if direct isnum 100-120 you may set your starting delay line: 130. Try default setting.", 90, 15 93 180 33, enable tab 79 button "Use Default Setting", 91, 15 131 55 10, tab 79 box "", 92, 73 125 121 20, tab 79 text "Isnum:", 93, 75 132 17 10, tab 79 edit "", 94, 93 131 28 10, center autohs tab 79 text ">", 95, 123 132 4 10, tab 79 edit "", 96, 130 131 15 10, center autohs tab 79 button "Use My Own", 97, 150 131 40 10, disable tab 79 ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] tab "Logo", 100, 5 2 170 130 box "MassJoin Logo Setting", 98, 13 20 184 62, tab 100 box "Flood Logo Setting", 99, 13 85 184 62, tab 100 box "", 101, 30 50 150 1, tab 100 box "", 102, 30 115 150 1, tab 100 text "`` Dûä£ Mødè Mässjøíñ :: «®¤Šþì®á£Kïnè†í犙¤®»", 103, 15 29 180 10, center tab 100 button "Use Default Logo", 104, 32 37 60 10, tab 100 button "View/Echo", 105, 118 37 60 10, tab 100 edit "", 106, 16 55 178 10, autohs tab 100 button "View/Echo", 107, 20 68 50 10, tab 100 button "Use My Own", 108, 80 68 50 10, tab 100 button "Clear", 109, 140 68 50 10, tab 100 text "`` Dûä£ Mødè F£øød :: «®¤Šþì®á£Kïnè†í犙¤®»", 110, 15 94 180 10, center tab 100 button "Use Default Logo", 111, 23 102 60 10, tab 100 button "View/Echo", 112, 127 102 60 10, tab 100 edit "", 113, 16 120 178 10, autohs tab 100 button "View/Echo", 114, 20 133 50 10, tab 100 button "Use My Own", 115, 80 133 50 10, tab 100 button "Clear", 116, 140 133 50 10, tab 100 ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx tab "Halting", 200, 5 2 170 130 box "MassJoin Channel", 117, 13 20 90 127, tab 200 check " MODE OP : ", 118, 62 30 37 10, left tab 200 check " MODE DEOP : ", 119, 49 45 43 10, left tab 200 check " JOIN : ", 120, 73 60 26 10, left tab 200 check " PART : ", 121, 65 75 27 10, left tab 200 check " BAN : ", 122, 75 90 24 10, left tab 200 check " UNBAN : ", 123, 61 105 31 10, left tab 200 check " KICK : ", 124, 74 120 25 10, left tab 200 text "To halt, set channel at MassJoin Tab. ie. #BIRC", 133, 16 130 80 20, center tab 200 box "Flood Channel", 125, 107 20 90 127, tab 200 check " : MODE OP ", 126, 116 30 83 10, tab 200 check " : MODE DEOP ", 127, 110 45 83 10, tab 200 check " : JOIN ", 128, 116 60 83 10, tab 200 check " : PART ", 129, 110 75 83 10, tab 200 check " : BAN ", 130, 116 90 83 10, tab 200 check " : UNBAN ", 131, 110 105 83 10, tab 200 check " : KICK ", 132, 116 120 83 10, tab 200 text "To halt, set channel at Flood Tab. ie. #FLOOD", 134, 110 130 80 20, center tab 200 ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] text "«®¤b£áçkŠKŠè®ìès¤®» :: «®¤Šþì®á£Kïnè†í犙¤®»", 75, 8 162 135 10, disable button "«®¤ CLOSE ¤®»", 76, 150 159 55 14, ok } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] on 1:dialog:dualmode:*:*:{ if ($devent == edit) { if ($did == 30) { did -e $dname 33 } if ($did == 37) || ($did == 38) { did -e $dname 40 } if ($did == 42) { did -e $dname 43 } if ($did == 56) { did -e $dname 59 } if ($did == 63) || ($did == 64) { did -e $dname 66 } if ($did == 68) { did -e $dname 69 } if ($did == 86) || ($did == 88) { did -e $dname 89 } if ($did == 94) || ($did == 96) { did -e $dname 97 } } if ($devent == init) { if ($group(#mjdialog) == on) { did -c $dname 25 } if ($group(#mjdialog) == off) { did -c $dname 27 } if ($group(#flooddialog) == on) { did -c $dname 51 } if ($group(#flooddialog) == off) { did -c $dname 53 } if (%MJsocknick) || (%MJpasssock) || (%MJserver) || (%MJport) || (%MJchan) || (%MJisnum) || (%MJafter) || (%MJlogo) { did -a $dname 30 %MJsocknick did -a $dname 32 %MJpassnick did -a $dname 37 %MJserver did -a $dname 38 %MJport did -a $dname 42 %MJchan did -a $dname 86 %MJisnum did -a $dname 88 %MJafter did -a $dname 106 %MJlogo } if (%FLsocknick) || (%FLpasssock) || (%FLserver) || (%FLport) || (%FLchan) || (%FLisnum) || (%FLafter) || (%FLlogo) { did -a $dname 56 %FLsocknick did -a $dname 58 %FLpassnick did -a $dname 63 %FLserver did -a $dname 64 %FLport did -a $dname 68 %FLchan did -a $dname 94 %FLisnum did -a $dname 96 %FLafter did -a $dname 113 %FLlogo } if ($group(#mjophalt) == on) { did -c $dname 118 } if ($group(#mjophalt) == off) { did -u $dname 118 } if ($group(#mjdeophalt) == on) { did -c $dname 119 } if ($group(#mjdeophalt) == off) { did -u $dname 119 } if ($group(#mjjoinhalt) == on) { did -c $dname 120 } if ($group(#mjjoinhalt) == off) { did -u $dname 120 } if ($group(#mjparthalt) == on) { did -c $dname 121 } if ($group(#mjparthalt) == off) { did -u $dname 121 } if ($group(#mjbanhalt) == on) { did -c $dname 122 } if ($group(#mjbanhalt) == off) { did -u $dname 122 } if ($group(#mjunbanhalt) == on) { did -c $dname 123 } if ($group(#mjunbanhalt) == off) { did -u $dname 123 } if ($group(#mjkickhalt) == on) { did -c $dname 124 } if ($group(#mjkickhalt) == off) { did -u $dname 124 } if ($group(#flophalt) == on) { did -c $dname 126 } if ($group(#flophalt) == off) { did -u $dname 126 } if ($group(#fldeophalt) == on) { did -c $dname 127 } if ($group(#fldeophalt) == off) { did -u $dname 127 } if ($group(#fljoinhalt) == on) { did -c $dname 128 } if ($group(#fljoinhalt) == off) { did -u $dname 128 } if ($group(#flparthalt) == on) { did -c $dname 129 } if ($group(#flparthalt) == off) { did -u $dname 129 } if ($group(#flbanhalt) == on) { did -c $dname 130 } if ($group(#flbanhalt) == off) { did -u $dname 130 } if ($group(#flunbanhalt) == on) { did -c $dname 131 } if ($group(#flunbanhalt) == off) { did -u $dname 131 } if ($group(#flkickhalt) == on) { did -c $dname 132 } if ($group(#flkickhalt) == off) { did -u $dname 132 } } if ($devent == sclick) { if ($did == 25) { if ($did(25).state == 0) { enable #mjdialog } if ($did(25).state == 1) { did -c $dname 25 | enable #mjdialog | .auser MJbot bot-bircX-03 } } if ($did == 27) { if ($did(27).state == 0) { disable #mjdialog } if ($did(27).state == 1) { did -c $dname 27 | disable #mjdialog | .flush MJbot } } if ($did == 51) { if ($did(51).state == 0) { enable #flooddialog } if ($did(51).state == 1) { did -c $dname 51 | enable #flooddialog } } if ($did == 53) { if ($did(53).state == 0) { disable #flooddialog } if ($did(53).state == 1) { did -c $dname 53 | disable #flooddialog } } if ($did == 33) { set %MJsocknick $did(30) set %MJpassnick $did(32) } if ($did == 40) { set %MJserver $did(37) set %MJport $did(38) } if ($did == 43) { set %MJchan $did(42) } if ($did == 48) { did -r $dname 30,32 did -r $dname 37,38 did -r $dname 42 did -b $dname 33,40,43 disable #MJdialog did -c $dname 27 did -u $dname 25 flush MJbot unset %MJsocknick %MJpassnick unset %MJserver %MJport %MJchan } if ($did == 45) { .sockopen MJ_* %MJserver %MJport | .notify %MJsocknick } if ($did == 46) { .sockwrite -n MJ_* quit | .sockclose MJ_* | .notify %MJsocknick } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] if ($did == 59) { set %FLsocknick $did(56) set %FLpassnick $did(58) } if ($did == 66) { set %FLserver $did(63) set %FLport $did(64) } if ($did == 69) { set %FLchan $did(68) } if ($did == 74) { did -r $dname 56,58 did -r $dname 63,64 did -r $dname 68 did -b $dname 59,66,69 disable #flooddialog did -c $dname 53 did -u $dname 51 unset %FLsocknick %FLpassnick unset %FLserver %FLport %FLchan } if ($did == 71) { .sockopen FL_* %FLserver %FLport | .notify %FLsocknick } if ($did == 72) { sockwrite -n FL_* quit | .sockclose FL_* | .notify %FLsocknick } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] if ($did == 83) { set %MJisnum 467-487 set %MJafter 497 did -b $dname 83 did -e $dname 89 } if ($did == 89) { set %MJisnum $did(86) set %MJafter $did(88) did -b $dname 89 did -e $dname 83 } if ($did == 91) { set %FLisnum 367-387 set %FLafter 397 did -b $dname 91 did -e $dname 97 } if ($did == 97) { set %FLisnum $did(94) set %FLafter $did(96) did -b $dname 97 did -e $dname 91 } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] if ($did == 104) { did -b $dname 104 | set %MJlogo `` 14D15ûä14£ M15ød14è Mä15ssjø14íñ :: 14«15®14¤14,1Šþì®15á£14Kï15nè14†íçŠ15™14¤15®14» } if ($did == 105) { set %MJlogoview `` 14D15ûä14£ M15ød14è Mä15ssjø14íñ :: 14«15®14¤14,1Šþì®15á£14Kï15nè14†íçŠ15™14¤15®14» echo -at echo -at NickClone was kicked by You ( $+ %MJlogoview $+ ) echo -at unset %MJlogoview } if ($did == 107) { set %logoview $did(106) echo -at echo -at NickClone was kicked by You ( $+ %logoview $+ ) echo -at unset %logoview } if ($did == 108) { did -b $dname 108 | set %MJlogo $did(106) } if ($did == 109) { did -r $dname 106 } if ($did == 111) { set %FLlogo `` 14D15ûä14£ M15ød14è F15£øø14d :: 14«15®14¤14,1Šþì®15á£14Kï15nè14†íçŠ15™14¤15®14» } if ($did == 112) { set %FLlogoview `` 14D15ûä14£ M15ød14è F15£øø14d :: 14«15®14¤14,1Šþì®15á£14Kï15nè14†íçŠ15™14¤15®14» echo -at echo -at NickClone was kicked by You (» Swearing » %FLlogoview $+ ) echo -at unset %FLlogoview } if ($did == 114) { set %logoview $did(113) echo -at echo -at NickClone was kicked by You (» Swearing » %logoview $+ ) echo -at unset %logoview } if ($did == 115) { did -b $dname 115 | set %FLlogo $did(113) } if ($did == 116) { did -r $dname 113 } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] if ($did == 118) { if ($did(118).state == 0) { disable #mjophalt } if ($did(118).state == 1) { enable #mjophalt } } if ($did == 119) { if ($did(119).state == 0) { disable #mjdeophalt } if ($did(119).state == 1) { enable #mjdeophalt } } if ($did == 120) { if ($did(120).state == 0) { disable #mjjoinhalt } if ($did(120).state == 1) { enable #mjjoinhalt } } if ($did == 121) { if ($did(121).state == 0) { disable #mjparthalt } if ($did(121).state == 1) { enable #mjparthalt } } if ($did == 122) { if ($did(122).state == 0) { disable #mjbanhalt } if ($did(122).state == 1) { enable #mjbanhalt } } if ($did == 123) { if ($did(123).state == 0) { disable #mjunbanhalt } if ($did(123).state == 1) { enable #mjunbanhalt } } if ($did == 124) { if ($did(124).state == 0) { disable #mjkickhalt } if ($did(124).state == 1) { enable #mjkickhalt } } if ($did == 126) { if ($did(126).state == 0) { disable #flophalt } if ($did(126).state == 1) { enable #flophalt } } if ($did == 127) { if ($did(127).state == 0) { disable #fldeophalt } if ($did(127).state == 1) { enable #fldeophalt } } if ($did == 128) { if ($did(128).state == 0) { disable #fljoinhalt } if ($did(128).state == 1) { enable #fljoinhalt } } if ($did == 129) { if ($did(129).state == 0) { disable #flparthalt } if ($did(129).state == 1) { enable #flparthalt } } if ($did == 130) { if ($did(130).state == 0) { disable #flbanhalt } if ($did(130).state == 1) { enable #flbanhalt } } if ($did == 131) { if ($did(131).state == 0) { disable #flunbanhalt } if ($did(131).state == 1) { enable #flunbanhalt } } if ($did == 132) { if ($did(132).state == 0) { disable #flkickhalt } if ($did(132).state == 1) { enable #flkickhalt } } } if ($devent == dclick) { if ($did == 22) { /run https://www.facebook.com/spiralkineticsproductions } } } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] on *:SOCKCLOSE:MJ_*: { sockclose MJ_* | timersock 1 2 .sockopen MJ_* %MJserver %MJport } on *:SOCKOPEN:MJ_*: { if ($sockerr != 0) { halt } if ($sockerr > 0) return sockwrite -nt MJ_* connect $+ %MJserver $+ : $+ %MJport $+ / HTTP/1.0 $+ $crlf $+ $crlf sockwrite -n MJ_* pong $gettok( $+ %MJserver $+ : $+ %MJport $+ ,1,58) sockwrite -n MJ_* USER Dual.Mode * * : sock` «®¤Šþì®á£Kïnè†í犙¤®» sockwrite -nt MJ_* nick %MJsocknick sockwrite -nt MJ_* nickserv identify %MJpassnick sockwrite -nt MJ_* join %MJchan sockwrite -nt MJ_* privmsg %MJchan !protect %MJsocknick sockwrite -nt MJ_* privmsg MassJoinServ op %MJchan 123456 sockwrite -nt MJ_* PING $ticks } on *:SOCKREAD:MJ_*: { sockread %tempMJ if ($mid(%tempMJ,1,4) == PING) { sockwrite -nt MJ_* PONG $remove($remove(%tempMJ,ping :),ping) | halt } if ($gettok(%tempMJ,2,32) == 386) { .sockwrite -nt MJ_* join %MJchan } } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] on *:SOCKCLOSE:FL_*: { sockclose FL_* | timersock 1 2 .sockopen FL_* %FLserver %FLport } on *:SOCKOPEN:FL_*: { if ($sockerr != 0) { halt } if ($sockerr > 0) return sockwrite -nt FL_* connect $+ %FLserver $+ : $+ %FLport $+ / HTTP/1.0 $+ $crlf $+ $crlf sockwrite -n FL_* pong $gettok( $+ %FLserver $+ : $+ %FLport $+ ,1,58) sockwrite -n FL_* USER Dual.Mode * * : sock` «®¤Šþì®á£Kïnè†í犙¤®» sockwrite -nt FL_* nick %FLsocknick sockwrite -nt FL_* nickserv identify %FLpassnick sockwrite -nt FL_* join %FLchan sockwrite -nt FL_* privmsg birc op %FLchan 123456 sockwrite -nt FL_* PING $ticks } on *:SOCKREAD:FL_*: { sockread %tempFL if ($mid(%tempFL,1,4) == PING) { sockwrite -nt FL_* PONG $remove($remove(%tempFL,ping :),ping) | halt } if ($gettok(%tempFL,2,32) == 386) { .sockwrite -nt FL_* join %FLchan } } ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] #mjophalt on on ^*:op:%MJchan: halt #mjophalt end #mjdeophalt on on ^*:deop:%MJchan: halt #mjdeophalt end #mjjoinhalt on on ^*:join:%MJchan: halt #mjjoinhalt end #mjparthalt on on ^*:part:%MJchan: halt #mjparthalt end #mjbanhalt on on ^*:ban:%MJchan: halt #mjbanhalt end #mjunbanhalt on on ^*:unban:%MJchan: halt #mjunbanhalt end #mjkickhalt on on ^*:kick:%MJchan: halt #mjkickhalt end #flophalt on on ^1:op:%FLchan:$iif($nick != $me,haltdef) #flophalt end #fldeophalt on on ^*:deop:%FLchan: halt #fldeophalt end #fljoinhalt on on ^*:join:%FLchan: halt #fljoinhalt end #flparthalt on on ^*:part:%FLchan: halt #flparthalt end #flbanhalt on on ^*:ban:%FLchan: halt #flbanhalt end #flunbanhalt on on ^*:unban:%FLchan: halt #flunbanhalt end #flkickhalt on on ^1:kick:%FLchan:$iif($nick != $me,haltdef) #flkickhalt end ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] #mjdialog off ON *:JOIN:%MJchan: { .updatenl if ($nick == %MJsocknick) || ($nick !isreg $chan) || ($nick isop $chan) || ($nick isin %protect) { halt } .MJspiral } alias -l MJSpiral { .inc -u5 %MJclone.join .set %MJnick $nick | .set %MJchan $chan | .write cloneMJ.txt %MJnick if (%MJclone.join isnum %MJisnum) { .sockwrite -nt MJ_* kick %MJchan %MJnick 9Direct %MJlogo | .return } if (%MJclone.join > %MJafter) { .timerGoTo 1 2 MJKinetics } .halt .return } alias -l MJKinetics { .set %MJnick $read(cloneMJ.txt) if (%MJnick != $null) { if (%MJnick ison %MJchan) { sockwrite -nt MJ_* kick %MJchan %MJnick 8Delay %MJlogo } .timerloopst 1 1 MJKinetics } if (%MJnick !ison %MJchan) { .write -ds %MJnick cloneMJ.txt .timerloopnd 1 0 MJKinetics } } ON ^1:OP:%MJchan: { if ($opnick == %MJsocknick) { .timerloopth 1 0 MJKinetics } else { return } } on ^!*:kick:%MJchan: { if ($knick == %MJsocknick) { //sockwrite -nt MJ_* join %MJchan //sockwrite -nt MJ_* privmsg MassJoinServ op %MJchan 123456 } } on +MJbot:text:*:%MJchan: { if (Jumlah klon yang telah ditendang keluar pada pusingan kali ini ialah isin $strip($1-)) { .write -c cloneMJ.txt } } ON *:TEXT:*:%MJchan:{ if (!Protect == $1) && ($2) { .set %protect $addtok(%protect,$2,300) | echo -at ***4,0 #BIRC Add $2 in Protect list. } } ON !*:DEOP:%MJchan: { if ($opnick == %MJsocknick) && (!%deopMJ) { write -c cloneMJ.txt | timerDeopSock 1 5 sockwrite -nt MJ_* privmsg MassJoinServ op %MJchan 123456 | set -u2 %deopMJ 1 } } #mjdialog end ;[sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk][sk] #flooddialog off on ^!*:text:*:%FLchan: if ($nick isreg #) { haltdef | SK.engine $1- } on ^!*:notice:*:%FLchan: if ($nick isreg #) { haltdef | SK.engine $1- } on ^!*:action:*:%FLchan: if ($nick isreg #) { haltdef | SK.engine $1- } ctcp *:*:%FLchan: { if ((%FLsocknick isop #) && ($nick isreg #)) { $FLSpiral(pinG) } } on *:ctcpreply:*: { if ((%FLsocknick isop #) && ($nick isreg #)) { $FLSpiral(pinG) } } alias -l SK.engine { if ($nick !isreg $chan) || ($nick == %FLsocknick) { goto end } if ($regex($1-,/[[:cntrl:]]/g) >= 50) { .FLSpiral cOrL | halt } if ($regex($1-,/[[:upper:]]/g) >= 50) { .FLSpiral sHit | halt } if ($regex($strip($1-),/[[:digit:]]/g) >= 50) { .FLSpiral diGi | halt } if ($regex($strip($1-),/[[:punct:]]/g) >= 50) { .FLSpiral sMbL | halt } if ($regex($strip($1-),/[ $chr(160) ]/g) >= 50) { .FLSpiral bLnK | halt } if ($regex($1-,/[ $chr(174) ]/g) >= 50) { .FLSpiral aSCi | halt } if ($regex($strip($1-),/[[:lower:]]/g) >= 200) { .FLSpiral lOnG | halt } if ($regex($remove($1-,$chr(40),$chr(41)),/(http|tp:|#)/g)) { .FLSpiral sPaM | halt } if ($regex($strip($1-),/(shit|babi|dick|puki|fuck)/g)) { .FLSpiral sWeR | halt } .hinc -u15m repeat [ $+ [ $chan ] $+ [ $nick ] ] $hash($remove($strip($1-),$chr(160),$chr(32)),32) 1 | if ($hget(repeat [ $+ [ $chan ] $+ [ $nick ] ],$hash($remove($strip($1-),$chr(160),$chr(32)),32)) > 2) { .FLSpiral rEpT } .hinc -u15m special [ $+ [ # ] $+ [ $nick ] ] $hash($remove($strip($1-),$chr(160),$chr(32)),32) 1 | if ($hget(special [ $+ [ # ] $+ [ $nick ] ],$hash($remove($strip($1-),$chr(160),$chr(32)),32)) >= 4) { .FLSpiral sCPc } .hinc -u10m newline [ $+ [ # ] ] $address($nick,3) 1 | if ($hget(newline [ $+ [ # ] ],$address($nick,3)) >= 5) { .FLSpiral rOW } else { return } } alias -l FLSpiral { .inc -mu9m %FLclone.join | .set %FLnick $nick | .write cloneFL.txt %FLnick | .set %reason $1- if (%FLclone.join isnum %FLisnum) { .sockwrite -nt FL_* kick %FLchan %FLnick » %reason » 9Direct %FLlogo | .return } if (%FLclone.join > %FLafter) { .timerGoTost 1 2 FLKinetics } .halt .return } alias -l FLKinetics { .set %FLnick $read(cloneFL.txt) if (%FLnick != $null) { if (%FLnick ison %FLchan) { sockwrite -nt FL_* kick %FLchan %FLnick » %reason » 8Delay %FLlogo } .timerloop1st 1 1 FLKinetics } if (%FLnick !ison %FLchan) { .write -ds %FLnick cloneFL.txt .timerloop2nd 1 0 FLKinetics } } ON ^1:OP:%FLchan: { if ($opnick == %FLsocknick) { .timerloop3th 1 0 FLKinetics } else { return } } ON ^1:KICK:%FLchan:{ if ($nick == %FLsocknick) { $SpiralkineticsBan($knick,%FLchan) } } alias -l SpiralkineticsBan { .hadd -u3m sk $1 $+ !*@*Dual.Mode* .timerfA -os 1 26 clear %FLchan .timerfB -os 1 29 sockwrite -nt FL_* mode $2 $+(+,$str(b,1)) $hget(sk,1).item .timerfC -os 1 30 write -c cloneFL.txt .halt } ON !*:DEOP:%MJchan: { if ($opnick == %FLsocknick) && (!%deopFL) { write -c cloneFL.txt | timerDeopSo
  5. This is the third iteration of the server manager. Made improvements large enough that I thought it was okay to resubmit as a new snippet. By right clicking on a Status, Query or Channel, you'll have the option of popping up the dialog for the script. http://www.hawkee.com/pictures/m_60273_DcLdbzzMvsbH8nYs8XcRNrR1V.png Functionality: Can add as many servers to the autojoin list as you like, with the ability to enable/disable autojoining them via the manager. If you wish to connect with a different port, add a colon and the port after entering the server. e.g. "irc.gamesurge.net:6667" Can add as many channels for each server as you like. If you wish to join a channel with a password, simply type the password after the channel. e.g. "#channel password" Can add as many nicks as you like for each server, all of which share a group nickserv password - If a nick is already in use when you connect a server, you connect as the first available one in the list - and automatically idents Persistant ordering of servers, nicks and channels - if you delete anything from any list, the remaining items in the list are still ordered the way you left them (I like having servers and channels in a particular order) All settings are saved in an ini file in your mirc settings directory Improvements from v2: Improved GUI Can handle more than 5 servers Can handle more than 2 nicknames per server (useful if you're running bots) Removed useless functionality (I realised I didn't find it very useful, anyway) Improved code PS: I am the same user that submitted v2.1, just wanted to use a newer alias 😉 PSS: I know there's a particular big with choosing the 'next free nick' if your nick is taken, i'll edit the snippet once I work out how 😛 Still works, just not the way I intended. ;Shows a link to the script when you right click a status, query or channel window menu status,query,channel { Auto Connect/Join/Identify v3:/showacji } ;Calls the dialog window initialisation and loads the first server alias showacji dialog -m acji acji ;Initialises the dialog window dialog acji { title "Auto Connect/Join/Identify v3" size -1 -1 355 425 ; type | text | id | x y w h | style text "Change settings for:", 1, 5 8 100 20 combo 2, 110 5 240 20, drop text "Servers address", 3, 15 30 160 12 edit "", 4, 15 45 132 20, autohs text "Server network", 5, 153 30 160 12 edit "", 6, 153 45 132 20, autohs check "Enabled", 29, 290 40 55 20 text "Add nickname", 7, 22 85 70 20 edit "", 8, 20 99 72 21, autohs text "Group password", 9, 99 85 78 20 edit "", 10, 99 99 76 21, autohs pass button "Add nickname", 11, 20 125 155 25 text "View/delete existing nicknames", 12, 182 85 150 20 combo 13, 180 99 155 20, drop button "Delete nickname", 14, 180 125 155 25 text "Add channel to this server", 15, 22 180 140 20 edit "", 16, 20 194 155 21, autohs button "Add channel", 17, 20 220 155 25 text "View/delete existing channels", 18, 182 180 150 20 combo 19, 180 194 155 20, drop button "Delete channel", 20, 180 220 155 25 button "Add/Save server", 21, 20 275 100 25 button "Delete server", 22, 125 275 100 25 button "Close manager", 23, 230 275 100 25, cancel box "", 24, 5 22 345 245 box "Grouped nicknames", 25, 15 70 325 90 box "Channels", 26, 15 165 325 90 box "Hover over buttons/boxes for help.", 27, 5 305 345 110 text "", 28, 10 318 325 92, multi ; type | text | id | x y w h | style } ;On initialisation, display default help text and load first tab on 1:dialog:acji:init:*: acji.loadgui $iif($gettok($rs(0, Order), 1, 46) != $null, $ifmatch, 1) ;loads the gui with the information for the requested server (called with $1 being server number in acjiSettings.ini) alias -l acji.loadgui { acji.resetgui set %n 1 while (%n <= $rs(0,Servers)) { did -a acji 2 $+(%n, :) $rs($gettok($rs(0, Order), %n, 46), Server) inc %n } did -a acji 2 Add a new server did -c acji 2 $iif($findtok($rs(0, Order), $1, 46) != $null, $ifmatch, $did(2).lines) ;If no servers are set up, or if "Add a new server" is selected, disable some entry fields and rename buttons. if $did(2).sel == $did(2).lines { did -b acji 8,10,11,13,14,16,17,19,20,22,29 did -ra acji 21 Add Server } ;Enable them otherwise else { did -e acji 8,10,11,13,14,16,17,19,20,22,29 did -ra acji 21 Save Server } did -a acji 4 $rs($1, Server) did -a acji 6 $rs($1, Network) did $iif($rs($1, Enabled) == 1, -c, -u) acji 29 set %n 1 while (%n <= $rs($1,Nicks)) { did -a acji 13 $rs($1, Nick $+ %n) inc %n } did -a acji 10 $rs($1, Password) set %n 1 while (%n <= $rs($1,Channels)) { did -a acji 19 $rs($1, Channel $+ %n) inc %n } unset %n } alias -l acji.resetgui { did -r acji 2,4,6,8,10,13,16,19 did -u acji 29 } ;Listens for clicks on the gui on 1:dialog:acji:sclick:*: { if ($did(2).sel != $did(2).lines) { set %sID $gettok($rs(0, Order), $did(2).sel, 46) } else set %sID $did(2).lines ;If combo box changed, update gui with details of the correct server if ($did == 2) { acji.loadgui %sID } ;If the save button is clicked, save all information into the acjiSettings.ini file if ($did == 21) { ;If the last line of combo box is selected, add a new server if ($did(2).sel == $did(2).lines) { set %servers $calc($rs(0,Servers) + 1) $wsdata(0, Servers, %servers) ;Determine next free token, then save the settings into the correct server position set %n 1 while (%n <= %servers) { if (!$istok($rs(0,Order,46), %n, 46)) { $wsdata(0, Order, $addtok($rs(0,Order,46), %n, 46))) } inc %n } unset %n $ws(%sID, Server, 4) $ws(%sID, Network, 6) } if ($did(10).text != $null) { $ws(%sID, Password, 10) } else { $rms(%sID, Password) } $wsdata(%sID, Enabled, $did(29).state) acji.loadgui %sID } ;If the add nick button is pressed, add a nick to the current server (and save password if entered) if ($did == 11) { if ($did($dname, 8).text != $null) { $wsdata(%sID, Nicks, $calc($rs(%sID, Nicks) + 1)) $ws(%sID, Nick $+ $rs(%sID, Nicks), 8) did -r acji 8 if ($did(10).text != $null) { $ws(%sID, Password, 10) } else { $rms(%sID, Password) } acji.loadgui %sID } } ;If the add channel button is pressed, add a channel to the current server if ($did == 17) { if ($did($dname, 16).text != $null) { $wsdata(%sID, Channels, $calc($rs(%sID, Channels) + 1)) $ws(%sID, Channel $+ $rs(%sID, Channels), 16) did -r acji 16 acji.loadgui %sID } } ;If the delete nickname button is pressed, delete the current nickname and move all those after it up a spot if ($did == 14) { if ($did(13).sel != $null) { set %nicks $rs(%sID, Nicks) set %n $did(13).sel $rms(%sID, Nick $+ %n) dec %nicks set %s %n while (%n <= %nicks) { inc %s $wsdata(%sID, Nick $+ %n, $rs(%sID, Nick $+ %s)) inc %n } $rms(%sID, Nick $+ %n) $wsdata(%sID, Nicks, %nicks) unset %s | unset %n | unset %nicks } acji.loadgui %sID } ;If the delete channel button is pressed, delete the current channel and move all those after it up a spot if ($did == 20) { if ($did(19).sel != $null) { set %channels $rs(%sID, Channels) set %n $did(19).sel $rms(%sID, Channel $+ %n) dec %channels set %s %n while (%n <= %channels) { inc %s $wsdata(%sID, Channel $+ %n, $rs(%sID, Channel $+ %s)) inc %n } $rms(%sID, Channel $+ %n) $wsdata(%sID, Channels, %channels) unset %s | unset %n | unset %channels } acji.loadgui %sID } ;If the delete server button is pressed, delete the current server's token from the "Order" field if ($did == 22) { ;Remove the entire section $rms(%sID,) ;Remove the servers token from the Order field $iif($deltok($rs(0, Order), $did(2).sel, 46) != $null, $wsdata(0, Order, $ifmatch), $rms(0,Order)) $wsdata(0, Servers, $calc($rs(0, Servers) - 1)) acji.loadgui $gettok($rs(0, Order), 1, 46) } unset %sID } ;When mIRC starts, connect to each of the servers in the Settings.ini file with the primary nick supplied, if there is one. on *:Start: { set %n 1 while (%n <= $rs(0, Servers)) { if ($rs($gettok($rs(0, Order),%n,46), Enabled) == 1) { server $iif(%n == 1,,-m) $rs($gettok($rs(0, Order),%n,46), Server) -i $rs(%n, Nick1),) inc %n } else inc %n } unset %n } ;When you connect to a server, check that it's one in the Settings.ini file and then connect to the supplied channels on *:Connect: { set %n 1 while (%n <= $rs(0, Servers)) { if ($rs(%n, Network) == $network) { set %c 1 while (%c <= $rs(%n, Channels)) { join $rs(%n, Channel $+ %c) inc %c } unset %c if ($rs(%n, Password) != $null) nickserv identify $rs(%n, Password) } inc %n } unset %n } ;When nickserv asks to identify, do so with the supplied password from the acjiSettings.ini file on *:notice:*nickname is regsitered and protected*:?: { if ($nick == nickserv) { set %n 1 while (%n <= $rs(0, Servers)) { if ($rs(%n, Network) == $network) { nickserv identify $rs(%n, Password) } inc %n } unset %n } } ;If the nickname is currently being used, attempt to connect with the first free nickname saved for the server ;-- $2 is the current nickname, find it in tokens and try the next one. raw 433:*:{ set %n 1 while (%n <= $rs(0, Servers)) { if ($rs(%n, Server) == $server) { set %c 1 while (%c <= $rs(%n, Nicks)) { $iif($rs(%n, Nick $+ %c) != $2, nick $ifmatch,) inc %c } } inc %n } unset %c unset %n } ;When hovering over any of the edit boxes or buttons, the help label will display help information for that element on 1:dialog:acji:mouse:*: { if ($did == 2) { did -ra $dname 28 Select the server you wish to change details for. If empty, proceed to add a server by filling out the form below. } elseif ($did == 4) { did -ra $dname 28 Enter the server address here. e.g. irc.gamesurge.net If you wish to connect to a server with a non-default port, simply add a colon and a port number after the server. e.g. irc.gamesurge.net:6667 } elseif ($did == 6) { did -ra $dname 28 Enter the servers network here. $crlf $+ Find this out by typing '//echo -a $+($,network') whilst connected the the server. e.g. GameSurge } elseif ($did == 8) || ($did == 11) { did -ra $dname 28 Enter a nickname and then click the Add button to add that nickname to this servers autoidentify list. } elseif ($did == 10) { did -ra $dname 28 Enter the password to the group of nicknames set for this server. You Will automatically identify when nickserv asks for the password. } elseif ($did == 13) || ($did == 14) { did -ra $dname 28 Use the dropdown menu to view the nicknames set to automatically attempt to connect with. If you wish to delete one, pick it from the list then click the Delete button. } elseif ($did == 16) || ($did == 17) { did -ra $dname 28 Enter a channel name and then click the Add button to add that channel to this servers autojoin list. If the channel has a password, enter it after the channel. $crlf e.g. #channel password } elseif ($did == 19) || ($did == 20) { did -ra $dname 28 Use the dropdown menu to view the channels set to automatically join when this server starts. If you wish to delete one, pick it from the list then click the Delete button. } elseif ($did == 21) { did -ra $dname 28 By clicking this button all the info in the edit boxes will be saved for this server. } elseif ($did == 22) { did -ra $dname 28 By clicking this button all changes will be lost. Be sure to click the Set button is you want to save this configuration. } } ;called by $rs(server number, item) - if server number is 0, then general settings are stored. alias -l rs return $readini(acjiSettings.ini, Server $+ $1, $2) ;called by $wsdata(server number, data name, data) alias -l wsdata writeini acjiSettings.ini Server $+ $1 $2 $3 ;called by $ws(server number, data name, dialog item id to read from) alias -l ws writeini acjiSettings.ini Server $+ $1 $2 $did($3).text ;called by $rms(server number, item) alias -l rms remini acjiSettings.ini Server $+ $1 $2
  6. chain

    IRC Pre Bot v2.1

    his script accesses www.orlydb.com and pulls the newest Scene Releases and posts them on the channel. Added Search function: !pre Release Name Added where you can omit languages that you do not want to show. Added option to turn the Pre announce on or off through the party line ".pre" in the party line will toggle settings Fixed issue with program crashing after a few hours of running. Fixed issue with search not working ## Displys Scene Releases that have been Pred on the website www.orlydb.com ## namespace eval pre { variable language "FRENCH|GERMAN|SWEDISH|DANSIH|DUTCH|FINNISH|NORWEGIAN|SPANiSH" #"APPS 0DAY MOBILE ANiME AUDiOBOOKS COVERS DOX EBOOKS IMAGESET SAMPLES UNKNOWN MP3 MVIDS MDVDR TV TV-BLURAY TV-DVDR TV-DVDRiP TV-HR TV-x264 TV-XViD VCD BLURAY x264 XViD SVCD TRAILERS SUBPACK DiVX DVDR Wii XBOX XBOX360 GAMEBOY GAMECUBE GAMES DREAMCAST NDS PS1 PS2 PS3 PSP PSX PSXPSP XXX XXX-IMGSET" variable types "APPS 0DAY MOBILE MP3 TV-DVDR TV-DVDRiP TV-HR TV-x264 TV-XViD x264 XViD XXX XXX-IMGSET" #Set to channel to show Pre information variable chan "#Chan" #Change preNum to how many Search Results you want shown variable Num 5 } set PreNew "" #Change to (on/off) to turn on pre bot set status "on" bind pub - !pre presearch bind dcc - pre pre:change proc pre {} { global PreNew status if {$status == "on"} { set PreOld $PreNew set url "http://www.orlydb.com" set page [web2data $url] if {$page!=0} { regexp {"timestamp">(.*?)<\/span>} $page a stamp regexp {"section"><a.*?>(.*?)<\/a>} $page a section regexp {"release">(.*?)<\/span>} $page a release if {[info exists release]} { set PreNew "$stamp $section $release" if {![regexp -nocase $pre::language $release] && [regexp -nocase $section $pre::types] && $PreNew != $PreOld} { putquick "PRIVMSG $pre::chan :\00308(\00315PRE\00308)\00315 $stamp \00308(\00315$section\00308)\00315 $release" } } } } utimer 2 pre } proc pre:change {hand idx arg} { global status if {$status == "on"} { set status "off" } else { set status "on" } putdcc $idx "Pre status changed to: $status" } proc presearch { nick host hand chan arg } { set arg [string map { " " "+" } $arg] set url "http://www.orlydb.com/?q=$arg" set page [web2data $url] set temp 1 while {$temp <= $pre::Num && [regexp {<div>(.*?)<\/div>} $page a result]} { if {[info exists result]} { regexp {"timestamp">(.*?)<\/span>} $result a stamp regexp {"section"><a.*?>(.*?)<\/a>} $result a section regexp {"release">(.*?)<\/span>} $result a release regsub {<div>(.*?)<\/div>} $page "" page if {![regexp -nocase $pre::language $release]} { if {[info exists release]} { incr temp putquick "PRIVMSG $chan :\00304(\00315PRE\00304)\00315 $stamp \00304(\00315$section\00304)\00315 $release" unset stamp section release } } } } if {$temp==0} { putquick "PRIVMSG $chan :\00304(\00315PRE\00304)\00315 Nothing Found" } } proc web2data { website } { package require http if { [catch { set token [http::geturl $website -timeout 100000]} error] } { return 0 } elseif { [http::ncode $token] == "404" } { return 0 } elseif { [http::status $token] == "ok" } { set data [http::data $token] } elseif { [http::status $token] == "timeout" } { return 0 } elseif { [http::status $token] == "error" } { return 0 } http::cleanup $token if { [info exists data] } { return $data } else { return 0 } } utimer 2 pre putlog "\00308(\00315PRE\00308)"
  7. chain

    Dialog HangMan

    I saw RagBot's Pcwin Hangman and I decided it would be a decent challenge to make a Hangman game in a dialog. It was actually a little harder than I thought it would be. Easy to use: Just load into remotes, Right click channel or status and select HangMan. This will start a new game with the category stars. To select a letter, just click the letter at the top. If you fill in all the blanks before you click 6 wrong letters, you win. If you click 6 wrong letters you lose. To start a new game in the current category, click Play. To start a new game with a new category, just change the category with the drop-down to the left. ;Dialog HangMan by Ford_Lawnmower irc.mindforge.org #USA-Chat menu Channel,Status { HangMan .Play: dialog $iif($dialog(HangMan),-v,-md) HangMan HangMan .Reset: { if ($dialog(HangMan)) { dialog -x HangMan } var %count 0 while (%count <= 6) { if ($isfile($+(HangMan\,%count,.gif))) { .remove $+(HangMan\,%count,.gif) } inc %count } dialog -md HangMan HangMan } } alias -l HangMan { if ($sock(HangMan)) { sockclose HangMan } sockopen HangMan $+($1,.hangmania.com) 80 sockmark HangMan $+($1,.hangmania.com) } On *:sockopen:HangMan: { if (!$sockerr) { sockwrite -nt $sockname GET / HTTP/1.0 sockwrite -n $sockname Host: $sock($sockname).mark sockwrite -n $sockname $crlf } else { echo -st Socket Error $nopath($script) | sockclose $sockname | return } } On *:sockread:HangMan: { if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return } else { var %HangMan | sockread %HangMan if ($regex(%HangMan,/new Array\((.*)\)\;/i)) { set %HangMan.Key $replace($remove($regml(1),$chr(39)),$chr(32),$chr(1),$chr(44),$chr(32)) set %HangMan.Word $regsubex(%HangMan.Key,/\w/g,_) set %HangMan.Count 0 if ($dialog(HangMan)) { did -e hangman 1-26 did -a HangMan 29 %HangMan.Word if ($isfile(Hangman\0.gif)) { did -g Hangman 30 Hangman\0.gif } else { .timer 1 3 did -g Hangman 30 Hangman\0.gif } } sockclose $sockname return } } } alias -l repchar { return $+($left($3-,$calc($1 - 1)),$2,$mid($3-,$+($calc($1 + 1),-))) } alias -l CheckStrings { var %string1 $1, %string2 $2, %length $len($1) while (%length) { if ($mid($1,%length,1) == $3) { %string2 = $repchar(%length,$v1,%string2) } dec %length } if ($2 != %string2) { return %string2 } } alias -l GetIcons { var %count 0 while (%count <= 6) { .timer 1 $calc(%count * 2) gethangpict www.justhangman.com $+(/images/hangman_,%count,.gif) Hangman $+(%count,.gif) inc %count } } alias -l GetHangPict { if (!$isfile($qt($+($3,\,$4)))) { var %sockname $+(GetHangPict,$ticks,$r(1,$ticks)) if (!$isdir($qt($3))) { mkdir $qt($3) } sockopen %sockname $1 80 sockmark %sockname $1- } } On *:sockopen:GetHangPict*:{ sockwrite -nt $sockname GET $gettok($sock($sockname).mark,2,32) HTTP/1.0 sockwrite -n $sockname Host: $gettok($sock($sockname).mark,1,32) $+ $crlf $+ $crlf } On *:sockread:GetHangPict*:{ if (!$gettok($sock($sockname).mark,5,32)) { var %GetPict | sockread %GetPict if (!%GetPict) { sockmark $sockname $addtok($sock($sockname).mark,1,32) } } else { sockread &GetPict bwrite -s $qt($+($gettok($sock($sockname).mark,3,32),\,$gettok($sock($sockname).mark,4,32))) -1 -1 &GetPict } } dialog HangMan { title "HangMan" size -1 -1 199 244 option dbu button "A", 1, 24 8 8 10 button "B", 2, 36 8 8 10 button "C", 3, 48 8 8 10 button "D", 4, 60 8 8 10 button "E", 5, 72 8 8 10 button "F", 6, 84 8 8 10 button "G", 7, 96 8 8 10 button "H", 8, 108 8 8 10 button "I", 9, 120 8 8 10 button "J", 10, 132 8 8 10 button "K", 11, 144 8 8 10 button "L", 12, 156 8 8 10 button "M", 13, 168 8 8 10 button "N", 14, 24 22 8 10 button "O", 15, 36 22 8 10 button "P", 16, 48 22 8 10 button "Q", 17, 60 22 8 10 button "R", 18, 72 22 8 10 button "S", 19, 84 22 8 10 button "T", 20, 96 22 8 10 button "U", 21, 108 22 8 10 button "V", 22, 120 22 8 10 button "W", 23, 132 22 8 10 button "X", 24, 144 22 8 10 button "Y", 25, 156 22 8 10 button "Z", 26, 168 22 8 10 combo 27, 5 48 60 12, drop text "Category:", 28, 5 40 58 8 text "", 29, 73 46 119 24 icon 30, 6 71 186 153 button "Play", 31, 98 230 37 12 button "Close", 32, 148 230 37 12, Cancel } On *:dialog:HangMan:close:*: { unset %HangMan.* } On *:dialog:HangMan:init:*: { GetIcons didtok $dname 27 32 Stars Movies Games Countries Animals did -c $dname 27 1 HangMan Stars } On *:dialog:HangMan:Sclick:31,27: { HangMan $did($dname,27).seltext } On *:dialog:HangMan:Sclick:1-26: { did -b $dname $did if ($CheckStrings(%HangMan.Key,%HangMan.Word,$did($dname,$did).text)) { set %HangMan.Word $v1 did -a $dname 29 %HangMan.Word if (%HangMan.Word == %HangMan.Key) { did -a $dname 29 %HangMan.Key -- Winner!! did -b $dname 1-26 } } else { if ($calc($gettok($nopath($did($dname,30)),1,46) + 1) <= 6) { did -g $dname 30 $+(HangMan\,$v1,.gif) } if ($v1 == 6) { did -a $dname 29 %HangMan.Key -- You Lost!! did -b $dname 1-26 } } }
  8. ust a quick Halo Reach Career Stats lookup Socket copy/paste into a new remote of ur bot. Trigger is @halor playername Ex: <~napa182> @halor doop <&Sick0> :[Halo Reach Stats For]: doop <&Sick0> Sorry Player Not Found <~napa182> @halor chiefMENDOZA666 <&Sick0> :[Halo Reach Stats For]: chiefMENDOZA666 <&Sick0> :[Rank]: Corporal Grade 1 Next: Sergeant (3193 of 5000) :[Games Played]: 20 :[Playtime]: 0d 3h 8m :[Kills]: 257 :[Deaths]: 259 :[Assists]: 32 :[Kill/Death]: 0.99 :[Kills/Game]: 12.85 :[Deaths/Game]: 12.95 :[Kills/Hour]: 81.96 :[Deaths/Hour]: 82.60 :[Medals]: 324 :[Medals/Game]: 16.20 :[Medals/Hour]: 103.33 <&Sick0> :[Player Stats Link]: www.bungie.net/stats/reach/careerstats/default.aspx?player=chiefMENDOZA666&vc=3 Like always rip strip butcher this snippet how ever you want idc on $*:text:/^@halor\s(.+)/iS:#:{ if (!$($+(%,halo,$wildsite),2)) { inc -u5 $+(%,halo,$wildsite) if ($sock($+(halor,#))) sockclose $+(halor,#) sockopen $+(halor,#) www.bungie.net 80 sockmark $+(halor,#) $+(/stats/reach/careerstats/default.aspx?player=,$& $replace($regml(1),$chr(32),$+(%,20)),&vc=3) msg # msg # 09:[04Halo Reach Stats For09]: $regml(1) } } on *:load: { echo 04 -a You Have Just Loaded Napa182's Halo Reach Career Stats Lookup Socket echo 07 -a An irc.EzzyChat.com Production } on *:sockopen:halor*: { sockwrite -n $sockname GET $gettok($sock($sockname).mark,1,32) HTTP/1.1 sockwrite -n $sockname Host: $+($sock($sockname).addr,$str($crlf,2)) } on *:sockread:halor*: { var %halor | sockread %halor if ($regex(%halor,/<h1.+>(Not Found)<\/.+>/)) { hinc -mu4 $sockname c 1 $gettok($sock($sockname).mark,2-,32) Sorry Player $regml(1) sockclose $sockname } if ($regex(%halor,/<span.+>(.+)<\/span.+>(Next:.+)&nbsp;&nbsp;(.+)<\/span>/)) { hadd -mu4 $sockname 1 09:[04Rank09]: $regml(1) $regml(2) $regml(3) } if ($regex(%halor,/<li class=.+>(\d+)<\/li>/)) { hadd -mu4 $sockname 2 09:[04Games Played09]: $regml(1) } if ($regex(%halor,/<strong>(.+)<\/.+>(.+)<\/span><\/li>/)) { hinc -mu4 $sockname c 1 if ($hget($sockname,c) isnum 1-12) { hadd -mu4 $sockname $calc($hget($sockname,c) +2) $+(09:[04,$regml(1),09]:) $regml(2) } if ($hget($sockname,c) = 12) { $gettok($sock($sockname).mark,2-,32) $regsubex($str(.,$hget($sockname,0).item),/(.)/g,$hget($sockname,\n) $chr(32)) $gettok($sock($sockname).mark,2-,32) 09:[04Player Stats Link09]: $+(www.bungie.net,$gettok($sock($sockname).mark,1,32)) sockclose $sockname } } }
  9. chain

    Blackjack Race

    Blackjack Race is a channel based multiplayer game, supporting up to your standard 7 players. I saw a few versions of Blackjack on this site, but none of them were scripted well, whether it be the style of code, the game pace or the logic within the code to match the game. So here you go 🙂 Features include: Simultaneous games within multiple channels at the same time A "first to" style, meaning rather than betting, you're trying to accumulate a certain amount of coins to win Derived from the real casino game, but adapted to suit IRC A real shoe, with shuffling points when shoe density falls below a threshold Accurate dealer simulation, standing with hard 17 Strategy play options: !hit !stand !double !split !surrender Resplit as many times as you require! 10 seconds are added to the timer for each "layer" of hands all players go through The Edge - An optional lower boundary which kicks players from the game when overstepped AI opponents, with an intelligence range from 1 to 10 Automatic AI participation if only 1 player joins Easily configure options and house rules within the script No messy global variables Possibility to save statistics via external files http://i.imgur.com/a7PDsUB.jpg To start a game, type !blackjack To join a game, type !join To start a game with AI opponents ready to join, type !blackjack N, where N is a number from 1 to 7 To start a game with specific AI opponents, for example Jess and Kyle, type !blackjack Jess Kyle To leave a game type !replace. This will replace you with an AI opponent To view a list of AI opponents and their intelligence level, type !ai To forcefully stop a game, type !blackjack stop OR !stop (Operators only) To abort the games termination, type !abort To view a list of ALL commands, type !commands UPDATE 20/01/17 - Added AI, primarily so you can start a game by yourself UPDATE 21/01/17 - Added !split and !surrender, for completions sake. Integration was a bit rough but i scraped by UPDATE 22/01/17 - Fixed the randomization of cards in the shoe. Added !replace UPDATE 24/01/17 - Fixed small conflicting error, added an easter egg UPDATE 27/02/17 - Added house options, optional lower boundary and N card tricks, fixed dealer logic if all surrender UPDATE 24/07/17 Added stats, which can be turned on and off. Includes top 5 lists and comparison Top 5 lists can be displayed as: !top5 [-a/-u] [cpg / cph / gr / wr / h2h] User stats can be found with: !stat [-a/-u] nickname Comparisons can be done via: !compare [-a/-u] nickname1 [-a/-u] nickname2 !repair can be used by operators to fix the game if it won't start properly or becomes unresponsive !commands is available to view all known commands with possible further detail UPDATE 26/07/17 - Save total coins in external file, assist with external use. See the comments UPDATE 24/09/17 - Added blackjackCoinListener alias to the bottom of the script, used for adding your own functionality each time coins are accumulated ;######################################################## ;######################################################## ; SETTINGS (for YOU.... yes YOU!!!) ;######################################################## ;######################################################## ;# THE DEALER HAS AN EDGE. If you win as much as you lose, all player balances will gradually decrease making the 'finish' impossible to reach. ;# to compensate, you can award points for draws, and reward more money for a win than you take away for a loss. The same applies for doubles. ;# for faster games: 200 40 20 30 0 -10 5 10 -3 ;# more realistic game values: 150 40 20 30 -10 -25 0 0 -5 alias -l finish return 150 alias -l winDouble return 40 alias -l winSingle return 20 alias -l winBlackjack return 30 alias -l loseSingle return -10 alias -l loseDouble return -25 alias -l drawSingle return 0 alias -l drawDouble return 0 alias -l surrender return -5 ;# theEdge - Set to 0 to disable. Kicks players from the game after falling below -N alias -l theEdge return -100 ;# Bonus payouts. N card tricks represent an auto-payout if a player's hand consists of N cards. set to 0 to disable, otherwise set to the amount which should be paid out. alias -l var5CardTrickPayout return 5 alias -l var6CardTrickPayout return 10 alias -l var7CardTrickPayout return 15 alias -l var5Card21Payout return 20 alias -l var6Card21Payout return 40 alias -l var7Card21Payout return 100 ;# House rules. 'decks' can be from 2-8. The other lines respresent rules which can be used in the game. To "activate" a rule, change the 0 to a 1. alias -l decks return 2 alias -l dealerHitsOnSoft17 return 0 alias -l doubleWith3orMoreCards return 0 alias -l noResplitWithAces return 0 alias -l splitAcesOneCardOnly return 0 ;# Colors. 3 are used, each represented below. Use 2 digits, from 00-15 alias -l color1 return 07 alias -l color2 return 03 alias -l color3 return 06 ;# AI opponents. Just seperate the names by spaces, if you want to add more. ;# the intelligence levels correlate to the names, so Jess matches 6 and Kyle matches the last 1. alias -l ai return Jess Trump DeathKnight AIMaster Jerry Lacey Jonorama Degausser NotTheSun Kyle alias -l aiIntel return 6 9 8 10 3 5 4 7 2 1 ;# 'statEnable' signifies whether the statistics will be recorded. 1 represents on, and 0 off ;# 'statDirectory' is your path to stats. there should be no slashes at the beginning or end of the path. use \ if you want to go deeper into folders ;# the other two aliases represent the minimum needed hands/games for a user to be displayed in the top5 lists alias -l statEnable return 1 alias -l statDirectory return stats\blackjack alias -l statMinHands return 10 alias -l statMinGames return 2 ;######################################################## ;######################################################## ; TEXT EVENTS ;######################################################## ;######################################################## on *:TEXT:*:#:{ if ($hget($g($chan,1))) { if ($hget($g($chan,1), $nick)) && ($hget($g($chan,1), $nick) != check) && (!$isAI($chan, $nick)) { if ($timer($+(BlackJack,$chan,DrawTimer))) { if ($1 == !hit) || ($1 == !card) drawCardAction $chan $nick elseif ($1 == !double) drawCardAction $chan $nick -d elseif ($1 == !stand) standAction $chan $nick elseif ($1 == !split) splitAction $chan $nick elseif ($1 == !surrender) surrenderAction $chan $nick } if ($1 == !replace) || ($1 == !drop) replaceAction $chan $nick } elseif ($istok(!join.join,$1,46)) && ($timer($+(BlackJack,$chan,JoinTimer))) addPlayer $chan $nick if ($1-2 == !blackjack stop) || ($1 == !stop) triggerBlackjackStop $chan -m $nick elseif ($1 == !abort) && ($hget($s($chan), stop)) triggerAbort $1- elseif ($1 == !repair) && ($nick isop $chan) triggerRepair $chan } elseif ($1 == !blackjack) triggerBlackjack $1- if ($1 == !stat) triggerStats stat $1- elseif ($1 == !coins) triggerStats coins $1- elseif ($1 == !commands) triggerCommands $1- elseif ($1 == !top5) triggerTop5 $1- elseif ($1 == !compare) triggerCompare $1- elseif ($1 == !ai) .notice $nick List of computer opponents: $listAI } ;######################################################## ;######################################################## ; LITTLE ALIASES ;######################################################## ;######################################################## alias -l suits return ♣♠♥♦ alias -l cardify return $replace($1-,10,E,11,J,12,Q,13,K,1,A,E,10) alias -l bracks return $+($chr(40),$1-,$chr(41)) alias -l cb1 return $+(,$color1,,$1-,) alias -l cb2 return $+(,$color2,,$1-,) alias -l cb3 return $+(,$color3,,$1-,) alias -l c1 return $+(,$color1,$1-,,) alias -l c2 return $+(,$color2,$1-,,) alias -l c3 return $+(,$color3,$1-,,) alias -l f { verif | return $+(",$mircdir,$statDirectory,\,$1,.ini,") } alias -l l { verif | return $+(",$mircdir,$statDirectory,\,$1,.txt,") } alias -l getStat return $iif($readini($1,$2,$3),$ifmatch,0) alias -l fs filter -ffctue 1 32 $1- $1- alias -l top5 return cph.wr.cpg.gr.h2h alias -l g return $+(bj_game,_,$1,_,$2) alias -l a return $+(bj_action,_,$1,_,$2) alias -l d return $+(bj_deck,_,$1) alias -l w return $+(bj_score,_,$1) alias -l s return $+(bj_settings,_,$1) alias -l hfreedom { if ($hget($g($1,1))) hfree $g($1,1) if ($hget($a($1,1))) hfree $a($1,1) if ($hget($d($1))) hfree $d($1) if ($hget($w($1))) hfree $w($1) if ($hget($s($1))) hfree $s($1) hfreedomMirror $1 } alias -l hfreedomMirror { var %x = 2 while ($hget($g($1,%x))) { hfree $hget($g($1,%x)) hfree $hget($a($1,%x)) inc %x } } alias -l verif { if (!isdir($+(",$mircdir,$statDirectory,\,"))) { var %x = 1 while (%x <= $numtok($statDirectory,92)) { if (!isdir($+(",$mircdir,$gettok($statDirectory,$+(1-,%x),92),\,"))) .mkdir $+(",$mircdir,$gettok($statDirectory,$+(1-,%x),92),\,") inc %x } } } ;######################################################## ;######################################################## ; GAME TRIGGERS ;######################################################## ;######################################################## alias triggerBlackjack { if (!$2) blackjackStart $chan $nick elseif ($istok(1.2.3.4.5.6.7,$2,46)) blackjackStart $chan $nick $2 elseif ($filterAI($2-)) blackjackStart $chan $nick $ifmatch else { .notice $nick Invalid parameter. To start a game with AI opponents ready to join, type !blackjack N. N can be a number from 1-7 .notice $nick You can also specify certain AI opponents you want in the game, for example: !blackjack AIMaster Degausser Trump } } alias triggerBlackjackStop { if ($3 !isop $1) .notice $3 You must be an operator to stop a game! else { if ($cardsRemaining($1)) { if (!$hget($s($1), stop)) stopAction $1 $3 else .notice $3 The game will end after the current round! } elseif ($timer($+(BlackJack,$1,JoinTimer))) { $+(.timerBlackJack,$chan,*) off if ($2 == -m) msg $chan $cb3(Blackjack Race) has been stopped by $c3($3) hfreedom $1 } else .notice $3 You can't perform this action now! } } alias -l triggerAbort { if ($timer($+(BlackJack,$chan,DrawTimer))) && ($nick isop $chan) abortAction $chan $nick elseif ($nick !isop $chan) .notice $nick You must be an operator to abort the games termination! else .notice $nick You can't perform that action now } alias -l triggerStats { if (!$3) .notice $nick Invalid parameters. Specify a name. The -a flag can be used to specify an AI character like: $+(!,$1) -a Degausser elseif (((!$4) && (!$userStats($3))) || (($4) && (!$userStats($4)))) || (($1 == coins) && ((!$userStats($4).user) && (!$userStats($3).user))) .notice $nick Sorry, I haven't heard that name before else { var %s if (!$4) %s = $chan -u $3 elseif ($3 == -a) && ($userStats($4).ai) && ($1 != coins) %s = $chan -a $4 else %s = $chan -u $4 if ($1 == stat) displayStats %s elseif ($1 == coins) displayCoins %s } } alias -l triggerCommands { if ($istok(!ai.ai,$2,46)) .notice $nick This will send you a notice with a list of AI opponents you're able to play against elseif ($istok(!stat.stat,$2,46)) .notice $nick These will send a message with user statistics for the specified name. You can specify the -a flag to define AI opponents, such as: !stat -a Degausser elseif ($istok(!coins.coins,$2,46)) .notice $nick These will send a message with total user coins. Define a user (not AI) by simply specifying a username. elseif ($istok(!commands.commands,$2,46)) .notice $nick This will notice you a list of commands.... silly! elseif ($istok(!compare.compare,$2,46)) { .notice $nick Compare two players based on their stats in comparison to all other players. You can specify two names, and optionally a -a or -u before the names to specify AI or user .notice $nick For example, !compare Anne -a Degausser. Example 2: !compare -a Kyle -u Sarah } elseif ($istok(!blackjack.blackjack,$2,46)) { .notice $nick This command will start a game. You can specify the number of AI opponents ready to join by typing !blackjack N, where N is a number from 1-7 .notice $nick You can also specify specific players by using their names (type !ai for a list) like so: !blackjack Degausser NotTheSun .notice $nick If a game is active, channel operators can end the game by typing: !blackjack stop } elseif ($istok(!replace.replace,$2,46)) .notice $nick Specifically an in-game command to be used if you don't want to play anymore. The game will be counted as a loss elseif ($istok(!top5.top5,$2,46)) { .notice $nick Displays lists of top 5 players. You can specify a -a or -u flag to view distinct AI or user lists. You can also specify the type of list from: $replace($top5,$chr(46),$chr(32)) .notice $nick Example 1: !top5 -u wr :: Example 2: !top5 cph } elseif ($istok(!abort.abort,$2,46)) { .notice $nick Allows you to abort the !blackjack stop operation, before a hand finishes } elseif ($istok(!stop.stop,$2,46)) { .notice $nick Stops the entire round. Does not apply game based statistics } elseif ($istok(!repair.repair,$2,46)) { .notice $nick Repairs the game if you're having trouble starting a new game } else { .notice $nick Helpful commands - IN GAME: !hit !stand !double !split !surrender !replace !stop !abort !repair - OUTSIDE: !blackjack !commands !ai !stat !coins !top5 !compare .notice $nick Type !commands command for more information on some commands, for example: !commands ai } } alias -l triggerTop5 { var %t = $gettok($top5,1,46) if (!$3) { if ($istok(-a.-u,$2,46)) displayTop5 $chan $2 %t else displayTop5 $chan -n $iif($istok($top5,$2,46),$2,%t) } elseif ($left($2,1) == $chr(45) && $len($2) == 2) displayTop5 $chan $iif($istok(-a.-u,$2,46),$2,-n) $iif($istok($top5,$3,46),$3,%t) elseif ($2) displayTop5 $chan -n $iif($istok($top5,$2,46),$2,%t) else displayTop5 $chan -n %t } alias -l triggerCompare { if ($0 == 3) { if ($userStats($2)) && ($userStats($3)) displayCompare -u $2 -u $3 $chan else .notice $nick One of more of the specified users could not be found } elseif ($0 == 5) { if ($userStats($3)) && ($userStats($5)) displayCompare $iif($2 == -a,-a,-u) $3 $iif($4 == -a,-a,-u) $5 $chan else .notice $nick One of more of the specified users could not be found } elseif ($0 < 3) .notice $nick You have to specify two users to compare them. Type !compare player1 player2 elseif ($0 > 5) .notice $nick You've specified to many parameters! To specify users or AI, type: !compare -u user -a AIname else { if ($userStats($3)) { if ($userStats($4)) displayCompare $iif($2 == -a,-a,-u) $3 -u $4 $chan elseif ($userStats($2)) displayCompare -u $2 $iif($4` == -a,-a,-u) $3 $chan } elseif ($userStats($2)) && ($userStats($4)) displayCompare -u $2 $iif($3 == -a,-a,-u) $4 $chan else .notice $nick One or more of the specified users are not recognized } } alias -l triggerRepair { if (!$timerCheck($1)) { msg $1 $cb3(Blackjack Race) was found in a $c2(broken state) $+ , and has been $c3(repaired) hfreedom $1 } } alias -l timerCheck { if ($timer($+(blackjack,$1,DrawTimer)).secs isnum) return $true if ($timer($+(blackjack,$1,JoinTimer)).secs isnum) return $true if ($timer($+(blackjack,$1,AutoTimer)).secs isnum) return $true if ($timer($+(blackjack,$1,RepeatGame)).secs isnum) return $true if ($timer($+(blackjack,$1,NextRound)).secs isnum) return $true if ($timer($+(blackjack,$1,AnnounceWinner)).secs isnum) return $true if ($timer($+(blackjack,$1,EndGame)).secs isnum) return $true return $false } ;######################################################## ;######################################################## ; ACTIONS ;######################################################## ;######################################################## alias -l drawCardAction { if ($numerifyTotal($cardTotal($1,-u,$2).hard) < 21) && (!$istok(double.stand, $hget($a($1,1), $2), 46)) { var %d = $iif(d isin $3,$true,$false) if ((%d) && ($numtok($hget($g($1,1), $2), 32) > 2)) && (!$doubleWith3orMoreCards) .notice $nick You can only double with the first two cards! else { var %card = $drawCard($1), %z hadd $g($1,1) $2 $hget($g($1,1), $2) %card %z = $numerifyTotal($cardTotal($1,-u,$2).hard) if (%z > 20) && (!%d) hadd $a($1,1) $2 stand else hadd $a($1,1) $2 $iif(%d,double,hit) msg $1 $c2($2) $iif(%d,doubled,hit) and drew: $cardflair(%card) :: Current hand: $cardflair($hget($g($1,1), $2)) $bracks($cardTotal($1,-u,$2)) if (%z == 21) && ($($+($chr(36),var,$numtok($hget($g($1,1),$2),32),Card21Payout),2)) { hinc $w($1) $2 $ifmatch msg $1 $c1($2) has hit a $cb3($numtok($hget($g($1,1),$2),32) Card 21) and is rewarded $c2($ifmatch coins) } elseif (%z < 21) && ($($+($chr(36),var,$numtok($hget($g($1,1),$2),32),CardTrickPayout),2)) { hinc $w($1) $2 $ifmatch msg $1 $c1($2) has hit a $cb3($numtok($hget($g($1,1),$2),32) Card Trick) and is rewarded $c2($ifmatch coins) } if ((%d) || (%z > 20)) { hinc $s($1) completed 1 if ($splitHand($1,$2)) createSplits $1 $2 $ifmatch elseif ($actionsComplete($1)) checkWinner $1 -f } } } else .notice $2 You can't draw anymore cards! } alias -l standAction { if ($numerifyTotal($cardTotal($1,-u,$2).hard) < 21) && (!$istok(double.stand, $hget($a($1,1), $2), 46)) { hadd $a($1,1) $2 stand hinc $s($1) completed 1 msg $1 $c2($2) stands with the hand: $cardflair($hget($g($1,1), $2)) $bracks($cardTotal($1,-u,$2)) if ($splitHand($1,$2)) createSplits $1 $2 $ifmatch elseif ($actionsComplete($1)) checkWinner $1 -f } else .notice $2 You can't perform this action! } alias -l splitAction { var %hand = $hget($g($1,1),$2) if ($cardPair(%hand)) && (!$istok(double.stand,$hget($a($1,1),$2),46)) { if ($noResplitWithAces) && ($gettok($gettok(%hand,1,32),2,95) == A) && ($hget($g($1,2),$2)) .notice $2 You can't split Aces more than once! else { msg $1 $c2($2) splits the hand: $cardflair($hget($g($1,1),$2)) $bracks($cardTotal($1,-u,$2)) hadd $newSplitTable($1,$2) $2 $gettok($hget($g($1,1),$2),2,32) hadd $g($1,1) $2 $gettok($hget($g($1,1), $2),1,32) hinc $s($1) actions 1 createSplits $1 $2 } } else .notice $2 You can't perform this action! } alias -l surrenderAction { if ($numtok($hget($g($1,1), $2), 32) == 2) && ($numerifyTotal($cardTotal($1,-u,$2).hard) < 21) && (!$hget($m($1,1),$2)) && (!$istok(double.stand, $hget($a($1,1), $2), 46)) { msg $1 $c2($2) surrenders their hand: $cardflair($hget($g($1,1), $2)) $bracks($cardTotal($1,-u,$2)) and $c1($iif($surrender > 0,wins,loses) $abs($surrender) $iif($abs($surrender) == 1,coin,coins)) hdel $a($1,1) $2 hadd $g($1,1) $2 check hinc $w($1) $2 $surrender hinc $s($1) completed 1 processHandStats $1 $2 total 1 processHandStats $1 $2 lose 1 processHandStats $1 $2 coins $surrender if ($actionsComplete($1)) checkWinner $1 -f } else .notice $2 You can't perform this action! } alias -l replaceAction { if (!$istok($hget($s($1),replace),$nick,32)) { hadd $s($1) replace $hget($s($1), replace) $2 msg $1 $cb3($2) $c3(will be replaced after the next round!) } } alias -l stopAction { hadd $s($1) stop $2 msg $1 $cb3(Blackjack Race) $c3(will be stopped after the next round!) } alias -l abortAction { if ($hget($s($1),stop)) hdel $s($1) stop msg $1 $cb3(Blackjack Race) $c3(will no longer be stopped after this round!) } alias -l actionsComplete { if ($hget($s($1), completed) == $hget($s($1), actions)) return $true return $false } ;######################################################## ;######################################################## ; SPLIT TABLES ;######################################################## ;######################################################## alias -l newSplitTable { var %x = 2 while (%x) { if (!$hget($g($1, %x))) { hmake $g($1, %x) 1 hmake $a($1, %x) 1 $+(.timerBlackJack,$1,DrawTimer) -o 1 $calc($timer($+(BlackJack,$1,DrawTimer)).secs + 10) checkWinner $1 } if (!$hget($g($1, %x), $2)) return $g($1,%x) inc %x } } alias -l splitHand { var %x = 2 while ($hget($g($1,%x),$2)) { if ($numtok($ifmatch,32) == 1) return %x inc %x } return $false } ;######################################################## ;######################################################## ; THE EDGE ;######################################################## ;######################################################## alias -l offTheEdge { if ($theEdge < 0) { var %x = 1, %n = $hget($w($1),0).item, %p, %s, %e = $v1, %count = 1, %countvar, %minimum, %a while (%x <= %n) { %s = $hget($w($1),%x).data if (!$len(%countvar)) %countvar = %s elseif (%countvar == %s) inc %count if (%s > %minimum) || (!$len(%minimum)) %minimum = %s inc %x } if (%count != %n) { if (%minimum > %e) %minimum = %e %x = 1 while ($len($hget($w($1),%x).item)) { %p = $hget($w($1),%x).item %s = $hget($w($1),%p) if (%s < %minimum) { %a = $iif($isAI($1,%p),-a,-u) msg $1 $cb2(%p) has tipped over $c3(The Edge) and fallen into obscurity! $cb3(Goodbye %p $+ !) preProcessHandStats $1 %p %a lose if (%a == -u) coinSave $1 %p hdel $g($1,1) %p hdel $w($1) %p top5PreWrite $1 %p %a } else { if (%s == %minimum) msg $1 $c2(%p) is on $cb3(The Edge) with $+(04,%s,) coins! inc %x } } } } } ;######################################################## ;######################################################## ; ARTIFICIAL INTELLIGENCE ;######################################################## ;######################################################## alias -l getIntel return $iif($findtok($ai,$1,1,32) <= $numtok($aiIntel,32),$iif($gettok($aiIntel,$findtok($ai,$1,1,32),32) isnum 1-10, $v1, 5),5) alias -l isAI return $istok($hget($s($1), ai),$2,32) alias -l listAI { var %x = 1, %y = $numtok($ai,32), %r, %u while (%x <= %y) { %u = $gettok($ai,%x,32) %r = %r $c2(%u) $c1($bracks($getIntel(%u))) / inc %x } return $left(%r,-1) } alias -l filterAI { var %x = 1, %y = $numtok($1-,32), %return, %a while (%x <= %y) { %a = $gettok($1-,%x,32) if ($istok($ai,%a,32)) && (!$istok(%return,%a,32)) %return = $addtok(%return,%a,32) inc %x } return %return } alias -l generateAI { var %x = 1, %y = $numtok($ai,32), %s, %u, %n = $iif($2- isnum 1-7,$iif($2- <= $numtok($ai,32),$2-,$numtok($ai,32)),$numtok($2-,32)) while (%x <= %n) { if ($2- isnum 1-7) { while ($istok(%s,%u,32) || !%u) { %u = $gettok($ai,$rand(1,$numtok($ai,32)),32) } %s = %s %u } elseif ($istok($ai,$gettok($2-,%x,32),32)) %u = $gettok($2-,%x,32) else %u = $null if (%u) $+(.timerBlackJack,$1,JoinTimer,%u) -o 1 $rand(2,28) addPlayer $1 %u -a inc %x } } alias -l rollAI { var %x = 1, %ai = $hget($s($1), ai), %y = $numtok(%ai, 32), %player while (%x <= %y) { %player = $gettok(%ai,%x,32) if (!$istok(double.stand, $hget($a($1,1), %player), 46)) timeAI $1 %player inc %x } } alias -l performAIAction { if ($timer($+(BlackJack,$1,DrawTimer))) { var %action = stand, %intel = $getIntel($2), %dealer = $cardTotal($1, -d).hard, %hard = $cardTotal($1,-u,$2).hard, %soft = $cardTotal($1,-u,$2).soft, %d = $iif($numtok($hget($g($1,1), $2), 32) == 2 || $doubleWith3orMoreCards,1,0), %s = $iif($cardPair($hget($g($1,1),$2)),$ifmatch,0) if (%s == A) && ($hget($g($1,2),$2)) && ($noResplitWithAces) %s = 0 if (%hard < 12) || (%soft < 8) %action = hit if (%intel > 1) && (%hard < 17) %action = hit if (%intel > 1) && (%s) && (%soft == 2) %action = split if (%intel > 2) && (%dealer < 11) && (%hard isnum 10-11) %action = double if (%intel > 2) && (%dealer > 6) && ((%soft > 7) && (%hard > 13)) %action = stand if (%intel > 3) && (%dealer isnum 2-6) && (%hard > 11) && (%soft > 7) %action = stand if (%intel > 3) && (%s) && (%hard == 16) && (%dealer < 11) %action = split if (%intel > 4) && (%dealer isnum 2-3) && (%hard < 14) && (!$istok(double.split,%action,46)) %action = hit if (%intel > 4) && (%dealer > 6) && ((%hard < 15) || (%soft < 8) && (!$istok(double.split,%action,46))) %action = hit if (%intel > 5) && (%dealer == 9) && (%soft < 9) && (%action != split) %action = hit if (%intel > 5) && (%dealer isnum 10-11) && (%soft == 8) %action = hit if (%intel > 5) && (%s) && (%dealer isnum 3-6) && ($istok(4.6.12.14.18,%hard,46)) %action = split if (%intel > 6) && (%dealer == 10) && (%hard isnum 10-11) %action = hit if (%intel > 6) && (%dealer == 9) && (%hard isnum 10-11) %action = double if (%intel > 6) && (%dealer == 11) && (%hard < 17) && (%soft > 2) %action = hit if (%intel > 7) && (%dealer == 3) && (%hard == 13) && (%soft == 13) %action = stand if (%intel > 7) && (%dealer > 7) && (%hard isnum 12-16) && (!$istok(double.split,%action,46)) %action = hit if (%intel > 7) && (%s) && (%dealer == 2) && (%hard isnum 4-6) %action = split if (%intel > 7) && (%s) && (%dealer == 7) && ($istok(4.6.14.16,%hard,46)) %action = split if (%intel > 8) && (%dealer isnum 3-6) && (%hard == 9) %action = double if (%intel > 8) && (%dealer isnum 5-6) && (%soft isnum 2-8) && (%hard > 11) %action = $iif(!%d && %soft == 8,stand,double) if (%intel > 8) && (%dealer == 7) && (%hard isnum 15-16) && (%action != split) %action = hit if (%intel > 8) && (%s) && (%hard == 18) && ($istok(4.5.6.8.9,%dealer,46)) %action = split if (%intel > 9) && (%dealer == 4) && (%soft isnum 5-8) && (%hard > 11) && (%action != split) %action = $iif(!%d && %soft == 8,stand,double) if (%intel > 9) && (%dealer == 3) && (%soft isnum 7-8) && (%hard > 11) && (%action != split) %action = $iif(!%d && %soft == 8,stand,double) if (%action == hit) || ((%action == double) && (!%d)) drawCardAction $1 $2 elseif (%action == double) drawCardAction $1 $2 -d elseif (%action == split) splitAction $1 $2 else standAction $1 $2 if (!$istok(double.stand, $hget($a($1,1), $2), 46)) timeAI $1 $2 } } alias -l timeAI { $+(.timerBlackJack,$1,DrawTimer,$2) -o 1 $rand(2,7) performAIAction $1 $2 } ;######################################################## ;######################################################## ; SHOE MANAGEMENT ;######################################################## ;######################################################## alias -l createDeck { var %i = 1, %d = $calc($hget($s($1), decks) * 52) while (%i <= %d) { hadd $d($1) %i 1 inc %i } } alias -l cardsRemaining return $hget($d($1), 0).item alias -l drawCard { if (!$cardsRemaining($1)) checkShuffle $1 var %r = $rand(1,$cardsremaining($1)), %t = $hget($d($1), %r).item hdel $d($1) %t return $+($mid($suits,$calc((%t % 4) + 1),1),_,$cardify($calc((%t % 13) + 1))) } ;######################################################## ;######################################################## ; GAME FLOW ;######################################################## ;######################################################## alias -l blackjackStart { hfreedom $1 hmake $g($1,1) 1 hmake $a($1,1) 1 hmake $d($1) $floor($calc(($iif($decks isnum 1-8,$v1,2) * 52) / 10)) hmake $w($1) 1 hmake $s($1) 1 hadd $s($1) decks $iif($decks isnum 1-8,$v1,2) hadd $s($1) stats $iif($statEnable,1,0) msg $1 $c2($2) has started a game of $cb3(Blackjack Race!) Type $c2(!join) to join the game, you have $c1(30 seconds!) $+(.timerBlackJack,$1,JoinTimer) -o 1 30 startGame $1 if ($3) generateAI $1 $3- } alias -l addPlayer { if (!$hget($g($1,1), $2)) { hadd $g($1,1) $2 check hadd $w($1) $2 0 if ($3) && (a isin $3) hadd $s($1) ai $iif($hget($s($1), ai),$ifmatch $2,$2) msg $1 $c2($2) $+ $iif(($3) && (a isin $3),$+($chr(32),$bracks(AI level $getIntel($2)))) has joined the game! $c1($players($1)) players joined! $iif($hget($g($1,1), 0).item < 7 && $timer($+(BlackJack,$1,JoinTimer)).secs > 1,You've $c1($timer($+(BlackJack,$1,JoinTimer)).secs) seconds left to join!) if ($hget($g($1,1), 0).item > 6) startGame $1 -f } } alias -l startGame { $+(.timerBlackJack,$1,JoinTimer*) off if (!$players($1)) { msg $1 Nobody has joined the game. $c2(1 player) is required! Turning off. blackjackStop $1 -f } else { if ($players($1) == 1) { while ($players($1) < 2) { if (($isAI($1, $hget($g($1,1), 1).item)) && ($numtok($ai,32) < 2)) || (!$ai) addPlayer $1 $+(Agent,$rand(11111,99999)) -a else addPlayer $1 $gettok($ai,$rand(1,$numtok($ai,32)),32) -a } } hadd $s($1) original_players $players($1) createDeck $1 var %text = The aim is to win $cb1($finish coins) from the $c2(Dealer) before everyone else. Bet amounts are in units of $winSingle $+ , $cb3($iif($hget($s($1), decks) > 1,$v1 decks,1 deck)) in use. Get ready... if ($2) && (f isin $2) msg $1 There are a maximum of $c1($players($1) players!) %text else msg $1 $c1(Time is up!) There are $c1($players($1) players!) %text $+(.timerBlackJack,$1,RepeatGame) -o 1 10 startRound $1 } } alias -l startRound { createDefaults $1 if ($actionsComplete($1)) $+(.timerBlackJack,$1,AutoTimer) -o 1 2 checkWinner $1 -f else { $+(.timerBlackJack,$1,DrawTimer) -o 1 30 checkWinner $1 if ($hget($s($1), ai)) rollAI $1 } } alias -l createDefaults { var %x = 1, %p = $players($1), %player, %actions hadd $s($1) dealer $drawCard($1) hadd $s($1) actions $hget($g($1,1),0).item hadd $s($1) completed 0 while (%x <= %p) { %player = $hget($g($1,1), %x).item hadd $g($1,1) %player $drawCard($1) $drawCard($1) %actions = $iif($numerifyTotal($cardTotal($1,-u,%player).hard) < 21,hit,stand) hadd $a($1,1) %player %actions if (%actions == stand) hinc $s($1) completed 1 msg $1 $c2($+(%player,:)) Your cards are: $cardflair($hget($g($1,1), %player)) :: Total: $bracks($cardTotal($1,-u,%player)) $iif(%actions == hit,:: You can: !hit !stand !double $+ $iif($cardPair($hget($g($1,1), %player)),$+($chr(32),!split))) $+ $iif(%actions == hit,$+($chr(32),!surrender))) inc %x } msg $1 The $cb2(Dealer) is showing: $cardflair($hget($s($1), dealer)) } alias -l createSplits { if ($3) { var %temp = $hget($g($1,1),$2) hadd $g($1,1) $2 $hget($g($1,$3),$2) hadd $g($1,$3) $2 %temp hadd $a($1,$3) $2 $hget($a($1,1),$2) } hadd $g($1,1) $2 $hget($g($1,1),$2) $drawCard($1) var %one = $iif(($splitAcesOneCardOnly) && ($gettok($gettok($hget($g($1,1),$2),1,32),2,95) == A),1,0), %actions = $iif($numerifyTotal($cardTotal($1,-u,$2).hard) < 21 && !%one,hit,stand) hadd $a($1,1) $2 %actions msg $1 $c2($+($2,:)) Your cards are: $cardflair($hget($g($1,1), $2)) :: Total: $bracks($cardTotal($1,-u,$2)) $iif(%actions == hit && !%one,:: You can: !hit !stand !double $+ $iif($cardPair($hget($g($1,1), $2)) && (($cardPair($hget($g($1,1), $2)) != A) || (!$noResplitWithAces)),$+($chr(32),!split))) if (%actions == stand) { hinc $s($1) completed 1 if ($splitHand($1,$2)) forwardSplitter $1 $2 $splitHand($1,$2) elseif ($actionsComplete($1)) checkWinner $1 -f } } alias -l forwardSplitter { createSplits $1- } alias -l blackjackStop { if ($hget($s($1),stats)) { var %x = 1, %f, %u, %p = $players($1), %w, %winner = $3 while ($hget($g($1,1), %x).item) { %u = $ifmatch %f = $iif($isAI($1,%u),-a,-u) %w = $iif(%winner && ($2 != -f),$iif(%winner == %u,win,lose),draw) preProcessHandStats $1 %u %f %w top5PreWrite $1 %u %f if (%f == -u) coinSave $1 %u inc %x } top5Sort } hfreedom $1 } ;######################################################## ;######################################################## ; POST HAND ;######################################################## ;######################################################## alias -l checkWinner { $+(.timerBlackJack,$1,DrawTimer,*) off var %dealer = $dealerOption($1) dealerDraw $1 %dealer roundDisplay $1 %dealer $iif($2,$2) } alias -l roundDisplay { var %t = $hget($s($1), dealer), %win = $getWinner($1).win, %draw = $getWinner($1).draw, %lose = $getWinner($1).lose, %finished = $cb1($iif(f isin $3,All hands are finished!,Time is up!)) var %displaywin = $formatPlayers($1, %win).win, %displaylose = $formatPlayers($1, %lose).lose, %displaydraw = $formatPlayers($1, %draw).draw if ($istok(1.2,$2,46)) msg $1 %finished The $cb2(Dealer) shows $cardflair($gettok(%t,1,32)) and $iif($2 = 2,draws the following cards:,drew the card:) $cardflair($gettok(%t,2-,32)) :: Total: $cb2($cardTotal($1, -d).hard) elseif ($2 == 0) msg $1 %finished Everyone went $c1(bust) so the $cb2(Dealer) wins elseif ($2 == 4) msg $1 %finished Everyone $c1(surrendered) so the $cb2(Dealer) doesn't draw cards else msg $1 %finished The $cb2(Dealer) can't make $c1(Blackjack) so doesn't draw cards if (%win) msg $1 $c1($iif($numtok(%win, 32) != 1,$v1 players,%win)) beat the dealer $+ $iif($numtok(%win, 32) != 1,: %displaywin,: $gettok(%displaywin,2-,32)) if (%draw) msg $1 $c1($iif($numtok(%draw, 32) != 1,$v1 players,%draw)) managed to draw $+ $iif($numtok(%draw, 32) != 1,: %displaydraw,: $gettok(%displaydraw,2-,32)) if (!%win) && (!%draw) && (%lose) && ($istok(1.2,$2,46)) msg $1 The $cb2(Dealer) beat everyone with: $cardflair(%t) :: Total: $cb2($cardTotal($1,-d).hard) $+(.timerBlackJack,$1,nextRound) -o 1 2 nextRound $1 } alias -l checkShuffle { var %r = $cardsRemaining($1) if (%r < $calc(($players($1) + 1) * 7)) { msg $1 $cb3(The cards are getting shuffled and reloaded) $bracks($+($round($calc((%r / ($hget($s($1), decks) * 52)) * 100),2),$chr(37)) density) createDeck $1 } else msg $1 $cb3(%r cards) remain in the shoe $bracks($+($round($calc((%r / ($hget($s($1), decks) * 52)) * 100),2),$chr(37)) density) } alias -l nextRound { msg $1 Current scores: $allScores($1) offTheEdge $1 if ($overallWinner($1)) { var %winner = $ifmatch, %coins = $hget($w($1), %winner) $+(.timerBlackJack,$1,announceWinner) -o 1 2 msg $1 Okay we have an $cb3(overall winner.) $cb2(%winner) wins the game, finishing with $c1(%coins coins!) $+(.timerBlackJack,$1,endGame) -o 1 4 blackjackStop $1 -m %winner } elseif ($hget($s($1), stop)) { $+(.timerBlackJack,$1,announceStop) -o 1 2 msg $1 $cb3(Blackjack Race) was set to be stopped by $c2($hget($s($1), stop)) and has been terminated $+(.timerBlackJack,$1,endGame) -o 1 4 blackjackStop $1 -f } else { hdel -w $a($1,1) * hfreedomMirror $1 $+(.timerBlackJack,$1,ShuffleTimer) -o 1 5 checkShuffle $1 if ($hget($s($1),replace)) $+(.timerBlackJack,$1,ReplaceUser) -o 1 10 replaceUser $1 $+(.timerBlackJack,$1,RepeatGame) -o 1 12 startRound $1 } } alias -l replaceUser { var %x = 1, %u = $hget($s($1),replace), %y = $numtok(%u,32), %user, %a hdel $s($1) replace while (%x <= %y) { %user = $gettok(%u,%x,32) if ($hget($g($1,1), %user)) { while (!%a) || ($hget($g($1,1), %a)) { %a = $iif($rand(1,20) == 1,$+($chr(74),$chr(109),m,$chr(105),$chr($+(10,1))),$+(Agent,$rand(10000,99999))) } preProcessHandStats $1 %user -u lose top5PreWrite $1 %user -u coinSave $1 %user hadd $g($1,1) %a $hget($g($1,1),%user) hadd $w($1) %a $hget($w($1),%user) hdel $g($1,1) %user hdel $w($1) %user hadd $s($1) ai $iif($hget($s($1), ai),$ifmatch %a,%a) msg $1 $cb3(%a) replaces $c2(%user) and joins the game! } inc %x } } ;######################################################## ;######################################################## ; CARD FUNCTIONS ;######################################################## ;######################################################## alias -l numerifyTotal { if ($1- == TOO MANY) return 30 if ($1- == BLACKJACK) return 22 return $1- } alias -l cardflair { tokenize 32 $1- var %x = 1 ,%s ,%d while ($eval($+($,%x),2)) { %d = $remove($ifmatch,_) %s = %s $iif($left(%d,1) isin $left($suits,2),%d,$+(04,%d,)) inc %x } return %s } alias -l cardPair { if ($gettok($gettok($1-,1,32),2,95) == $gettok($gettok($1-,2-,32),2-,95)) return $v1 return $false } alias -l cardTotal { var %s = $iif($2 == -u,$hget($g($1,1), $3),$iif($2 == -d,$hget($s($1), dealer),$2-)), %x = 1, %c = $numtok(%s, 32), %return = 0, %n, %soft = 0 while (%x <= %c) { %n = $replace($gettok($gettok(%s,%x,32),2,95),A,1,J,10,Q,10,K,10) inc %return %n if (%n == 1) && (!%soft) && (%return < 12) inc %soft elseif (%soft) && (%return > 11) dec %soft if (%return > 21) return TOO MANY inc %x } if (%soft) { if (%return == 11) return $iif(%x == 3,BLACKJACK,21) if (!$prop) return $+(%return,/,$calc(%return + 10)) if ($prop == hard) return $calc(%return + 10) } return %return } alias -l formatPlayers { var %x = 1, %y = $numtok($2-,32), %u, %return, %split = 1, %hand, %i, %c, %d while (%x <= %y) { %u = $gettok($2-,%x,32) %hand = $hget($g($1,%split), %u) if ($dealerVS($1, %hand) == $prop) { if (!%i) { %return = %return %u $+ : $bracks($cardflair(%hand)) / | %i = 1 } else %return = $left(%return,-1) $bracks($cardflair(%hand)) / processHandStats $1 %u total 1 $iif($isAI($1, %u),-a) processHandStats $1 %u $prop 1 $iif($isAI($1, %u),-a) if ($prop == win) && ($numerifyTotal($cardTotal($1, %hand).hard) == 22) { hinc $w($1) %u $winBlackjack processHandStats $1 %u coins $winBlackjack $iif($isAI($1, %u),-a) } else { %d = $iif($hget($a($1,%split),%u) == Double,$v2,Single) %c = $eval($+($,$prop,%d),2) hinc $w($1) %u %c if (%d == Double) processHandStats $1 %u double 1 $iif($isAI($1, %u),-a) processHandStats $1 %u coins %c $iif($isAI($1, %u),-a) } } inc %split if ($hget($g($1,%split), %u)) continue %split = 1 %i = 0 inc %x } return $left(%return,-1) } ;######################################################## ;######################################################## ; DEALER FUNCTIONS ;######################################################## ;######################################################## alias -l dealerOption { var %x = 1, %y = $hget($g($1,1),0).item, %return = 0, %t, %m = 1, %p, %q = 1 while (%x <= %y) { %p = $hget($g($1,1),%x).item if ($hget($g($1,%m),%p) == check) inc %q else { %t = $numerifyTotal($cardTotal($1, $hget($g($1,%m), %p)).hard) if (%t < 22) return 2 elseif (%t == 22) %return = 1 inc %m if ($hget($g($1,%m),%p)) continue } %m = 1 inc %x } if (%return == 1) && (!$istok(10.11,$cardTotal($1,-d).hard,46)) return 3 if (%q < %x) return %return return 4 } alias -l dealerDraw { while ($cardTotal($1,-d).hard < 17) || (($dealerHitsOnSoft17) && ($cardTotal($1,-d).soft < 8)) { if ($istok(0.3.4,$2,46)) break hadd $s($1) dealer $hget($s($1), dealer) $drawCard($1) if ($2 == 1) break } } alias -l dealerVS { var %cards = $numerifyTotal($cardTotal($1,$2-).hard), %dealer = $numerifyTotal($cardTotal($1,-d).hard) if ((%cards < %dealer) && (%dealer < 30)) || (%cards == 30) return lose if (%cards == %dealer) return draw return win } ;######################################################## ;######################################################## ; OTHER FUNCTIONS ;######################################################## ;######################################################## alias -l players return $iif($hget($g($1,1), 0).item, $ifmatch, 0) alias -l getWinner { var %return , %x = 1, %p = $players($1), %player, %split = 1, %h while (%x <= %p) { %player = $hget($g($1,1), %x).item if ($hget($g($1,1),%player) != check) { %h = $hget($g($1, %split), %player) inc %split if ($prop == $dealerVS($1,%h)) %return = $addtok(%return,%player,32) elseif ($hget($g($1,%split), %player)) continue %split = 1 } inc %x } return %return } alias -l allScores { var %return, %x = 1, %y = $hget($w($1), 0).item, %s while (%x <= %y) { %s = $hget($w($1), %x).data %return = %return $hget($w($1), %x).item $+ : $iif(%s == 0,0,$+(,$iif(%s < 0,04,$iif(%s >= 100,06,03)),%s,)) :: inc %x } return $left(%return, -2) } alias -l overallWinner { var %return, %x = 1, %y = $hget($w($1), 0).item, %score = $finish - 1, %data while (%x <= %y) { %data = $hget($w($1), %x).data if (%data >= %score) { if (%data > %score) %return = $hget($w($1), %x).item else %return = %return $hget($w($1), %x).item %score = %data } inc %x } if (%x == 2) return $hget($w($1), 1).item if ($numtok(%return, 32) == 1) return %return return $false } ;######################################################## ;######################################################## ; STATISTICS WRITE ;######################################################## ;######################################################## alias -l preProcessHandStats { if ($hget($s($1),stats)) { var %p = $hget($s($1),original_players) processHandStats $1 $2 total 1 $3 games processHandStats $1 $2 players %p $3 games processHandStats $1 $2 $4 1 $3 games processHandStats $1 $2 $+($4,_,single) $iif($4 == win,$calc(%p - 1),1) $3 games processHandStats $1 $2 coins $iif($hget($w($1),$2),$ifmatch,0) $3 games } } alias -l processHandStats { if ($hget($s($1),stats)) { var %a = $iif($5 && a isin $5,$true), %z = $iif($6,$6,hands), %f = $iif(%a,$+(%z,_ai),%z) if (!%a) || ($istok($ai,$2,32)) writeini -n $f(%f) $2 $3 $calc($getStat($f(%f),$2,$3) + $4) } } alias -l userStats { if (!$prop) { if ($getStat($f($iif($2,$2,hands)),$1,total)) return $true if ($getStat($f($iif($2,$2,hands_ai)),$1,total)) return $true return $false } if ($prop == ai) return $iif($getStat($f($+($iif($2,$2,hands),_ai)),$1,total),$true,$false) if ($prop == user) return $iif($getStat($f($+($iif($2,$2,hands))),$1,total),$true,$false) } alias -l coinSave { if ($hget($s($1),stats)) { var %new = $iif($hget($w($1),$2),$ifmatch,0) writeini -n $f(coins) $2 coins $calc($getStat($f(coins),$2,coins) + %new) blackjackCoinListener $2 %new $getStat($f(coins),$2,coins) } } alias -l top5Write { var %a = $iif(a isin $2,$true), %f = $iif($istok(cph.wr,$3,46),$f($iif(%a,hands_ai,hands)),$f($iif(%a,games_ai,games))), %data = $top5Data($1,%f,$3), %l if ($len(%data)) { %l = $read($l($3),w,$+(*,$chr(32),$1,$iif(%a,$+($chr(32),-a),$null))) %l = $iif($readn,$ifmatch,0) write $iif(%l,$+(-l,%l)) $l($3) %data $1 $iif(%a,-a,$null) writeini -n %f $1 $3 %data } } alias -l top5Data { if ($istok(cpg.cph,$3,46)) return $round($calc($getStat($2,$1,coins) / $getStat($2,$1,total)),2) if ($3 == h2h) return $+($round($calc(($getStat($2,$1,win_single) / ($getStat($2,$1,win_single) + $getStat($2,$1,lose_single))) * 100),2),$chr(37)) if ($3 == wr) return $round($calc(($getStat($2,$1,win) / ($getStat($2,$1,win) + $getStat($2,$1,lose) + $getStat($2,$1,draw))) * 100),2) var %t = $getStat($2,$1,total) return $round($calc(((($getStat($2,$1,win) * ((%t * ($getStat($2,$1,players) / %t)) / %t)) / %t) / ($getStat($2,$1,players) / %t)) * 100),2) } alias -l top5PreWrite { var %x = 1 if ($hget($s($1),stats)) { if ($istok($ai,$2,32) || (a !isin $3)) { while ($gettok($top5,%x,46)) { top5Write $2 $3 $ifmatch inc %x } } } } alias -l top5Sort { var %x = 1, %l while ($gettok($top5,%x,46)) { %l = $l($ifmatch) if ($exists(%l)) fs %l inc %x } } ;######################################################## ;######################################################## ; STATISTICS DISPLAY ;######################################################## ;######################################################## alias -l displayStats { var %a = $iif((($2 == -a) && $getStat($f(hands_ai),$3,total)) || !$getStat($f(hands),$3,total),$true), %f = $f($+(hands,$iif(%a,_ai))), %f2 = $f($+(games,$iif(%a,_ai))), %x = 1, %c, %g, %h var %t = $getStat(%f,$3,total), %w = $getStat(%f,$3,win), %d = $getStat(%f,$3,draw), %o = $round($calc(($getStat(%f,$3,double) / (%w + $getStat(%f,$3,lose) + %d)) * 100),2) $+ $chr(37) while ($gettok($top5,%x,46)) { %g = $ifmatch %h = $read($l(%g),w,$+(*,$chr(32),$3,$iif(%a,$+($chr(32),-a),$null))) %c = %c $+($upper(%g),:) $c3($ord($iif($readn,$ifmatch,$lines($l(%g))))) $c2(/) inc %x } msg $1 Play stats for $cb1($3 $+ :) Hands: $c3(%t) $c2(/) Wins: $c3(%w) $c2(/) Draws: $c3(%d) $c2(/) CPH: $c3($top5Data($3,%f,cph)) $c2(/) Win Rate: $c3($top5Data($3,%f,wr)) $c2(/) Double Rate: $c3(%o) msg $1 Game stats for $cb1($3 $+ :) Games: $c3($getStat(%f2,$3,total)) $c2(/) Wins: $c3($getStat(%f2,$3,win)) $c2(/) CPG: $c3($top5Data($3,%f2,cpg)) $c2(/) Game Rating: $c3($top5Data($3,%f2,gr)) $c2(/) H2H Tier: $c3($top5Data($3,%f2,h2h)) msg $1 List stats for $cb1($3 $+ :) $gettok(%c,$+(1-,$calc($numtok(%c,32) - 1)),32) } alias -l displayCoins { %f = $f(coins) if ($ini(%f,$3)) msg $1 Total coins for $cb1($3 $+ :) $c3($getStat(%f,$3,coins)) } alias -l displayTop5 { var %x = 1, %f = $l($3), %l = $lines(%f), %c = 0, %r, %f2, %a, %game = $iif($istok(cpg.gr.h2h,$3,46),games,hands), %y = $iif(%game == games,$statMinGames,$statMinHands), %p msg $1 $cb3(Top 5) $c3($iif(a isin $2,robots,$iif(u isin $2,users,players)) for:) $c2($iif($3 == cph,Coins Per Hand,$iif($3 == wr,Win Rate,$iif($3 == cpg,Coins Per Game,$iif($3 == gr,Game Rating,Head to Head Tier))))) $bracks(min %y %game) while (%x <= %l) && (%c < 5) { %r = $read(%f,%x) %p = $gettok(%r,2,32) %a = $iif($gettok(%r,3,32) == -a,$true,$false) %f2 = $f($iif(%a,$+(%game,_,ai),%game)) if ($getStat(%f2,%p,total) >= %y) && ((($2 == -a) && (%a)) || (($2 == -u) && (!%a)) || ($2 == -n)) { inc %c msg $1 $cb1($+(%c,$chr(46))) $c2(%p) $iif(%a,$+($chr(32),$bracks(AI level $getIntel(%p)))) $cb3($bracks($gettok(%r,1,32))) } inc %x } } alias -l displayCompare { var %x = 1, %a1 = $iif((($1 == -a) && ($getStat($f(hands_ai),$2,total))) || (!$getStat($f(hands),$2,total)),$true,$false), %a2 = $iif((($3 == -a) && ($getStat($f(hands_ai),$4,total))) || (!$getStat($f(hands),$4,total)),$true,$false) var %f, %r1, %r2, %t1, %t2 while (%x <= $numtok($top5,46)) { %f = $l($gettok($top5,%x,46)) %r1 = $read(%f,w,$+(*,$chr(32),$2,$iif(%a1,$+($chr(32),-a),$null))) inc %t1 $iif($readn,$ifmatch,$lines(%f)) %r2 = $read(%f,w,$+(*,$chr(32),$4,$iif(%a2,$+($chr(32),-a),$null))) inc %t2 $iif($readn,$ifmatch,$lines(%f)) inc %x } %r2 = $round($calc((%t1 / (%t1 + %t2)) * 100),2) %r1 = $calc(100 - %r2) if (%r1 > %r2) msg $5 $cb1(>>>) $cb2($2) $cb1(<<<) $cb3($+(%r1,$chr(37))) $c1(vs) $+(%r2,$chr(37)) $c2($4) elseif (%r2 > %r1) msg $5 $c2($2) $+(%r1,$chr(37)) $c1(vs) $cb3($+(%r2,$chr(37))) $cb1(>>>) $cb2($4) $cb1(<<<) else msg $5 $cb2($2) $cb3($+(%r1,$chr(37))) $c1(vs) $cb3($+(%r2,$chr(37))) $cb2($4) } ;######################################################## ;######################################################## ; HELPER FUNCTIONS (use outside script) ;######################################################## ;######################################################## ; return coins in coins.ini alias blackjackGetCoins { return $getStat($f(coins),$1,coins) } ; remove coins from coins.ini alias blackjackDelCoins { var %u = $1, %f = $f(coins) writeini -n %f %u coins $calc($getStat(%f,%u,coins) - $iif($2 isnum,$ifmatch,0)) if ($isid) return $getStat(%f,$1,coins) } ;######################################################## ;######################################################## ; ACCUMULATED COINS LISTENER ;######################################################## ;######################################################## ; listener, each time the user accumulates more coins (runs once per user per game played) ; you can 'transport' the coins accumulated to a separate script/file, and/or delete them ; these coins are displayed by the !coins command, removing them will be reflected. ; you can copy new points ($2) to a global/master file which works with your other scripts, if you want ; take note that $2 and $3 can both be negatives, make proper checks to keep things in accordance with the rest of your script alias -l blackjackCoinListener { ; $1 = the username ; $2 = coins added for user after current game ; $3 = new total coins for user ; your commands here: ; example echo after each time coins are added (uncomment to try) ; echo -a $1 finished the game, $iif($2 >= 0,winning,losing) $2 coins, and now has $3 total coins! ; example removing coins just earnt: ; blackjackDelCoins $1 $2 ; example write to a separate file which holds stars collected by users. Each star is worth 20 coins ; also remove N stars worth of coins from the coin bank. ; if ($3 > 0) { ; var %file = stars.ini, %coinsPerStar = 20, %stars = $floor($calc($3 / %coinsPerStar)) ; writeini %file $1 stars $calc($iif($readini(%file,$1,stars),$v1,0) + %stars) ; blackjackDelCoins $1 $calc($3 - ($3 % %coinsPerStar)) ; } ; hint: removing the if statement surrounding the previous 3 commands will hold it's current functionality, ; but will also remove stars from the stars file if the user falls to -20 or less }
  10. I have had this script a while and use it but just in case some body stumbles accross the site looking for this kind of script here they go 🙂 ON *:TEXT:Sadd cod *:*: { set $+(%,fc,cod,$nick) $2- notice $nick Your Fc has been recorded to see it type Scod <name> msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Scod &:*: { if ($($+(%,fc,cod,$2),2)) { notice $nick Fc $+($2,::) $ifmatch } else { msg $chan $2 does not have a Set fc. For them to have one they must type Sadd cod <Fc here> } } ON *:TEXT:Sadd pokemon *:*: { set $+(%,poke,$nick) $2- notice $nick Saved msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Spoke &:*: { if ($($+(%,poke,$2),2)) { notice $nick %1F%02Fc $+($2,::)%1F $ifmatch } else { msg $chan $2 not saved that fc } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ON *:TEXT:Sadd ssbb *:*: { set $+(%,ssbb,$nick) $2- notice $nick Saved msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Sssbb &:*: { if ($($+(%,ssbb,$2),2)) { notice $nick %1F%02Fc $+($2,::)%1F $ifmatch } else { msg $chan $2 not saved that fc } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ON *:TEXT:Sadd mkw *:*: { set $+(%,mkw,$nick) $2- notice $nick Saved msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Smkw &:*: { if ($($+(%,mkw,$2),2)) { notice $nick %1F%02Fc $+($2,::)%1F $ifmatch } else { msg $chan $2 not saved that fc } } ;;;;;;;;;;;;;;;;;;;;;;;;;; ON *:TEXT:Sadd mkd *:*: { set $+(%,mkd,$nick) $2- notice $nick Saved msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Smkd &:*: { if ($($+(%,mkd,$2),2)) { notice $nick %1F%02Fc $+($2,::)%1F $ifmatch } else { msg $chan $2 not saved that fc } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ON *:TEXT:Sadd acww *:*: { set $+(%,acww,$nick) $2- notice $nick Saved msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Sacww &:*: { if ($($+(%,acww,$2),2)) { notice $nick %1F%02Fc $+($2,::)%1F $ifmatch } else { msg $chan $2 not saved that fc } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ON *:TEXT:Sadd accf *:*: { set $+(%,accf,$nick) $2- notice $nick Saved msg $nick $me can enable you to save your gaming codes like call of duty or super smash bros brawl to do this you use a simple command " Sadd <gamename> <fc> " Like this | /msg $nick Sadd cod 123456789012 msg $nick $me supports these games ; accf , ssbb , acww , mkw , mkd , pokemon msg $nick To call these up type S(name) (users name) aka Scod samuel Remember this works in a pm } ON *:TEXT:Saccf &:*: { if ($($+(%,accf,$2),2)) { notice $nick %1F%02Fc $+($2,::)%1F $ifmatch } else { msg $chan $2 not saved that fc } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #toys on
  11. Windows Control Panel,Programas and Games Launcher Autor: Marvi-Konvic .E-Mail:marvi.konvic@gmail.com Web: www.marvi-konvic.co.cc This is free and use it at your own risk. Anything that may happen to your computer is not my problem. The author takes no responsibility for your actions. Description: Launch Programs (Wordpad,Windows Explorer,IE,Paint,Notepad,Command Prompt,WMedia Player...) Games (Solitare,FreeCell,Hearts,Mine Sweeper...) and Windows Control Panel apps such as Accessibility Options,Add or Remove Programs,Internet Options,Display Properties,Sounds and Audio Devices Properties,System Properties,Administrative Tools,Network Connections...Tools such as Task Menager,Diagnostic Tools,Registry Editor,Clipboard Wiewer,Computer Menagment,Disk Menagment,Remote Desktop Connection,On-Screen Keyboard,Magnifier,nslookup,Telnet... and more from your mIRC. Have Fun ;================================================================================================================== ; » Name: Windows Control Panel,Programas and Games Launcher ; » Autor: Marvi-Konvic ; » E-Mail:marvi.konvic@gmail.com ; » Web: www.marvi-konvic.co.cc ; » Server: irc.flywithdream.com ; » Visit: www.ircsvet.com ; » Desc: Program Launcher, Windows Control Panel ; » Size: 8 KB ;================================================================================================================== ; » Tested on Mirc 6.32, Windows XP (Home) sp2 ; » WARNING: Do not change/rip/modify this addon. This is free and use it at your own risk. ; » Anything that may happen to your computer is not my problem. ; » The author takes no responsibility for your actions. ;=========================================================================================================== ;On Load on *:load: { echo -a 04Tnx for using Program Launcher and Windows Conrtol Panel By Marvi-Konvic echo -a 04E-mail: marvi.konvic@gmail.com Web: www.marvi-konvic.co.cc echo -a 04Server: irc.flywithdream.com echo -a 04Visit: www.ircsvet.com } menu menubar,channel,status { Win CPanel and Programs:/prun } alias prun { if ($dialog(prun)) dialog -v prun | else dialog -m prun prun } dialog prun { title "Tools by Marvi-Konvic@www.ircsvet.com" size -1 -1 161 135 option dbu button "Ok", 64, 3 111 70 15, ok link "Marvi-Konvic.co.cc", 65, 84 111 48 8 button "Wordpad", 66, 84 92 70 15 button "Windows Explorer", 68, 3 11 70 15 button "Paint", 69, 3 51 70 15 button "Notepad", 70, 3 31 70 15 button "Volume Control", 71, 84 31 70 15 button "WMedia Player", 72, 84 11 70 15 button "Command Prompt", 77, 3 71 70 15 button "Address book", 79, 84 52 70 15 button "Character Map", 80, 3 91 70 15 button "Calculator", 81, 84 72 70 15 link "www.IRCSvet.com", 228, 84 122 48 8 menu "Menu", 98 item "About", 170, 98 item "Send E-Mail To Autor", 171, 98 item "Visit marvi-konvic.co.cc", 172, 98 item "Visit IRCSet.com", 173, 98 item "Exit", 100, 98, cancel menu "Control Panel", 101 item "System Properties", 102, 101 item "Display Properties", 103, 101 item "Add Remove Programs", 104, 101 item "Date and Time Properties", 105, 101 item "User Accounts", 106, 101 item "Regional and Language Options", 107, 101 item "Internet Properties", 108, 101 item "Network Connections", 109, 101 item "Keyboard Properties", 110, 101 item "Mouse Properties", 112, 101 item "Game Controllers", 111, 101 item "Sounds and Audio Devices Properties", 113, 101 item "Power Options Properties", 114, 101 item "Add Hardware Wizard", 115, 101 item "Accessibility Options", 116, 101 menu "Tools", 139 item "Task Menager", 325, 139 item "Diagnostic Tools", 140, 139 item "Disk Cleanup", 141, 139 item "Disk Defragmenter", 142, 139 item "Registry Editor", 143, 139 item "Indexing Service", 144, 139 item "Clipboard Wiewer", 145, 139 item "Computer Menagment", 146, 139 item "Disk Menagment", 147, 139 item "Event Wiewer", 148, 139 item "IExpress Wizard", 149, 139 item "Remote Desktop Connection", 150, 139 item "Sistem Monitor", 151, 139 item "Services", 152, 139 menu "Accessibility", 153 item "On-Screen Keyboard", 154, 153 item "Magnifier", 155, 153 menu "Network", 156 item "nslookup", 157, 156 item "Telnet", 158, 156 item "Internet Explorer", 159, 156 menu "Games", 160 item "Solitare", 161, 160 item "FreeCell", 162, 160 item "Hearts", 163, 160 item "Mine Sweeper", 164, 160 item "Spider Solitaire", 165, 160 item "Internet Reversi", 166, 160 item "Internet Hearts", 167, 160 item "Internet Backgammon", 168, 160 item "Pinball", 169, 160 } alias prinfo { dialog -m prinfo prinfo } dialog prinfo { title "Launcher Info" size -1 -1 159 70 option dbu button "OK", 325, 80 52 60 10, flat ok cancel text "With addon u can launch Windows games and windos contorl panel. For all information visit: www.marvi-konvic.co.cc or e-mail: marvi.konivc@gmail.com....Have fun", 46, 3 3 153 30 button "Send E-Mail to Autor", 170, 3 37 60 10, flat button "marvi-konvic.co.cc", 171, 80 37 60 10, flat button "Visit: www.ircsvet.com", 172, 3 52 60 10, flat } on 1:dialog:prinfo:sclick:170: { if ($did == 170) { run mailto:marvi.konvic@gmail.com } } on 1:dialog:prinfo:sclick:171: { if ($did == 171) { run http://www.marvi-konvic.co.cc } } on 1:dialog:prinfo:sclick:172: { if ($did == 172) { run http://www.ircsvet.com } } on 1:dialog:prun:sclick:65: { if ($did == 65) { run http://www.marvi-konvic.co.cc } } on 1:dialog:prun:sclick:66: { if ($did == 66) { run wordpad } } on 1:dialog:prun:sclick:68: { if ($did == 68) { run explorer.exe } } on 1:dialog:prun:sclick:69: { if ($did == 69) { run mspaint.exe } } on 1:dialog:prun:sclick:70: { if ($did == 70) { run notepad.exe } } on 1:dialog:prun:sclick:71: { if ($did == 71) { run sndvol32.exe } } on 1:dialog:prun:sclick:72: { if ($did == 72) { run mplayer2.exe } } on 1:dialog:prun:sclick:77: { if ($did == 77) { run cmd.exe } } on 1:dialog:prun:sclick:79: { if ($did == 79) { run wab.exe } } on 1:dialog:prun:sclick:80: { if ($did == 80) { run charmap.exe } } on 1:dialog:prun:sclick:81: { if ($did == 81) { run calc.exe } } on 1:dialog:prun:sclick:224: { if ($did == 224) { cserv } } on 1:dialog:prun:sclick:225: { if ($did == 225) { bserv } } on 1:dialog:prun:sclick:226: { if ($did == 226) { nserv } } on 1:dialog:prun:sclick:227: { if ($did == 227) { mserv } } on 1:dialog:prun:sclick:228: { if ($did == 228) { run http://www.ircsvet.com } } on *:dialog:prun:menu:*: { if ($did == 170) { dialog -m prinfo prinfo } if ($did == 171) { run mailto:marvi.konvic@gmail.com } if ($did == 172) { run http://www.marvi-konvic.co.cc } if ($did == 173) { run http://www.ircsvet.com } if ($did == 100) { dialog -x prun prun } if ($did == 102) { run sysdm.cpl } if ($did == 103) { run control desktop } if ($did == 104) { run appwiz.cpl } if ($did == 105) { run timedate.cpl } if ($did == 106) { run nusrmgr.cpl } if ($did == 107) { run intl.cpl } if ($did == 108) { run inetcpl.cpl } if ($did == 109) { run ncpa.cpl } if ($did == 110) { run control keyboard } if ($did == 111) { run joy.cpl } if ($did == 112) { run control mouse } if ($did == 113) { run mmsys.cpl } if ($did == 114) { run powercfg.cpl } if ($did == 115) { run hdwwiz.cpl } if ($did == 116) { run access.cpl } if ($did == 325) { run taskmgr.exe } if ($did == 140) { run dxdiag } if ($did == 141) { run CLEANMGR.EXE } if ($did == 142) { run dfrg.msc } if ($did == 143) { run regedit.exe } if ($did == 144) { run ciadv.msc } if ($did == 145) { run clipbrd.exe } if ($did == 146) { run compmgmt.msc } if ($did == 147) { run diskmgmt.msc } if ($did == 148) { run eventvwr.exe } if ($did == 149) { run iexpress.exe } if ($did == 151) { run perfmon.exe } if ($did == 152) { run services.msc } if ($did == 154) { run osk.exe } if ($did == 155) { run magnify.exe } if ($did == 157) { run nslookup.exe } if ($did == 158) { run telnet.exe } if ($did == 159) { run iexplore.exe } if ($did == 161) { run sol.exe } if ($did == 162) { run freecell.exe } if ($did == 163) { run mshearts.exe } if ($did == 164) { run winmine.exe } if ($did == 165) { run spider.exe } if ($did == 166) { run Rvsezm.exe } if ($did == 167) { run hrtzzm.exe } if ($did == 168) { run bckgzm.exe } if ($did == 169) { run pinball.exe } }
  12. chain

    Family Feud

    My first script on hawkee 😄 *If anyone has any questions I can be found on the gamesurge network, usually with the username tv3636 (and in the channel #slapchop always) This allows a channel to play the classic gameshow Family Feud! How to play: Question is asked, and a set number of answers from 1-8 are given (from a txt file in the format Question*Answer1-Answer2-Answer3-Answer4-Answer5-Answer6-Answer7-Answer8) Points are awarded each time somebody answers a question Each question (round) ends after either 60 seconds or when all answers are found Here are the general questions I have compiled so far: http://www.mediafire.com/file/dkdzkdyfmwz/FamFeud.txt Currently 900 questions! I will update that soon and hopefully have over 1,000 starter questions. The .txt file goes in the same folder the script goes into, the mIRC Application Data folder. Thank you for checking it out! Please comment if you have criticism, a suggestion, a compliment, a request, etc. Updates: February 4th, 2009 Update 1.1: -Changed all variable names and removed "unsetall". Now only Family Feud related variables are removed. -Made all messages red for easy distinction between bot text and others' text -Removed unnecessary slashes from code February 17th, 2008 Update 1.2: -Added support for 1-8 answers rather than only 8 (and it is easily modifiable if 9 or 10 answers are needed) -Different color text added to distinguish certain messages -Currently adding 1000+ general questions to my txt file which I will upload soon to allow people to have a good amount of starting questions. -Added support for in-game nick changes so that the high scores/scores will correctly change. February 19th, 2008 Update 1.3: -Added a 900 question .txt file for people to start with -Added a message at the beginning of the question saying how many answers there are for the question -Added a message 40 seconds after each question telling how many/which answers remain Later that day 😛 Update 1.4: -Added a menu with start, stop, and channel setting features -Added a channel setting feature and fixed a major bug Note: the game will only run in the channel you set it for February 23rd Update 1.5: -Added .'s to timers to remove status window notifications every question February 25th Update 1.6: -Removed top3, instead added !scores which lists all scores of people in the channel -Added score message between every question -Removed certain now unnecessary bits of code -Added score message after each question February 28th Update 1.7: -Added a round # feature to let users choose the number of rounds for the game (!start unlimited or just plain !start for a regular game) -Added a quick help message on the commands at the beginning of the snippet in case anyone needs an explanation. Feedback is very much appreciated, thank you! ;Family Feud Script Version 1.7 by tv3636 ;Runs a channel wide game of Family Feud with questions and answers specified in a txt file (Default .txt file name is FamFeud.txt) ;For update log check http://www.hawkee.com/snippet/5714/ ;February 28th, 2009 ;Enjoy :D /* Commands: !start number ------------- Starts the game "!start 1" starts a 1 round game, "!start unlimited or !start" starts an unlimited game ------------- !stop ------------- Stops the game ------------- !score ------------- Notices a user his/her score ------------- !scores ------------- Messages the scores to the channel (Also messaged at the end of each round) */ ;Reads from a text file and grabs a random line's Question and answers in the format: Question*Answer1-Answer2-Answer3-Answer4-Answer5-Answer6-Answer7-Answer8 on *:LOAD:/FFsetchan $?="Type the name of the channel you would like Family Feud to be active in (Including #)" menu nicklist,channel,status,menubar,query { Family Feud .$iif(%FF.on != 2,Start):/FFStart $me $chan $?="How many rounds? For unlimited rounds say unlimited." .$iif(%FF.on == 2,Stop):/FFStop $me $chan .Set Family Feud Channel:/FFsetchan $?="Type the name of the channel you would like Family Feud to be active in (Including #)" } alias FFsetchan { set %chanFF $1 } alias question { set %FF.line $read(FamFeud.txt) set %FF.num $pos(%FF.line, *, 1) set %FF.length $len(%FF.line) set %FF.numA %FF.length - %FF.num set %FF.numQ %FF.num - 1 set %FF.dashes $count(%FF.line, -) set %FF.answers $right(%FF.line, %FF.numA) set %FF.question $left(%FF.line, %FF.numQ) set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a1 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) if ( %FF.dashes > 0 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a2 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } if ( %FF.dashes > 1 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a3 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } if ( %FF.dashes > 2 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a4 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } if ( %FF.dashes > 3 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a5 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } if ( %FF.dashes > 4 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a6 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } if ( %FF.dashes > 5 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a7 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } if ( %FF.dashes == 0 ) { set %FF.a1 %FF.answers } if ( %FF.dashes == 1 ) { set %FF.a2 %FF.answers } if ( %FF.dashes == 2 ) { set %FF.a3 %FF.answers } if ( %FF.dashes == 3 ) { set %FF.a4 %FF.answers } if ( %FF.dashes == 4 ) { set %FF.a5 %FF.answers } if ( %FF.dashes == 5 ) { set %FF.a6 %FF.answers } if ( %FF.dashes == 6 ) { set %FF.a7 %FF.answers } if ( %FF.dashes == 7 ) { set %FF.a8 %FF.answers } if ( %FF.dashes > 7 ) { set %FF.numcom $pos(%FF.answers, -, 1) - 1 set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1) set %FF.a8 $left(%FF.answers, %FF.numcom) set %FF.answers $right(%FF.answers, %FF.numcom2) } inc %FF.dashes ;I was having issues with my other answer variables and timers so I just made a second set for the check alias. set %FF.answerz 0 set %FF.a12 %FF.a1 set %FF.a22 %FF.a2 set %FF.a32 %FF.a3 set %FF.a42 %FF.a4 set %FF.a52 %FF.a5 set %FF.a62 %FF.a6 set %FF.a72 %FF.a7 set %FF.a82 %FF.a8 if (%FF.roundsplayed != $null) { msg %chanFF 10Round %FF.roundsplayed / %FF.rounds $+ 8 $chr(124) $+ $chr(124) 10Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ):4 %FF.question } else { msg %chanFF 10Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ):4 %FF.question } msg %chanFF 10There are4 %FF.dashes 10answers! } alias game { if (%FF.roundsplayed == $null || %FF.roundsplayed <= %FF.rounds) { question .timer1 1 60 game2 .timer3 1 40 remaining } else { FFstop } } alias game2 { if ( %FF.dashes == 1 ) { msg %chanFF 10That's it! The answer was:4 %FF.a12 } if ( %FF.dashes == 2 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 and %FF.a22 } if ( %FF.dashes == 3 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 $+ , %FF.a22 $+ , and %FF.a32 } if ( %FF.dashes == 4 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , and %FF.a42 } if ( %FF.dashes == 5 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , and %FF.a52 } if ( %FF.dashes == 6 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , %FF.a52 $+ , and %FF.a62 } if ( %FF.dashes == 7 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , %FF.a52 $+ , %FF.a62 $+ , and %FF.a72 } if ( %FF.dashes == 8 ) { msg %chanFF 10That's it! The answers were (in order):4 %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , %FF.a52 $+ , %FF.a62 $+ , %FF.a72 $+ , and %FF.a82 } buildscores if (%FF.roundsplayed != $null) { inc %FF.roundsplayed } unset %FF.a* if (%FF.roundsplayed > %FF.rounds) { FFstop } if (%FF.on == 2) { msg %chanFF %FF.scoreoutput } if (%FF.on == 2) { .timer2 1 10 game } ;7 second delay between questions. } alias remaining { set %FF.remain 10The remaining answers are:4 if ( %FF.a1 != $null ) { set %FF.remain %FF.remain #1 } if ( %FF.a2 != $null ) { set %FF.remain %FF.remain #2 } if ( %FF.a3 != $null ) { set %FF.remain %FF.remain #3 } if ( %FF.a4 != $null ) { set %FF.remain %FF.remain #4 } if ( %FF.a5 != $null ) { set %FF.remain %FF.remain #5 } if ( %FF.a6 != $null ) { set %FF.remain %FF.remain #6 } if ( %FF.a7 != $null ) { set %FF.remain %FF.remain #7 } if ( %FF.a8 != $null ) { set %FF.remain %FF.remain #8 } msg %chanFF %FF.remain } on *:TEXT:!start*:%chanFF:{ if ($2 != $null) { FFstart $nick $chan $2 } else { FFstart $nick $chan unlimited } } alias FFstart { if ( %FF.on != 2 ) { msg %chanFF 10A game has been started by $1 set %FF.answerz 0 set %FF.on 2 set %FF.roundsplayed 1 if ($3 == unlimited) { unset %FF.roundsplayed } else { set %FF.rounds $3 } game } else { .notice $1 The game's already going, maybe you should try answering some questions now. } } on *:TEXT:!stop:%chanFF:{ FFstop $nick $chan } alias FFstop { if ( %FF.on == 2 ) { if ($1 != $null) msg %chanFF 10Game stopped by $1 $+ . else msg %chanFF 10Game over! buildscores msg %chanFF %FF.scoreoutput .timer1 off .timer2 off .timer3 off unset %FF.* } else { .notice $1 Stop what? } } on *:TEXT:!score:%chanFF:{ if ( %FF.on == 2 && %chanFF == $chan ) { if ( %FF.score. [ $+ [ $nick ] ] != $null ) { .notice $nick Your score is %FF.score. [ $+ [ $nick ] ] $+ . } else { .notice $nick Your score is 0. } } else { .notice $nick There's no game going on, dumbass. } } ;Text events for all 8 answers on *:TEXT:%FF.a1:%chanFF:{ msg %chanFF 10Survey says,4 50 points10!4 $nick 10got the 4#1 10answer,4 %FF.a1 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 50 unset %FF.a1 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a2:%chanFF:{ msg %chanFF 10Survey says,4 35 points10!4 $nick 10got the 4#2 10answer,4 %FF.a2 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 35 unset %FF.a2 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a3:%chanFF:{ msg %chanFF 10Survey says,4 28 points10!4 $nick 10got the 4#3 10answer,4 %FF.a3 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 28 unset %FF.a3 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a4:%chanFF:{ msg %chanFF 10Survey says,4 20 points10!4 $nick 10got the 4#4 10answer,4 %FF.a4 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 20 unset %FF.a4 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a5:%chanFF:{ msg %chanFF 10Survey says,4 15 points10!4 $nick 10got the 4#5 10answer,4 %FF.a5 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 15 /unset %FF.a5 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a6:%chanFF:{ msg %chanFF 10Survey says,4 10 points10!4 $nick 10got the 4#6 10answer,4 %FF.a6 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 10 unset %FF.a6 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a7:%chanFF:{ msg %chanFF 10Survey says,4 8 points10!4 $nick 10got the 4#7 10answer,4 %FF.a7 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 8 unset %FF.a7 set %FF.answerz %FF.answerz + 1 check %FF.answerz } on *:TEXT:%FF.a8:%chanFF:{ msg %chanFF 10Survey says,4 5 points10!4 $nick 10got the 4#8 10answer,4 %FF.a8 $+ 10! inc %FF.score. [ $+ [ $nick ] ] 5 unset %FF.a8 set %FF.answerz %FF.answerz + 1 check %FF.answerz } alias buildscores { set %FF.count 0 set %FF.added 0 set %FF.totalnicks $nick(%chanFF,0,a) set %FF.highest 0 set %FF.highestnick $me set %FF.x $var(%FF.score.*, 0) set %FF.scoreoutput 10Scores: while (%FF.added < %FF.x) { while (%FF.count <= %FF.totalnicks) { set %FF.testnick $nick(%chanFF,%FF.count,a) if (%FF.score. [ $+ [ %FF.testnick ] ] != $null) && (%FF.score. [ $+ [ %FF.testnick ] ] >= %FF.highest) && (%FF.testnick !isin %FF.scoreoutput) { set %FF.highest %FF.score. [ $+ [ %FF.testnick ] ] set %FF.highestnick %FF.testnick } inc %FF.count } if (%FF.highest != 0) { set %FF.scoreoutput %FF.scoreoutput 04 $+ %FF.highestnick $+ 10:04 %FF.highest 08 $+ $chr(124) } set %FF.highest 0 set %FF.highesttnick $me inc %FF.added set %FF.count 0 } set %FF.chop $calc($len(%FF.scoreoutput) - 1) set %FF.scoreoutput $left(%FF.scoreoutput,%FF.chop) if (%FF.scoreoutput == 10Scores:) set %FF.scoreoutput 10Nobody has any points! } ;Checks to see if all answers have been said before time limit is up alias check { if ( $1 == %FF.dashes ) { .timer1 off .timer3 off game2 } } ;Accounts for nickname changes mid-game. on *:NICK:{ if ( %FF.score. [ $+ [ $nick ] ] != $null ) { set %FF.score. [ $+ [ $newnick ] ] %FF.score. [ $+ [ $nick ] ] unset %FF.score. [ $+ [ $nick ] ] } } ;Notices the scores of players in the channel in order to the person that said !scores on *:TEXT:!scores:%chanFF:{ buildscores .notice $nick %FF.scoreoutput } ;If you have another feature you would like to see, let me know and I'll add it if possible! FamFeud.txt
  13. In this game, you are the red dot and you need be fast to fall as low as possible. Some kind of powerups are there to help you: 3 purple = 2 holes per line for 6 seconds 3 blue = a pause of 5 seconds 2 green = faster for 5 seconds 2 orange = no floor for 8 seconds 1 grey = smaller hole for 6 seconds /picwin to run, I dare you to play only once. alias picwin { if ($1 == again) { .timerpicwin* off | hfree -w picwin | initgame | gamestart } elseif ($1 == clear) { .timerpicwin* off | hfree -w picwin | window -c @picwinbuf } else { initwin | initgame | gamestart } } alias -l initwin { window -fpdoCB @picwin -1 -1 200 300 window -fpdCBh @picwinbuf -1 -1 200 300 } alias -l initgame { hadd -m picwin x 100 hadd picwin y 10 hadd picwin inair 1 hadd picwin scroll 0 hadd picwin maxscroll 40 drawrect -fr @picwinbuf 16777215 0 0 0 200 300 } alias -l gamestart { .timerpicwindec 0 7 hdec picwin maxscroll 1 $(|) var % $+ r $!r(0,100) $(|) hadd picwin bonus $!iif(%r isnum 0-24,1,$iif(%r isnum 25-49,4,$iif(%r isnum 50-69,2,$iif(%r isnum 70-89,3,5)))) generate&scroll 3 hadd picwin start $ticks mainloop } alias -l bonus { if ($hget(picwin,bonus)) { drawdot -r @picwinbuf $gettok(10223772 64512 16515072 13816530 32764,$v1,32)) 5 $calc($1 + $iif($hget(picwin,hole),7,12)) 295 hdel picwin bonus } } alias -l generate&scroll { if (!$hget(picwin,noscroll)) { :start if (!$hget(picwin,scroll)) && ($r(0,$iif($hget(picwin,hole),190,180)) != $null) { var %v $v1,%r $r(0,$iif($hget(picwin,hole),190,180)) drawline -r @picwinbuf 0 3 0 290 200 290 drawline -r @picwinbuf 16777215 3 %v 290 $calc(%v + $iif($hget(picwin,hole),10,20)) 290 if ($hget(picwin,double)) drawline -r @picwinbuf 16777215 3 %r 290 $calc(%r + $iif($hget(picwin,hole),10,20))) 290 bonus %v } drawscroll @picwinbuf 0 $iif($1,-40,-1) 0 0 200 300 if ($1) { tokenize 32 $calc($1 -1) | goto start } if (!$hget(picwin,inair)) && ($hget(picwin,y) > 0) hdec picwin y 1 hadd picwin scroll $iif($hget(picwin,scroll) >= $hget(picwin,maxscroll),0,$calc($v1 +1)) } .timerpicwingen -ho 1 0 generate&scroll } alias -l mainloop { if ($hget(picwin,y) == 0) { if ($input(Score: $calc(($ticks - $hget(picwin,start)) / 1000) $+ $crlf $+ Play again ?,ys,@picwin,Picwin)) picwin again else picwin clear return } var %s $gettok($hget(picwin,stack),1,32),%y $hget(picwin,y) + $iif($hget(picwin,inair),2,0),%x $hget(picwin,x) $iif(%s,$iif($v1 == 37,-,+) $iif($hget(picwin,boost),5,3)) var %x = $iif(%x < 5,5,$iif(%x > 198,198,%x)) if ($getdot(@picwinbuf,$calc(%x - 3),%y)) || ($hget(picwin,nofloor)) hadd picwin inair 1 else hdel picwin inair if ($hget(picwin,inair)) && ($getdot(@picwinbuf,$calc(%x - 3),$calc(%y - 3))) && ($v1 != 16777215) { var %v $v1 drawreplace -r @picwinbuf %v 16777215 $calc(%x - 15) $calc(%y - 15) 50 50 hinc picwin bonus $+ %v var %n $hget(picwin,bonus $+ %v) if (%v == 10223772) && (%n == 2) hadd -u6 picwin double 1 $iif(del,) elseif (%v == 16515072) && (%n == 3) hadd -u5 picwin noscroll 1 $iif(del,) elseif (%v == 64512) && (%n == 2) hadd -u5 picwin boost 1 $iif(del,) elseif (%v == 32764) && (%n == 3) hadd -u5 picwin nofloor 1 $iif(del,) elseif (%v == 13816530) && (%n == 1) hadd -u6 picwin hole 1 $iif(del,) if ($v1 == del) hdel picwin bonus $+ %v } hadd picwin x %x if (%y > 288) && (!$hget(picwin,pro)) { hadd -u3 picwin pro 1 | var %r $r(0,100) | hadd picwin bonus $iif(%r isnum 0-34,1,$iif(%r isnum 35-69,2,$iif(%r isnum 70-89,3,5)))) } hadd picwin y $iif(%y > 288,288,%y) drawcopy -n @picwinbuf 0 0 200 300 @picwin 0 0 drawdot -nr @picwin 255 5 $hget(picwin,x) $hget(picwin,y) drawdot @picwin titlebar @picwin $round($calc(($ticks - $hget(picwin,start)) / 1000),1) .timerpicwinmain -ho 1 10 mainloop } on *:close:@picwin:picwin clear on *:keydown:@picwin:37,39:tokenize 32 $hget(picwin,stack) | hadd picwin stack $keyval $iif($keyval != $1,$1,$2) on *:keyup:@picwin:37,39:hadd picwin stack $remtok($hget(picwin,stack),$keyval,32)
  14. Put this in a bot's remotes. Choose whichever one you like. The first one has 10 numbers, the second has 50, the third has 100, and the fourth has 1000. on *:TEXT:!nummatch*:{ set %tomatch $rand(1,10) set %trymatch $2 msg $chan The number you chose was: %trymatch msg $chan The number to match was %tomatch if (%trymatch == %tomatch) { msg $chan Congradulations $nick Your number: %trymatch matched the number chosen: %tomatch. You win! } } on *:TEXT:!nummatch*:{ set %tomatch $rand(1,50) set %trymatch $2 msg $chan The number you chose was: %trymatch msg $chan The number to match was %tomatch if (%trymatch == %tomatch) { msg $chan Congradulations $nick Your number: %trymatch matched the number chosen: %tomatch. You win! } } on *:TEXT:!nummatch*:{ set %tomatch $rand(1,100) set %trymatch $2 msg $chan The number you chose was: %trymatch msg $chan The number to match was %tomatch if (%trymatch == %tomatch) { msg $chan Congradulations $nick Your number: %trymatch matched the number chosen: %tomatch. You win! } } on *:TEXT:!nummatch*:{ set %tomatch $rand(1,1000) set %trymatch $2 msg $chan The number you chose was: %trymatch msg $chan The number to match was %tomatch if (%trymatch == %tomatch) { msg $chan Congradulations $nick Your number: %trymatch matched the number chosen: %tomatch. You win! } }
  15. Common request: Simple dice games. These mIRC dice scripts allow you to roll a 100-sided die against a host or have a dice duel against an opponent by rolling two six-sided dice each. Syntax: !(2-9)dd nick1 nick2 bet_amount !stopdd nick !55x2 nick bet_amount 55x2 games are always against the host. The bettor rolls over 55 to win 2x the bet, and under 56 to lose it. Dice duel - Two players pay the host and then roll against each other. The winner receives the pot from the host. (2-9) - Optionally specify the number of dice for the dice duel. alias -l whitelist return #chan1,#chan2,#chanN | ;Set allowed channels here. alias -l mynicks return nick1,nick2,nick3 | ;Set the nicknames this script can be used with in the same format as the channel list alias -l canhost return ohv | ;Who can host: 'ohvr' (op, halfop, voice, regular) are the only valid options alias -l dd_pot_multiplier return 1.9 | ;[Host's cut] - Winner gets (bet_amount * pot_multiplier) ;************************************************************** ;* Written by Travis (Yawhatnever) - irc.swiftirc.net #mSL * ;* This script goes in an empty remotes file. * ;************************************************************** on *:text:$($allowed):#:noop on $*:text:/^[!@.]55x2\b/Si:$($whitelist):{ if (!$ishost($nick)) msg.format ! $nick # [Error] You must be a host to use that command. elseif (!$3) msg.format ! $nick # [Error] Syntax: &c3;!55x2/dice &norm;<&c1;Name of player&norm;> <&c4;Amount of bet&norm;> elseif ($2 == $nick) msg.format ! $nick # [Error] You can't bet against yourself! elseif ($2 == $me) msg.format ! $nick # [Error] You can't roll against me! elseif ($2 !ison #) msg.format ! $nick # [Error] Player must be on the channel. elseif (!$isformat($3)) msg.format ! $nick # [Error] Invalid bet amount. Input must be a cash amount in GP/K/M/B. else { var %roll $rand(1, 100),%w $iif(%roll < 56, $nick, $2) msg.format @ $nick # [55x2]&c2; $nick &norm;vs&c1; $2 &norm;- Pot:&c4; $pot($3).full msg.format @ $nick # [55x2]&c2; $nick &norm;rolled a&c5; %roll &norm;on the percentile die! msg.format @ $nick # [55x2]&c1; $2 $iif($2 == %w, 03won, 04lost) &norm;the&c4; $iif($2 == %w, $pot($3).full pot,$kmb.to($kmb.from($3)) bet) &norm;as&c2; $nick &norm;rolled $iif($2 == %w, 03over, 04under) &norm;55. } } on $*:text:/^[!@.]([2-9])?dd\b/Si:$($whitelist):{ var %dice $iif($regml(1), $v1, 2) if (!$ishost($nick)) msg.format ! $nick # [Error] You must be a &c2;host &norm;to use that command. elseif ($2 == $3) || ($dd_info($2)) || ($dd_info($3)) || (!$4) msg.format ! $nick # [Error] Syntax: &c3;!dd &norm;<&c1;Player1&norm;> <&c1;Player2&norm;> <&c4;Amount of Pot&norm;> $!(|) Both players must be on the channel and may only be in one duel at a time.&c2; $iif($dd_info($2).vs || $dd_info($3).vs,&c1; $+ $ifmatch &norm;is already in a duel with&c1; $dd_info($ifmatch).vs $+ &norm;.) elseif ($2 !ison #) || ($3 !ison #) msg.format ! $nick # [Error]&c1; $v1 &norm;is not on the channel. elseif ($2 == $me) || ($3 == $me) msg.format ! $nick # [Error] I can't enter a duel! elseif (!$isformat($4)) msg.format ! $nick # [Error] Invalid bet amount. Input must be a cash amount in GP/K/M/B. else { inc -e %dd_id set -e %dd_ $+ # $+ $2 $+($3, /, $kmb.from($4), /, $nick, /, %dice, /, %dd_id) set -e %dd_ $+ # $+ $3 $+($2, /, $kmb.from($4), /, $nick, /, %dice, /, %dd_id) msg.format @ $nick # [Dice Duel]&c1; $2 &norm;vs.&c1; $3 &norm;- Pot:&c4; $dd_info($2).pot &norm;- Please type&c3; !roll &norm;now! .timerdd_end $+ $dd_info($2).id -o 1 600 dd_end $safe(#) $2 Duel between&c1; $2 &norm;and&c1; $dd_info($2).vs &norm;has been forcibly ended after 10 minutes of inactivity &c4;[[ Hosted By&c2; $dd_info($2).host &c4;]] } } on $*:text:/^[!@.]roll\b/Si:$($whitelist):{ if (!$dd_info($nick)) msg.format ! $nick # [Error] You are not in a dice duel. elseif ($dd_info($nick).roll) msg.format ! $nick # [Error] You have already rolled! It's &c1; $+ $dd_info($nick).vs $+ &norm;'s turn. else { set %dd_ $+ # $+ $nick $instok($dd_info($nick), $regsubex($left($str(@ -, $dd_info($nick).dice), -1), /@/g,$chr(32) $+ $die), 6, 47) msg.format @ $nick # [Dice Duel]&c1; $nick &norm;rolled&c5; $dd_info($nick).roll &norm;(&c5; $+ $dd_info($nick).rollsum $+ &norm;) on $replace($dd_info($nick).dice, 2, two, 3, three, 4, four, 5, five, 6, six, 7, seven, 8, eight, 9, nine) 6-sided dice. if ($dd_info($dd_info($nick).vs).rollsum && $dd_info($nick).rollsum) { if ($dd_info($dd_info($nick).vs).rollsum == $dd_info($nick).rollsum) { msg.format @ $nick # [Dice Duel] Duel between&c1; $dd_info($nick).vs &norm;and&c1; $nick &norm;was a draw, both having rolled&c5; $dd_info($nick).rollsum $+ &norm;. Please type &c3;!roll &norm;again. set -e %dd_ $+ # $+ $dd_info($nick).vs $deltok($dd_info($dd_info($nick).vs), 6-, 47) set -e %dd_ $+ # $+ $nick $deltok($dd_info($nick), 6-, 47) } else { var %w $iif($dd_info($dd_info($nick).vs).rollsum > $dd_info($nick).rollsum, $dd_info($nick).vs, $nick) dd_end # $nick &c1; $+ %w &norm;wins the&c4; $dd_info($nick).pot &norm;Pot with rolls:&c5; $dd_info(%w).rollsum - $dd_info($dd_info(%w).vs).rollsum &norm;against&c1; $dd_info(%w).vs &c4;[[ Hosted By&c2; $dd_info($nick).host &c4;]] } } } } on $*:text:/^[!@.](ddend|(stop|end)dd)\b/Si:$($whitelist):{ if (!$2) msg.format ! $nick # [Error] No player entered. elseif (!$dd_info($2)) msg.format ! $nick # [Error]&c1; $2 &norm;is not in a duel. elseif ($nick != $dd_info($2).host) && ($dd_info($2).host ison #) msg.format ! $nick # [Error] Only the host (&c2; $v1 &norm;) can stop this dice duel. elseif ($ishost($nick)) && ($dd_info($2)) { dd_end # $2 Duel between&c1; $2 &norm;and&c1; $dd_info($2).vs &norm;has been forcibly ended by&c2; $nick $+ &norm;. } } alias -l msg.format { ;!@. $nick #channel [title] <msg> ;c1 nicks ;c2 hosts ;c3 commands ;c4 pot ;c5 rolls if ($left($1, 1) == @) var %out msg $safe($3) else var %out notice $2 inc -z %msgs .timer 1 %msgs %out $replacex($regsubex($4-,/^\[([^]]+)\]/,**°°°04\t7«&norm;), &c1;, 10, &c2;, 02, &c3;, 04, &c4;, 07, &c5;, 06,[b], $chr(2), **, $chr(2), &norm;, $chr(15)) } alias -l safe return $!decode( $encode($1-, m) ,m) alias -l allowed if (!$istok($mynicks, $me, 44)) return * alias -l isformat if ($regex($1, /^(?:[1-9](?:\d*)?(?:\.\d+)?[mkb]|[1-9]\d*gp)$/Si)) return $true alias -l ishost if ($nick(#, $1, $canhost)) return $true alias -l dd_info { /* * $dd_info([#chan,]nick).prop * Properties: vs, bet, host, dice, id, rolls, rollsum, pot */ ;nick2/bet/host/dice/id/rolls if ($regex($1, /^#/)) var %chan $1, %nick $2 else var %chan #, %nick $1 if (!$prop) return $($+(%, dd_, %chan, %nick), 2) tokenize 47 $($+(%, dd_, %chan, %nick), 2) if ($prop == vs) return $1 elseif ($prop == bet) return $2 elseif ($prop == host) return $3 elseif ($prop == dice) return $4 elseif ($prop == id) return $5 elseif ($prop == roll) return $6 elseif ($prop == rollsum) return $calc($replace($6, -, +)) elseif ($prop == pot) return $pot($2) } alias -l pot return $kmb.to($ceil($calc($kmb.from($1) * $iif($prop == full, 2, $dd_pot_multiplier)))) alias -l die return $rand(1,6) alias -l dd_end { /* * /dd_end #channel nick [message] */ if ($3) msg.format @ $2 $1 [Dice Duel] $3- .timerdd_end $+ $dd_info($1, $2).id off unset %dd_ $+ $1 $+ $dd_info($1,$2).vs unset %dd_ $+ $1 $+ $2 } alias -l kmb.from return $regsubex($remove($1,$chr(44)),/([\d.]+)([kmbt]|gp)/Si,$calc(\1 * 10 ^ (3 * $pos(kmbt,\2)))) alias -l kmb.to { while (. !isin $1) && ($2 != 4) && ($1 >= 1000) tokenize 32 $calc($1 /$v2) $calc(1+$2) return $1 $+ $gettok(GP K M B T, $calc(1+$2), 32) }
  16. i folks... been trying a few rpg type games, and folks suggested to make a way so they can add their own monsters in. This script will add, list totals, and delete entries from monster txt files , that IRC rpg games typically use. You may have to edit the script depending on how many levels there are in your rpg game, and you may also have to edit the prefix of all the monster text files for each level .. (the rpg game i use has the monster text files as monster.txt, monster2.txt.. etc) You may also want to add in some feature that only ops can add/del .. but for me its not necessary I must also thank a few people around irc that gave some pointers and a little help while putting this together. you know who you all are.. and thank you so much for your time. The Monster Manager Commands COMMANDS MENU IN CHAN !m-help ADD A MONSTER TO A LEVEL !m-lv(level number)-add (Your Monster) CHECK HOW MANY MONSTERS ARE IN A LEVEL !m-lv(level number) CHECK A SPECIFIC MONSTER IN A LEVEL !m-lv(level number) (number) CHECK TOTAL MONSTERS FOR ALL LEVELS !m-total DELETE MONSTER FROM A LEVEL !m-lv(level number)-del (number) enjoy ;;PAN'S MONSTER MANGAER ------------------------------------------------------ on *:text:!m-help:#:{ msg $chan Pan's Monster Manager: To Add: 12!m-lv(level number)-add (Your Monster) - To check number of monsters in each Level: 12!m-lv(level number) - To view individual monsters: 12!m-lv(level number) (number) - To View total enemy strength: 12!m-total - To Delete Monster: 12!m-lv(level number)-del (number) - 4"Try not delete other peoples monsters" } ;;LEVEL 1 -------------------------------------------------------------------- on *:text:!m-lv1-add *:#:{ write monsters.txt $2- msg # 12 $+ $2- has been added to the Level 1 Monsters list $nick $+ . Thy epic journey awaits thee. } on *:text:!m-lv1:#:{ msg $chan There are a total of12 $lines(monsters.txt) Level 1 Monsters. } on *:text:!m-lv1-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters.txt, n, $2)) was deleted! write -dl $+ $2 monsters.txt } } ;;LEVEL 2 -------------------------------------------------------------------- on *:text:!m-lv2-add *:#:{ write monsters2.txt $2- msg # 12 $+ $2- has been added to the Level 2 Monsters list $nick $+ . May good fortune be with thee on thy quest. } on *:text:!m-lv2:#:{ msg $chan There are a total of12 $lines(monsters2.txt) Level 2 Monsters. } on *:text:!m-lv2-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters2.txt, n, $2)) was deleted! write -dl $+ $2 monsters2.txt } } ;;LEVEL 3 -------------------------------------------------------------------- on *:text:!m-lv3-add *:#:{ write monsters3.txt $2- | .msg $chan 12 $+ $2- has been added to the Level 3 Monsters list $nick $+ . Glory awaits thee. } on *:text:!m-lv3:#:{ msg $chan There are a total of12 $lines(monsters3.txt) Level 3 Monsters. } on *:text:!m-lv3-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters3.txt, n, $2)) was deleted! write -dl $+ $2 monsters3.txt } } ;;LEVEL 4 -------------------------------------------------------------------- on *:text:!m-lv4-add *:#:{ write monsters4.txt $2- msg # 12 $+ $2- has been added to the Level 4 Monsters list $nick $+ . Journey forth into the darkness with pride and haste.. } on *:text:!m-lv4:#:{ msg $chan There are a total of12 $lines(monsters4.txt) Level 4 Monsters. } on *:text:!m-lv4-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters4.txt, n, $2)) was deleted! write -dl $+ $2 monsters4.txt } } ;;LEVEL 5 -------------------------------------------------------------------- on *:text:!m-lv5-add *:#:{ write monsters5.txt $2- msg # 12 $+ $2- has been added to the Level 5 Monsters list $nick $+ . Elders shall speak of thy honorable deeds. } on *:text:!m-lv5:#:{ msg $chan There are a total of12 $lines(monsters5.txt) Level 5 Monsters. } on *:text:!m-lv5-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters5.txt, n, $2)) was deleted! write -dl $+ $2 monsters5.txt } } ;;LEVEL 6 -------------------------------------------------------------------- on *:text:!m-lv6-add *:#:{ write monsters6.txt $2- msg # 12 $+ $2- has been added to the Level 6 Monsters list $nick $+ . Many bards shall play, honoring thy glorious victories. } on *:text:!m-lv6:#:{ msg $chan There are a total of12 $lines(monsters6.txt) Level 6 Monsters. } on *:text:!m-lv6-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters6.txt, n, $2)) was deleted! write -dl $+ $2 monsters6.txt } } ;;LEVEL 7 -------------------------------------------------------------------- on *:text:!m-lv7-add *:#:{ write monsters7.txt $2- msg # 12 $+ $2- has been added to the Level 7 Monsters list $nick $+ . May the free folk to come speak of thy heroism. } on *:text:!m-lv7:#:{ msg $chan There are a total of12 $lines(monsters7.txt) Level 7 Monsters. } on *:text:!m-lv7-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters7.txt, n, $2)) was deleted! write -dl $+ $2 monsters7.txt } } ;;LEVEL 8 -------------------------------------------------------------------- on *:text:!m-lv8-add *:#:{ write monsters8.txt $2- msg # 12 $+ $2- has been added to the Level 8 Monsters list $nick $+ . Thy place within history awaits thee. } on *:text:!m-lv8:#:{ msg $chan There are a total of12 $lines(monsters8.txt) Level 8 Monsters. } on *:text:!m-lv8-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters8.txt, n, $2)) was deleted! write -dl $+ $2 monsters8.txt } } ;;LEVEL 9 -------------------------------------------------------------------- on *:text:!m-lv9-add *:#:{ write monsters9.txt $2- msg # 12 $+ $2- has been added to the Level 9 Monsters list $nick $+ . The Holy Scriptures will proclaim thy divinity. } on *:text:!m-lv9:#:{ msg $chan There are a total of12 $lines(monsters9.txt) Level 9 Monsters. } on *:text:!m-lv9-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters9.txt, n, $2)) was deleted! write -dl $+ $2 monsters9.txt } } ;;LEVEL 10 -------------------------------------------------------------------- on *:text:!m-lv10-add *:#:{ write monsters10.txt $2- msg # 12 $+ $2- has been added to the Level 10 Monsters list $nick $+ .Now go!, once more unto the breach!. } on *:text:!m-lv10:#:{ msg $chan There are a total of12 $lines(monsters10.txt) Level 10 Monsters. } on *:text:!m-lv10-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters10.txt, n, $2)) was deleted! write -dl $+ $2 monsters10.txt } } ;;LEVEL 11 -------------------------------------------------------------------- on *:text:!m-lv11-add *:#:{ write monsters11.txt $2- msg # 12 $+ $2- has been added to the Level 11 Monsters list $nick $+ . May good fortune be upon thy quest where so many nobel warriors have failed before thee. } on *:text:!m-lv11:#:{ msg $chan There are a total of12 $lines(monsters11.txt) Level 11 Monsters. } on *:text:!m-lv11-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters11.txt, n, $2)) was deleted! write -dl $+ $2 monsters11.txt } } ;;LEVEL 12 -------------------------------------------------------------------- on *:text:!m-lv12-add *:#:{ write monsters12.txt $2- msg # 12 $+ $2- has been added to the Level 12 Monsters list $nick $+ . 4May all the Gods have mercy on thy soul!! } on *:text:!m-lv12:#:{ msg $chan There are a total of12 $lines(monsters12.txt) Level 12 Monsters. } on *:text:!m-lv12-del *:#:{ if ($2 isnum) { msg $chan $qt($read(monsters12.txt, n, $2)) was deleted! write -dl $+ $2 monsters12.txt } } ;;CHECK MONSTERS -------------------------------------------------------------------- on *:text:!m-lv1 *:#:if ($2 isnum) msg $chan $read(monsters.txt,$2) - Total Lv2 Monsters:12 $lines(monsters.txt) on *:text:!m-lv2 *:#:if ($2 isnum) msg $chan $read(monsters2.txt,$2) - Total Lv2 Monsters:12 $lines(monsters2.txt) on *:text:!m-lv3 *:#:if ($2 isnum) msg $chan $read(monsters3.txt,$2) - Total Lv3 Monsters:12 $lines(monsters3.txt) on *:text:!m-lv4 *:#:if ($2 isnum) msg $chan $read(monsters4.txt,$2) - Total Lv4 Monsters:12 $lines(monsters4.txt) on *:text:!m-lv5 *:#:if ($2 isnum) msg $chan $read(monsters5.txt,$2) - Total Lv5 Monsters:12 $lines(monsters5.txt) on *:text:!m-lv6 *:#:if ($2 isnum) msg $chan $read(monsters6.txt,$2) - Total Lv6 Monsters:12 $lines(monsters6.txt) on *:text:!m-lv7 *:#:if ($2 isnum) msg $chan $read(monsters7.txt,$2) - Total Lv7 Monsters:12 $lines(monsters7.txt) on *:text:!m-lv8 *:#:if ($2 isnum) msg $chan $read(monsters8.txt,$2) - Total Lv8 Monsters:12 $lines(monsters8.txt) on *:text:!m-lv9 *:#:if ($2 isnum) msg $chan $read(monsters9.txt,$2) - Total Lv9 Monsters:12 $lines(monsters9.txt) on *:text:!m-lv10 *:#:if ($2 isnum) msg $chan $read(monsters10.txt,$2) - Total Lv10 Monsters:12 $lines(monsters10.txt) on *:text:!m-lv11 *:#:if ($2 isnum) msg $chan $read(monsters11.txt,$2) - Total Lv11 Monsters:12 $lines(monsters11.txt) on *:text:!m-lv12 *:#:if ($2 isnum) msg $chan $read(monsters12.txt,$2) - Total Lv12 Monsters:12 $lines(monsters12.txt) on *:text:!m-total:#:{ msg $chan Total Enemy Strengh: ( Lv1:12 $lines(
  17. So I've been working on this for a little bit. I wanted to make something where you could have a registration system for all scripts that wanted to support this kind of thing. For example if you had a casino script or trivia script that wanted to register users, you could do so with this script for both of them (assuming they were compatible). I would definitely like to collaborate with mIRC script writers who are looking to use this kind of system. I'm almost always available on skype via: jasonsphone01 Since this is a system all it's own, it does not require any other plugins to help it run. If you have any questions please use the comment section below or feel free to message me on skype! (or if you want to invite me to your IRC server, that'll work too) Change Log: SR-001 Extensible Account Script v.0.1.0.0.bta Beta Release version of the EAS. HF-001 Extensible Account Script v.0.1.0.1.bta Clean-up of the code used in EAS. Added more identifiers to the $eas alias Commented-out ability to type /account open to open the account dialog. Added the -c tag to the /account alias (before any additional arguments) to clear out the window before processing any other information. SU-001 Extensible Account Script v.0.2.0.0.bta Added dialogs for all normal /account alias commands. Additional code clean-up. Added $alock() alias for a quicker look at various user's account lock information. Added a change log. SU-002 Extensible Account Script v.0.3.0.0.bta Added Menu option to bring up the console Added an on TEXT event handler MU-001 Extensible Account Script v.0.3.1.0.bta Added information text to /account info command. Added installation and version update times for statistical purposes. MU-002 Extensible Account Script v.0.3.2.1.bta Added Staff Channel with and output option Added the ability to auto-join this channel upon connecting to a server. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;Extensible Account Script;;;;; ;;;;;;;Version: 0.3.2.1.bta;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;; ;;;;;Aliases;;;;; ;;;;;;;;;;;;;;;;; alias eas { If ($1 == version) { return 0.3.2.1.bta } If ($1 == left) { return 9,1[EAS] } If ($1 == checkversion) { return $readini(account/account.ini,status,version) } If ($1 == settings) { return $readini(account/account.ini,settings,$2) } If ($1 == status) { return $readini(account/account.ini,status,$2) } If ($1 == perm) { return $readini(account/ $+ $2 $+ /permissions.ini,perms,$3) } If ($1 == gperm) { return $readini(account/staff/groups.ini,$2,$3) } If ($1 == isRegistered) { return $readini(account/ $+ $2 $+ /account.ini,status,registered) } If ($1 == isStaff) { return $readini(account/ $+ $2 $+ /account.ini,power,staff) } If ($1 == staffGroup) { return $readini(account/ $+ $2 $+ /account.ini,power,position) } If ($1 == isGroup) { return $readini(account/staff/groups.ini,$2,registered) } If ($1 == userPass) { return $readini(account/ $+ $2 $+ /account.ini,status,password) } If ($1 == userEmail) { return $readini(account/ $+ $2 $+ /account.ini,status,email) } If ($1 == opLevel) { return $readini(account/staff/groups.ini,$2,oplevel) } If ($1 == loggedIn) { return $readini(account/ $+ $2 $+ /account.ini,status,loggedin) } If ($1 == joinTime) { return $readini(account/ $+ $2 $+ /account.ini,status,jointime) } } alias alock { If (!$2) { return $readini(account/ $+ $1 $+ /account.ini,status,locked) } Elseif ($2 == date) { return $readini(account/ $+ $1 $+ /account.ini,status,lastlockdate) } Elseif ($2 == locker) { return $readini(account/ $+ $1 $+ /account.ini,status,lastlocker) } Elseif ($2 == reason) { return $readini(account/ $+ $1 $+ /account.ini,status,lockreason) } Elseif ($2 == unlock) { return $readini(account/ $+ $1 $+ /account.ini,status,unlocktime) } Else { return error } } alias cout { echo -a $eas(left) $1- } alias re { $1- } alias start { dialog $iif($dialog($1) == $1,-v,-md $1) $1 } alias dclose { dialog -x $dname } alias account { If (-c isin $1) { clear re account $2- halt } $iif($1 == open,,cout ==========) If ($readini(account/account.ini,status,installed) != yes) { If (!$1) { cout Please type 3/account install to install the Extensible Account Script. | halt } Elseif ($1 != install) { cout Please type 3/account install to install the Extensible Account Script. | halt } Else { cout Please wait... mkdir account writeini account/account.ini status installed yes writeini account/account.ini status version $eas(version) writeini account/account.ini status installtime $ctime writeini account/account.ini status updatetime $ctime writeini account/account.ini settings password on writeini account/account.ini settings email on writeini account/account.ini settings emailvalidate on write account/perms.txt op write account/perms.txt lockBypass mkdir account/staff re account group Owner add 4 re account group Admin add 2 writeini account/account.ini settings registration on writeini account/account.ini settings login on write account/opleveldesc.txt 7 - Staff, Bot Owner write account/opleveldesc.txt 6 - Staff, Owner (Supported services (ie ~ rank in channel)) write account/opleveldesc.txt 5 - Staff, Admin (Supported services (ie & rank in channel)) write account/opleveldesc.txt 4 - Staff, Operator (ie @ in channel)) write account/opleveldesc.txt 3 - Staff, Halfop (Supported services (ie % rank in channel)) write account/opleveldesc.txt 2 - Staff, Voice (ie + in channel)) write account/opleveldesc.txt 1 - Staff, No rank write account/opleveldesc.txt 0 - Member, non-staff writeini account/account.ini settings output off writeini account/account.ini status output #account writeini account/account.ini settings enforcechannelaccess true writeini account/account.ini settings autojoin true cout Installation complete! re account } } Elseif ($eas(checkversion) != $eas(version)) { If (!$1) { cout Please type /account update to update the Extensible Account Script. | halt } Elseif ($1 != update) { cout Please type /account update to update the Extensible Account Script. | halt } Else { cout Please wait... If (!$eas(checkversion)) { ;;;;;Update to version 0.1.0.0.dev;;;;; } If ($eas(checkversion) == 0.1.0.0.dev) { ;;;;;Update to version 0.1.0.1.dev;;;;; writeini account/account.ini settings password on writeini account/account.ini settings email on } If ($eas(checkversion) == 0.1.0.1.dev) { ;;;;;Update to version 0.1.0.2.dev;;;;; writeini account/account.ini settings emailvalidate on } If ($eas(checkversion) == 0.1.0.2.dev) { ;;;;;Update to version 0.2.0.0.dev;;;;; write account/perms.txt op write account/perms.txt lockBypass mkdir account/staff } If ($eas(checkversion) == 0.2.0.0.dev) { ;;;;;Update to version 0.2.1.0.dev;;;;; re account group Owner add 4 re account group Admin add 2 } If ($eas(checkversion) == 0.2.1.0.dev) { ;;;;;Update to version 0.2.2.0.dev;;;;; writeini account/account.ini settings registration on writeini account/account.ini settings login on } If ($eas(checkversion) == 0.2.2.0.dev) { ;;;;;Update to version 0.1.0.0.bta;;;;; ;;;;;This is the official beta release;;;;; ;;;;;If anyone would like to colaberate on this project with me, add me on skype: jasonsphone01 write account/opleveldesc.txt 7 - Staff, Bot Owner write account/opleveldesc.txt 6 - Staff, Owner (Supported services (ie ~ rank in channel)) write account/opleveldesc.txt 5 - Staff, Admin (Supported services (ie & rank in channel)) write account/opleveldesc.txt 4 - Staff, Operator (ie @ in channel)) write account/opleveldesc.txt 3 - Staff, Halfop (Supported services (ie % rank in channel)) write account/opleveldesc.txt 2 - Staff, Voice (ie + in channel)) write account/opleveldesc.txt 1 - Staff, No rank write account/opleveldesc.txt 0 - Member, non-staff } If ($eas(checkversion) == 0.1.0.0.bta) { ;;;;;Update to version 0.1.0.1.bta;;;;; ;;;;;Code clean-up;;;;; ;;;;;Nothing to add presently;;;;; } If ($eas(checkversion) == 0.1.0.1.bta) { ;;;;;Update to version 0.2.0.0.bta;;;;; ;;;;;Code clean-up;;;;; ;;;;;Added dialogs;;;;; ;;;;;Nothing to add here;;;;; } If ($eas(checkversion) == 0.2.0.0.bta) { ;;;;;Update to version 0.3.0.0.bta;;;;; ;;;;;Code clean-up;;;;; ;;;;;Added Menu and on Text event handler;;;;; ;;;;;Nothing to add here;;;;; } If ($eas(checkversion) == 0.3.0.0.bta) { ;;;;;Update to version 0.3.1.0.bta;;;;; ;;;;;Added information text to /account command;;;;; writeini account/account.ini status installtime $ctime } If ($eas(checkversion) == 0.3.1.0.bta) { ;;;;;Update to version 0.3.2.0.bta;;;;; ;;;;;Added Staff Output Channel;;;;; writeini account/account.ini settings output off writeini account/account.ini status output #account writeini account/account.ini settings enforcechannelaccess true } If ($eas(checkversion) == 0.3.2.0.bta) { ;;;;;Update to version 0.3.2.1.bta;;;;; ;;;;;Added on Conect option to auto-join the account channel;;;;; writeini account/account.ini settings autojoin on } writeini account/account.ini status version $eas(version) writeini account/account.ini status updatetime $ctime cout Update complete! re account } } Else { If (!$1) { cout Please select from the following options: cout To view options for account management, please type /account manage cout To view options for staff management, please type /account staff cout To view options for script settings, please type /account settings cout To bring up the dialog for this script, please type /account open cout To view information about this script, please type /account info } Elseif ($1 == open) { start account } Elseif ($1 == manage) { cout Please select from the following options: cout To register/unregister a user, please type /account <register|unregister> <nick> $iif($eas(settings,password) == on,[password],) $iif($eas(settings,email) == on,[email],) cout To login/logout a user, please type /account <login|logout> <nick> cout To lock/unlock a user account, please type /account <lock|unlock> <nick> [time to expire in seconds] [reason for lock] cout To view the list of settings on a user account and how to modify them, please type /account view <nick> } Elseif ($1 == register) { If (!$2) { cout Please type /account register <nick> $iif($eas(settings,password) == on,<password>,) $iif($eas(settings,email) == on,<email>,) | halt } If ($eas(isRegistered,$2) == yes) { cout This user is already registered! | halt } If ($eas(settings,password) == on) && ($eas(settings,email) == on) { If (!$4) { cout Please type /account register <nick> <password> <email> | halt } If ($eas(settings,emailvalidate) == on) { If ($readini(account/account.ini,emailvalidate,$4) == registered) { cout This email is already registered to a user! | halt } Else { writeini account/account.ini emailvalidate $4 registered } } mkdir account/ $+ $2 writeini account/ $+ $2 $+ /account.ini status password $3 writeini account/ $+ $2 $+ /account.ini status email $4 } Elseif ($eas(settings,password) == on) { If (!$3) { cout Please type /account register <nick> <password> | halt } mkdir account/ $+ $2 writeini account/ $+ $2 $+ /account.ini status password $3 } Elseif ($eas(settings,email) == on) { If (!$3) { cout Please type /account register <nick> <email> | halt } If ($eas(settings,emailvalidate) == on) { If ($readini(account/account.ini,emails,$3) == registered) { cout This email is already registered to a user! | halt } Else { writeini account/account.ini emailvalidate $3 registered } } mkdir account/ $+ $2 writeini account/ $+ $2 $+ /account.ini status email $3 } Else { mkdir account/ $+ $2 } writeini account/ $+ $2 $+ /account.ini status registered yes writeini account/ $+ $2 $+ /account.ini status loggedin no writeini account/ $+ $2 $+ /account.ini status lastlogin na writeini account/ $+ $2 $+ /account.ini status locked no writeini account/ $+ $2 $+ /account.ini status lastlockdate na writeini account/ $+ $2 $+ /account.ini status lastlocker na writeini account/ $+ $2 $+ /account.ini status lockreason na writeini account/ $+ $2 $+ /account.ini status unlocktime $ctime writeini account/ $+ $2 $+ /account.ini status jointime $ctime writeini account/ $+ $2 $+ /account.ini power staff no writeini account/ $+ $2 $+ /account.ini power position member writeini account/ $+ $2 $+ /account.ini power premium no writeini account/ $+ $2 $+ /account.ini power premiumExpiration $ctime write account/accounts.txt $2 cout Account registration for the nickname $2 is complete! } Elseif ($1 == unregister) { If (!$2) { cout Please type /account unregister <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt } remini account/account.ini emailvalidate $eas(userEmail,$2) .remove account/ $+ $2 $+ /account.ini .remove account/ $+ $2 $+ /permissions.ini rmdir account\$2 write -ds $+ $2 account/accounts.txt cout User Unregistration Complete! } Elseif ($1 == login) { If (!$2) { cout Please type /account login <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt } If ($eas(loggedIn,$2) == yes) { cout This user is already logged in. | halt } writeini account/ $+ $2 $+ /account.ini status loggedin yes writeini account/ $+ $2 $+ /account.ini status lastlogin $ctime If (-s !isin $3-) { cout User has been logged-in sucessfully! } If ($alock($2) == yes) { cout Warning! User is currently locked but has been logged-in anyway! } } Elseif ($1 == logout) { If (!$2) { cout Please type /account logout <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt } If ($eas(loggedIn,$2) != yes) { cout This user isn't logged in. | halt } writeini account/ $+ $2 $+ /account.ini status loggedin no If (-s !isin $3-) { cout User has been logged-out sucessfully! } } Elseif ($1 == lock) { If (!$4) { cout Please type /account lock <nick> <time to expire in seconds> <reason for lock> | halt } If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt } If ($alock($2) == yes) { cout This user's account is already locked. | halt } If ($eas(perm,$2,op) == true) { cout Warning! This user can't normally be locked! } If ($eas(perm,$2,lockBypass) == true) || ($eas(perm,$2,op) == true) { cout Warning! This user can bypass an account lockout! } writeini account/ $+ $2 $+ /account.ini status locked yes writeini account/ $+ $2 $+ /account.ini status lastlockdate $ctime writeini account/ $+ $2 $+ /account.ini status lastlocker ~Console writeini account/ $+ $2 $+ /account.ini status lockreason $4- writeini account/ $+ $2 $+ /account.ini status unlocktime $calc($ctime + $3) cout User lock of $2 $+ 's account complete! } Elseif ($1 == unlock) { If (!$2) { cout Please type /account unlock <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt } If ($alock($2) != yes) { cout This user's account is not locked. | halt } writeini account/ $+ $2 $+ /account.ini status locked no cout User unlock of $2 $+ 's account complete! } Elseif ($1 == view) { If (!$2) { cout Please type /account view <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This isn't a registered user. | halt } cout Profile information for: $2 (Generated at $asctime(ddmmmyyyy hh:nn:ss TT) $+ ) cout Status: Registered - Locked: $alock($2) $iif($alock($2) == yes,- Date Unlockable: $asctime($alock($2,unlock),ddmmmyyyy hh:nn:ss TT),) cout Last login: $asctime($readini(account/ $+ $2 $+ /account.ini,status,lastlogin),ddmmmyyyy hh:nn:ss TT) cout Join Date: $asctime($readini(account/ $+ $2 $+ /account.ini,status,jointime),ddmmmyyyy hh:nn:ss TT) If ($eas(isStaff,$2) == yes) { cout Staff Position: $readini(account/ $+ $2 $+ /account.ini,power,position) } If ($readini(account/ $+ $2 $+ /account.ini,power,premium) == yes) { cout Premium Expiration Date: $asctime($readini(account/ $+ $2 $+ /account.ini,power,premiumExpiration),ddmmmyyyy hh:nn:ss TT) } If ($alock($2,date) != na) { cout Last Lock Date: $asctime($alock($2,date),ddmmmyyyy hh:nn:ss TT) cout Last Locker: $alock($2,locker) cout Last Lock Reason: $alock($2,reason) } } Elseif ($1 == staff) { cout Please select from one of the following options: cout To manage staff users, please type /account manageStaff cout To manage staff groups, please type /account groups } Elseif ($1 == manageStaff) { cout Please select from one of the following options: cout To make a registered user staff (or to fire a staff member), please type: /account <hire|fire> <nick> [group] cout (For a list of groups, please type /account groups) cout To manage an individual's permissions as a staff member, please type /account staffer <nick> cout To change a user's group as staff, please type /account changeGroup <nick> <newGroup> } Elseif ($1 == hire) { If (!$3) { cout Please type: /account hire <nick> <group> | cout (For a list of groups, please type /account groups) | halt } If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt } If ($eas(isStaff,$2) == yes) { cout This user is already staff. | halt } If ($readini(account/staff/groups.ini,$3,registered) != yes) { cout This is not a valid group. | halt } writeini account/ $+ $2 $+ /account.ini power staff yes writeini account/ $+ $2 $+ /account.ini power position $3 write account/staff/staffers.txt $2 cout Staff hired sucessfully! } Elseif ($1 == fire) { If (!$2) { cout Please type: /account fire <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt } If ($eas(isStaff,$2) != yes) { cout This user isn't staff. | halt } writeini account/ $+ $2 $+ /account.ini power staff no writeini account/ $+ $2 $+ /account.ini power position member write -ds $+ $2 account/staff/staffers.txt cout Staff fired sucessfully! } Elseif ($1 == staffer) { If (!$2) { cout Please type: /account staffer <nick> | halt } If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt } If ($eas(isStaff,$2) != yes) { cout This user is not a staffer. | halt } cout Information about staffer: $2 (Report generated on: $asctime(ddmmmyyyy hh:nn:ss TT) $+ ) cout Current Group: $readini(account/ $+ $2 $+ /account.ini,power,position) If ($readini(account/ $+ $2 $+ /permissions.ini,status,registered) == yes) { cout Individiual Permissions: var %temp.1 1 While (%temp.1 <= $lines(account/perms.txt)) { If ($readini(account/ $+ $2 $+ /permissions.ini,perms,$read(account/perms.txt,t,%temp.1))) { cout $read(account/perms.txt,t,%temp.1) - $eas(perm,$2,$read(account/perms.txt,t,%temp.1)) } inc %temp.1 } cout End of Individual Permissions. } cout To change individual permissions, type /account changePerm <nick> <permission node> <value> cout For a complete list of permissions, type /account permList } Elseif ($1 == permList) { cout The following are the permissions recognized by the EAS directly: var %temp.1 1 While (%temp.1 <= $lines(account/perms.txt)) { cout $read(account/perms.txt,t,%temp.1) inc %temp.1 } cout End of List } Elseif ($1 == changePerm) { If (!$4) { cout Please type /account changePerm <nick> <permissions node> <value> | halt } If ($eas(isRegistered,$2) != yes) { cout This is not a registered user. | halt } writeini account/ $+ $2 $+ /permissions.ini status registered yes writeini account/ $+ $2 $+ /permissions.ini perms $3 $4 cout Permission set sucessfully! } Elseif ($1 == changeGroup) { If (!$3) { cout Please type /account changeGroup <nick> <newGroup> | halt } If ($eas(isRegistered,$2) != yes) { cout This user isn't registered. | halt } If ($eas(isStaff,$2) != yes) { cout This user isn't a staffer. | halt } If ($readini(account/staff/groups.ini,$3,registered) != yes) { cout This isn't a valid group. | halt } writeini account/ $+ $2 $+ /account.ini power position $3 cout $2 had their group change to $3 sucessfully! } Elseif ($1 == groups) { cout The following is a list of groups available for staffers: var %temp.1 1 While (%temp.1 <= $lines(account/staff/groups.txt)) { cout $read(account/staff/groups.txt,t,%temp.1) inc %temp.1 } cout End of list. To learn more about each one (and see other available options), please type /account group <groupName> info } Elseif ($1 == group) { If (!$3) { cout Please select from one of the following options: cout To view a list of available groups, please type /account groups cout To view information specific to a group, please type /account group <groupName> info cout To add/remove a group, please type /account group <groupName> <add|remove> [opLevel if adding] cout To edit operator status, please type /account group <groupName> opLevel <actual op level, see documentation for help with this> cout To edit specific permissions a group has access to, please type /account group <groupName> perms <permissions node> <value> } Elseif ($3 == info) { If ($eas(isGroup,$2) != yes) { cout This is not a valid group. | halt } cout Information for group $2 (Report generated on $asctime(ddmmmyyyy hh:nn:ss TT) cout Op Level: $readini(account/staff/groups.ini,$2,oplevel) cout Specific Permissions: var %temp.1 1 While (%temp.1 <= $lines(account/perms.txt)) { cout $read(account/perms.txt,t,%temp.1) - $eas(gperm,$2,$read(account/perms.txt,t,%temp.1)) inc %temp.1 } cout Users who have this group: var %temp.1 1 While (%temp.1 <= $lines(account/accounts.txt)) { If ($readini(account/ $+ $read(account/accounts.txt,t,%temp.1) $+ /account.ini,power,position) == $2) { cout - $read(account/accounts.txt,t,%temp.1) } inc %temp.1 } cout End of Report } Elseif ($3 == add) { If (!$4) { cout Please type /account group <groupName> add <opLevel> | halt } If ($eas(isGroup,$2) == yes) { cout This group already exists. | halt } writeini account/staff/groups.ini $2 registered yes writeini account/staff/groups.ini $2 opLevel $4 var %temp.1 1 While (%temp.1 <= $lines(account/perms.txt)) { writeini account/staff/groups.ini $2 $read(account/perms.txt,t,%temp.1) false inc %temp.1 } write account/staff/groups.txt $2 cout Group created sucessfully! } Elseif ($3 == remove) { If ($eas(isGroup,$2) != yes) { cout This group doesn't exist. | halt } write -ds $+ $2 account/staff/groups.txt remini account/staff/groups.ini $2 var %temp.1 1 While (%temp.1 <= $lines(account/accounts.txt)) { If ($readini(account/ $+ $read(account/accounts.txt,t,%temp.1) $+ /account.ini,power,position) == $2) { writeini account/ $+ $read(account/accounts.txt,t,%temp.1) $+ /account.ini power position member } inc %temp.1 } cout Group removed sucessfully! Any users assigned to that group have been assigned to the member group (ie non-staff). } Elseif ($3 == opLevel) { If (!$4) { cout Please type /account group <groupName> opLevel <actual op level> | halt } If ($eas(isGroup,$2) != yes) { cout This is not a registered group | halt } writeini account/staff/groups.ini $2 opLevel $4 cout Op Level for $2 changed to $4 sucessfully! } Elseif ($3 == perms) { If (!$5) { cout Please type /account group <groupName> perms <permissions node> <value> | halt } If ($eas(isGroup,$2) != yes) { cout This is not a registered group | halt } writeini account/staff/groups.ini $2 $4 $5 cout Permissions set sucessfully! Please note that if the permissions node is not one in the EAS system it will not show up normally (ie from a different plugin) } Else { cout Unknown command. } } Elseif ($1 == settings) { If (!$2) { cout Please select from one of the following: cout To manage core account settings, please type /account settings system cout To manage user settings (including login and registration), please type /account settings user cout To manage staff settings, please type /account settings staff } Elseif ($2 == system) { If (!$4) { cout Please select from the following options: cout To turn Staff Channel Output $iif($readini(account/account.ini,settings,output) == on,off,on) $+ , please type: /account settings system output $iif($eas(settings,output) == on,off,on) cout To change the Staff Output channel (currently: $eas(status,output) $+ ), please type: /account settings system channel <input new channel> cout To change the Enforce Access to Output channel (currently: $eas(settings,enforcechannelaccess) $+ ), please type: /account settings system enforcechannelaccess $iif($eas(settings,enforcechannelaccess) == on,off,on) cout To change the Autojoin on Connect option (currently: $eas(settings,autojoin) $+ ), please type: /account settings system autojoin $iif($eas(autojoin) == on,off,on) } Elseif ($3 == output) { writeini account/account.ini settings output $4 cout Staff Channel Output changed to: $4 } Elseif ($3 == channel) { writeini account/account.ini status output $4 cout Staff Channel has been changed to: $4 } Elseif ($3 == enforcechannelaccess) { writeini account/account.ini settings enforcechannelaccess $4 cout Enforce Channel Access has been changed to: $4 } Elseif ($3 == autojoin) { writeini account/account.ini settings autojoin $4 cout Autojoin on connect has been changed to: $$ } Else { cout Unknown command. } } Elseif ($2 == user) { If (!$4) { cout Please select from one of the following options: cout To $iif($readini(account/account.ini,settings,registration) == on,deny,allow) registration, please type: /account settings user registration $iif($readini(account/account.ini,settings,registration) == on,off,on) cout To $iif($readini(account/account.ini,settings,login) == on,deny,allow) logins, please type: /account settings user login $iif($readini(account/account.ini,settings,login) == on,off,on) cout To $iif($readini(account/account.ini,settings,password) == on,not require,require) a password, please type: /account settings user password $iif($readini(account/account.ini,settings,password) == on,off,on) cout To $iif($readini(account/account.ini,settings,email) == on,not require,require) an email, please type: /account settings user email $iif($readini(account/account.ini,settings,email) == on,off,on) cout To $iif($readini(account/account.ini,settings,emailvalidate) == on,not block,block) the same email address registereing more than once, please type: /account settings user emailvalidate $iif($readini(account/account.ini,settings,emailvalidate) == on,off,on) } Else { writeini account/account.ini settings $3 $4 cout Value updated sucessfully! } } Elseif ($2 == staff) { cout Currently there are no settings available. } Else { cout Unknown command. } } Elseif ($1 == info) { cout Extensible Account Script - Version $eas(version) cout Installed on: $asctime($eas(status,installtime),ddmmmyyyy hh:nn:ss TT) cout Most recently updated on: $asctime($eas(status,updatetime),ddmmmyyyy hh:nn:ss TT) cout This update released on $asctime(1438531200,ddmmmyyyy hh:nn:ss TT) cout Number of accounts currently registered: $lines(account/accounts.txt) cout Number of staffers: $lines(account/staff/staffers.txt) cout Development Area: irc.us.gamesurge.net #Tamaki } } Else { cout Unknown command. } } ;;;;;;;;;;;;;;;;; ;;;;;Dialogs;;;;; ;;;;;;;;;;;;;;;;; dialog account { title Account Main Menu option dbu size -1 -1 101 44 button "Account Management", 1, 1 1 100 10 button "Staff Management", 2, 1 11 100 10 button "System Settings", 3, 1 22 100 10 button "Close", 4, 1 33 100 10, cancel } dialog account_management { title Account Management option dbu size -1 -1 101 44 button "New Account", 1, 1 1 100 10 button "Manage Account", 2, 1 11 100 10 button "Delete Account", 3, 1 22 100 10 button "Back", 4, 1 33 100 10 } dialog account_management_new { title New Account option dbu size -1 -1 152 55 text "Nick", 1, 1 1 50 10 edit "", 2, 51 1 100 10 text "Password", 3, 1 11 50 10 edit "", 4, 51 11 100 10, disable text "Email", 5, 1 22 50 10 edit "", 6, 51 22 100 10, disable button "Create Account", 7, 1 33 151 10 button "Cancel", 8, 1 44 151 10 } dialog account_management_manage { title Manage Account option dbu size -1 -1 203 77 text "Username", 1, 1 1 50 10 edit "", 2, 51 1 100 10 button "Search", 3, 152 1 50 10 button "Look-up", 4, 1 11 202 10 text "Password", 5, 1 22 50 10 edit "", 6, 51 22 152 10, pass disable text "Email", 7, 1 33 50 10 edit "", 8, 51 33 152 10, disable check "Lock Account", 11, 1 44 202 10, disable button "Complete", 9, 1 55 202 10, disable button "Cancel", 10, 1 66 202 10 } dialog account_management_manage_list { title Account List option dbu size -1 -1 101 143 list 1, 1 1 100 100 text "Username", 2, 1 100 100 10 edit "", 3, 1 110 100 10, right read button "Select", 4, 1 121 100 10, disable button "Cancel", 5, 1 132 100 10 } dialog account_management_delete { title Delete Account option dbu size -1 -1 101 143 list 1, 1 1 100 100 text "Username", 2, 1 100 100 10 edit "", 3, 1 110 100 10, right read button "Delete", 4, 1 121 100 10, disable button "Cancel", 5, 1 132 100 10 } dialog account_staff { title Staff Management option dbu size -1 -1 101 33 button "Manage Staffers", 1, 1 1 100 10 button "Manage Groups", 2, 1 11 100 10 button "Back", 3, 1 22 100 10 } dialog account_staff_manage { title Manage Staff option dbu size -1 -1 101 44 button "New Staffer", 1, 1 1 100 10 button "Manage Staffer", 2, 1 11 100 10 button "Fire Staffer", 3, 1 22 100 10 button "Back", 4, 1 33 100 10 } dialog account_staff_manage_hire { title Hire New Staff option dbu size -1 -1 203 55 text "Username", 1, 1 1 50 10 edit "", 2, 51 1 100 10 button "Search", 3, 152 1 50 10 button "Look-up", 4, 1 11 202 10 text "Group", 5, 1 22 50 10 combo 6, 51 22 152 10, drop disable button "Hire", 7, 1 33 202 10, disable button "Cancel", 8, 1 44 202 10 } dialog account_staff_manage_hire_list { title Non-Staff Account List option dbu size -1 -1 101 143 list 1, 1 1 100 100 text "Username", 2, 1 100 100 10 edit "", 3, 1 110 100 10, right read button "Select", 4, 1 121 100 10, disable button "Cancel", 5, 1 132 100 10 } dialog account_staff_manage_manage { title Manage Staffer option dbu size -1 -1 203 66 text "Username", 1, 1 1 50 10 edit "", 2, 51 1 100 10 button "Search", 3, 152 1 50 10 button "Look-up", 4, 1 11 202 10 text "Group", 5, 1 22 50 10 combo 6, 51 22 152 10, drop disable button "Individual Permissions", 7, 1 33 202 10, disable button "Complete", 8, 1 44 202 10, disable button "Cancel", 9, 1 55 202 10 } dialog account_staff_manage_manage_list { title Staff List option dbu size -1 -1 101 143 list 1, 1 1 100 100 text "Username", 2, 1 100 100 10 edit "", 3, 1 110 100 10, right read button "Select", 4, 1 121 100 10, disable button "Cancel", 5, 1 132 100 10 } dialog account_staff_manage_manage_perms { title Manage Permissions option dbu size -1 -1 152 55 text "Permission", 1, 1 1 50 10 combo 2, 51 1 100 10, drop text "Current", 3, 1 13 50 10 text "", 4, 51 13 100 10, right text "New", 5, 1 24 50 10 edit "", 6, 51 24 100 10, right disable button "Change", 7, 1 35 151 10, disable button "Cancel", 8, 1 46 151 10 } dialog account_staff_manage_fire { title Fire Staffer option dbu size -1 -1 101 145 list 1, 1 1 100 100 text "Username", 2, 1 101 100 10 text "", 3, 1 112 100 10 button "Fire", 4, 1 123 100 10, disable button "Cancel", 5, 1 134 100 10 } dialog account_staff_groups { title Group Options option dbu size -1 -1 101 44 button "Create Group", 1, 1 1 100 10 button "Manage Group", 2, 1 11 100 10 button "Delete Group", 3, 1 22 100 10 button "Back", 4, 1 33 100 10 } dialog account_staff_groups_create { title Create Group option dbu size -1 -1 152 44 text "Group Name", 1, 1 1 50 10 edit "", 2, 51 1 100 10 text "OpLevel", 3, 1 11 50 10 combo 4, 51 11 100 10, drop button "Create", 5, 1 22 151 10 button "Cancel", 6, 1 33 151 10 } dialog account_staff_groups_manage { title Manage Group option dbu size -1 -1 203 68 text "Group Name", 1, 1 1 50 10 edit "", 2, 51 1 100 10 button "Search", 3, 152 1 50 10 button "Look-up", 4, 1 11 202 10 text "OpLevel", 5, 1 22 100 10 combo 6, 101 22 100 10, drop disable button "Change Permissions", 7, 1 35 202 10, disable button "Complete", 8, 1 46 202 10, disable button "Cancel", 9, 1 57 202 10 } dialog account_staff_groups_manage_list { title Groups List option dbu size -1 -1 101 145 list 1, 1 1 100 100 text "Group Name", 2, 1 101 100 10 text "", 3, 1 112 100 10 button "Select", 4, 1 123 100 10, disable button "Cancel", 5, 1 134 100 10 } dialog account_staff_groups_manage_perms { title Manage Permissions option dbu size -1 -1 152 55 text "Permission", 1, 1 1 50 10 combo 2, 51 1 100 10, drop text "Current", 3, 1 13 50 10 text "", 4, 51 13 100 10, right text "New", 5, 1 24 50 10 edit "", 6, 51 24 100 10, right disable button "Change", 7, 1 35 151 10, disable button "Cancel", 8, 1 46 151 10 } dialog account_staff_groups_delete { title Delete Group option dbu size -1 -1 101 145 list 1, 1 1 100 100 text "Group Name", 2, 1 101 100 10 text "", 3, 1 112 100 10 button "Delete", 4, 1 123 100 10, disable button "Cancel", 5, 1 134 100 10 } dialog account_system { title System Settings option dbu size -1 -1 101 44 button "Core Settings", 1, 1 1 100 10 button "User Settings", 2, 1 11 100 10 button "Staff Settings", 3, 1 22 100 10 button "Back", 4, 1 33 100 10 } dialog account_system_core { title Core System Settings option dbu size -1 -1 101 66 button "Output to Channel", 1, 1 1 100 10 button "Output Channel", 2, 1 11 100 10 button "Enforce Channel Access", 4, 1 22 100 10 button "Join Output Channel", 5, 1 33 100 10 button "Autojoin on Connect", 6, 1 44 100 10 button "Back", 3, 1 55 100 10 } dialog account_system_user { title User System Settings option dbu size -1 -1 101 66 button "User Registration", 1, 1 1 100 10 button "User Logins", 2, 1 11 100 10 button "Require Password", 3, 1 22 100 10 button "Require Email", 4, 1 33 100 10 button "Email Validation", 5, 1 44 100 10 button "Back", 6, 1 55 100 10 } ;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;on Dialog event;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; on *:DIALOG:account:*:*: { If ($devent == sclick) { If ($did == 1) { dclose account start account_management } If ($did == 2) { dclose account start account_staff } If ($did == 3) { dclose account start account_system } } } on *:DIALOG:account_management:*:*: { If ($devent == sclick) { If ($did == 1) { dclose account_management start account_management_new } If ($did == 2) { dclose account_management start account_management_manage } If ($did == 3) { dclose account_management start account_management_delete } If ($did == 4) { dclose account_management start account } } If ($devent == close) { start account } } on *:DIALOG:account_management_new:*:*: { If ($devent == init) { If ($eas(settings,password) == on) { did -e $dname 4 } If ($eas(settings,email) == on) { did -e $dname 6 } } If ($devent == sclick) { If ($did == 7) { If (!$did(2)) { did -f $dname 2 } If ($eas(settings,password) == on) { If (!$did(4)) { did -f $dname 4 } } If ($eas(settings,email) == on) { If (!$did(6)) { did -f $dname 6 } } account register $did(2) $iif($eas(settings,password) == on,$did(4),) $iif($eas(settings,email) == on,$did(6),) dclose account_management_new start account_management } If ($did == 8) { dclose account_management_new start account_management } } If ($devent == close) { start account_management } } on *:DIALOG:account_management_manage:*:*: { If ($devent == sclick) { If ($did == 3) { start account_management_manage_list } If ($did == 4) { If ($eas(isRegistered,$did(2)) == yes) { did -b $dname 2-4 If ($eas(settings,password) == on) { did -era $dname 6 $eas(userPass,$did(2)) } If ($eas(settings,email) == on) { did -era $dname 8 $eas(userEmail,$did(2)) } If ($alock($did(2)) == yes) { did -c $dname 11 } did -e $dname 9,11 } Else { did -fr $dname 2 } } If ($did == 9) { writeini account/ $+ $did(2) $+ /account.ini status password $did(6) writeini account/ $+ $did(2) $+ /account.ini status email $did(8) dclose $dname start account_management } If ($did == 10) { dclose $dname start account_management } If ($did == 11) { If ($alock($did(2)) == yes) { account unlock $did(2) did -u $dname 11 } Else { var %temp.1 $?="PLease enter a time to expire in seconds." var %temp.2 $?="Please enter a lock reason." account lock $did(2) %temp.1 %temp.2 did -c $dname 11 start $dname } } } If ($devent == close) { start account_management } } on *:DIALOG:account_management_manage_list:*:*: { If ($devent == init) { If (!$dialog(account_management_manage)) { start account_management_manage dialog -v $dname } var %temp.1 1 While (%temp.1 <= $lines(account/accounts.txt)) { did -a $dname 1 $read(account/accounts.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { If (!$dialog(account_management_manage)) { start account_management_manage } did -b account_management_manage 2-4 did -ra account_management_manage 2 $did(3) If ($eas(settings,password) == on) { did -era account_management_manage 6 $eas(userPass,$did(3)) } If ($eas(settings,email) == on) { did -era account_management_manage 8 $eas(userEmail,$did(3)) } did -e account_management_manage 9,11 If ($alock($did(3)) == yes) { did -c account_management_manage 11 } dclose $dname start account_management_manage } If ($did == 5) { dclose $dname start account_management_manage } } If ($devent == dclick) { If ($did == 1) { If (!$dialog(account_management_manage)) { start account_management_manage } did -b account_management_manage 2-4 did -ra account_management_manage 2 $did(1).seltext If ($eas(settings,password) == on) { did -era account_management_manage 6 $eas(userPass,$did(1).seltext) } If ($eas(settings,email) == on) { did -era account_management_manage 8 $eas(userEmail,$did(1).seltext) } did -e account_management_manage 9,11 If ($alock($did(1).seltext) == yes) { did -c account_management_manage 11 } dclose $dname start account_management_manage } } If ($devent == close) { start account_management } } on *:DIALOG:account_management_delete:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/accounts.txt)) { did -a $dname 1 $read(account/accounts.txt, %temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { If (!$did(3)) { did -b $dname 4 | halt } account unregister $did(3) dclose $dname start account_management } If ($did == 5) { dclose $dname start account_management } } If ($devent == close) { start account_management } } on *:DIALOG:account_staff:*:*: { If ($devent == sclick) { If ($did == 1) { dclose $dname start account_staff_manage } If ($did == 2) { dclose $dname start account_staff_groups } If ($did == 3) { dclose $dname start account } } If ($devent == close) { start account } } on *:DIALOG:account_staff_manage:*:*: { If ($devent == sclick) { If ($did == 1) { dclose $dname start account_staff_manage_hire } If ($did == 2) { dclose $dname start account_staff_manage_manage } If ($did == 3) { dclose $dname start account_staff_manage_fire } If ($did == 4) { dclose $dname start account_staff } } If ($devent == close) { start account_staff } } on *:DIALOG:account_staff_manage_hire:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/staff/groups.txt)) { did -a $dname 6 $read(account/staff/groups.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 3) { start account_staff_manage_hire_list } If ($did == 4) { If ($eas(isRegistered,$did(2)) != yes) { did -rf $dname 2 | cout User is not registered! | halt } If ($eas(isStaff,$did(2)) == yes) { did -rf $dname 2 | cout User is already staff! | halt } did -b $dname 2-4 did -e $dname 6,7 } If ($did == 7) { If (!$did(6).seltext) { cout Select a group first! | halt } account hire $did(2) $did(6) dclose $dname start account_staff_manage } If ($did == 8) { dclose $dname start account_staff_manage } } If ($devent == close) { start account_staff_manage } } on *:DIALOG:account_staff_manage_hire_list:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/accounts.txt)) { If ($eas(isStaff,$read(account/accounts.txt,t,%temp.1)) != yes) { did -a $dname 1 $read(account/accounts.txt,t,%temp.1) } inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { did -b account_staff_manage_hire 2-4 did -ra account_staff_manage_hire 2 $did(3) did -e account_staff_manage_hire 6,7 dclose $dname start account_staff_manage_hire } If ($did == 5) { dclose $dname start account_staff_manage_hire } } If ($devent == dclick) { If ($did == 1) { did -b account_staff_manage_hire 2-4 did -ra account_staff_manage_hire 2 $did(1).seltext did -e account_staff_manage_hire 6,7 dclose $dname start account_staff_manage_hire } } If ($devent == close) { start account_staff_manage_hire } } on *:DIALOG:account_staff_manage_manage:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/staff/groups.txt)) { did -a $dname 6 $read(account/staff/groups.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 3) { start account_staff_manage_manage_list } If ($did == 4) { If ($eas(isStaff,$did(2)) != yes) { did -rf $dname 2 | cout User is not staff! | halt } did -b $dname 2-4 did -e $dname 6-8 } If ($did == 7) { start account_staff_manage_manage_perms } If ($did == 8) { If (!$did(6).seltext) { cout Please select a group first! | halt } account changeGroup $did(2) $did(6).seltext dclose $dname start account_staff_manage } If ($did == 9) { dclose $dname start account_staff_manage } } If ($devent == close) { start account_staff_manage } } on *:DIALOG:account_staff_manage_manage_list:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/staff/staffers.txt)) { did -a $dname 1 $read(account/staff/staffers.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { did -b account_staff_manage_manage 2-4 did -ra account_staff_manage_manage 2 $did(3) did -e account_staff_manage_manage 6-8 dclose $dname start account_staff_manage_manage } If ($did == 5) { dclose $dname start account_staff_manage_manage } } If ($devent == dclick) { If ($did == 1) { did -b account_staff_manage_manage 2-4 did -ra account_staff_manage_manage 2 $did(1).seltext did -e account_staff_manage_manage 6-8 dclose $dname start account_staff_manage_manage } } If ($devent == close) { start account_staff_manage_manage } } on *:DIALOG:account_staff_manage_manage_perms:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/perms.txt)) { did -a $dname 2 $read(account/perms.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 2) { did -b $dname 2 did -ra $dname 4 $eas(perm,$did(account_staff_manage_manage,2),$did(2).seltext) did -e $dname 6,7 } If ($did == 7) { If (!$did(6)) { did -f $dname 6 | cout Please type a new value first! | halt } account changePerm $did(account_staff_manage_manage,2) $did(2).seltext $did(6) dclose $dname start account_staff_manage_manage } If ($did == 8) { dclose $dname start account_staff_manage_manage } } If ($devent == close) { start account_staff_manage_manage } } on *:DIALOG:account_staff_manage_fire:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/staff/staffers.txt)) { did -a $dname 1 $read(account/staff/staffers.txt, %temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { account fire $did(3) dclose $dname start account_staff_manage } If ($did == 5) { dclose $dname start account_staff_manage } } If ($devent == close) { start account_staff_manage } } on *:DIALOG:account_staff_groups:*:*: { If ($devent == sclick) { If ($did == 1) { dclose $dname start account_staff_groups_create } If ($did == 2) { dclose $dname start account_staff_groups_manage } If ($did == 3) { dclose $dname start account_staff_groups_delete } If ($did == 4) { dclose $dname start account_staff } } If ($devent == close) { start account_staff } } on *:DIALOG:account_staff_groups_create:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= 7) { did -a $dname 4 %temp.1 inc %temp.1 } } If ($devent == sclick) { If ($did == 5) { If (!$did(2)) { did -f $dname 2 | cout Please input a name first! | halt } If ($eas(isGroup,$did(2)) == yes) { did -f $dname 2 | cout This group is already registered! | halt } If (!$did(4).seltext) { did -f $dname 4 | cout Please select an OpLevel first! | halt } account group $did(2) add $did(4).seltext dclose $dname start account_staff_groups } If ($did == 6) { dclose $dname start account_staff_groups } } If ($devent == close) { start account_staff_groups } } on *:DIALOG:account_staff_groups_manage:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= 7) { did -a $dname 6 %temp.1 inc %temp.1 } } If ($devent == sclick) { If ($did == 3) { start account_staff_groups_manage_list } If ($did == 4) { If (!$did(2)) { did -f $dname 2 | halt } If ($eas(isGroup,$did(2)) != yes) { did -f $dname 2 | cout This is not a valid group! | halt } did -b $dname 2-4 did -e $dname 6-8 did -ra $dname 5 OpLevel - Current: $eas(opLevel,$did(2)) } If ($did == 7) { start account_staff_groups_manage_perms } If ($did == 8) { If (!$did(6).seltext) { did -f $dname 6 | cout Please select a new OpLevel! | halt } account group $did(2) opLevel $did(6).seltext dclose $dname start account_staff_groups } If ($did == 9) { dclose $dname start account_staff_groups } } If ($devent == close) { dclose $dname start account_staff_groups } } on *:DIALOG:account_staff_groups_manage_list:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/staff/groups.txt)) { did -a $dname 1 $read(account/staff/groups.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { did -b account_staff_groups_manage 2-4 did -e account_staff_groups_manage 6-8 did -ra account_staff_groups_manage 2 $did(3) did -ra account_staff_groups_manage 5 OpLevel - Current: $eas(opLevel,$did(3)) dclose $dname start account_staff_groups_manage } If ($did == 5) { dclose $dname start account_staff_groups_manage } } If ($devent == dclick) { If ($did == 1) { did -b account_staff_groups_manage 2-4 did -e account_staff_groups_manage 6-8 did -ra account_staff_groups_manage 2 $did(1).seltext did -ra account_staff_groups_manage 5 OpLevel - Current: $eas(opLevel,$did(1).seltext) dclose $dname start account_staff_groups_manage } } If ($devent == close) { start account_staff_groups_manage } } on *:DIALOG:account_staff_groups_manage_perms:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/perms.txt)) { did -a $dname 2 $read(account/perms.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 2) { did -b $dname 2 did -ra $dname 4 $eas(gperm,$did(account_staff_groups_manage,2),$did(2).seltext) did -e $dname 6,7 } If ($did == 7) { If (!$did(6)) { did -f $dname 6 | cout Please type a new value first! | halt } account group $did(account_staff_groups_manage,2) perms $did(2).seltext $did(6) dclose $dname start account_staff_groups_manage } If ($did == 8) { dclose $dname start account_staff_groups_manage } } If ($devent == close) { start account_staff_groups_manage } } on *:DIALOG:account_staff_groups_delete:*:*: { If ($devent == init) { var %temp.1 1 While (%temp.1 <= $lines(account/staff/groups.txt)) { did -a $dname 1 $read(account/staff/groups.txt,t,%temp.1) inc %temp.1 } } If ($devent == sclick) { If ($did == 1) { did -ra $dname 3 $did(1).seltext did -e $dname 4 } If ($did == 4) { account group $did(3) remove dclose $dname start account_staff_groups } If ($did == 5) { dclose $dname start account_staff_groups } } If ($devent == close) { start account_staff_groups } } on *:DIALOG:account_system:*:*: { If ($devent == sclick) { If ($did == 1) { dclose $dname start account_system_core } If ($did == 2) { dclose $dname start account_system_user } If ($did == 3) { account settings staff | halt } If ($did == 4) { dclose $dname start account } } If ($devent == close) { start account } } on *:DIALOG:account_system_core:*:*: { If ($devent == init) { did -ra $dname 1 Output to Channel: $eas(settings,output) did -ra $dname 2 Output Channel: $eas(status,output) did -ra $dname 4 Enforce Channel Access: $eas(settings,enforcechannelaccess) did -ra $dname 6 Autojoin on Connect: $eas(settings,autojoin) } If ($devent == sclick) { If ($did == 1) { If ($eas(settings,output) == on) { writeini account/account.ini settings output off did -ra $dname 1 Output to Channel: Off } Else { writeini account/account.ini settings output on did -ra $dname 1 Output to Channel: On } } If ($did == 2) { var %temp.1 $?="Please enter the name of the new channel." If (%temp.1) { writeini account/account.ini status output %temp.1 did -ra $dname 2 Output Channel: %temp.1 } start $dname } If ($did == 3) { dclose $dname start account_system } If ($did == 4) { If ($eas(settings,enforcechannelaccess) == on) { writeini account/account.ini settings enforcechannelaccess off did -ra $dname 4 Enforce Channel Access: Off } Else { writeini account/account.ini settings enforcechannelaccess on did -ra $dname 4 Enforce Channel Access: On } } If ($did == 5) { join $eas(status,output) did -b $dname 5 start $dname } If ($did == 6) { If ($eas(settings,autojoin) == on) { writeini account/account.ini settings autojoin off did -ra $dname 6 Autojoin on Connect: Off } Else { writeini account/account.ini settings autojoin on did -ra $dname 6 Autojoin on Connect: On } } } If ($devent == close) { start account_system } } on *:DIALOG:account_system_user:*:*: { If ($devent == init) { did -ra $dname 1 User Registration: $iif($eas(settings,registration) == on,On,Off) did -ra $dname 2 User Login: $iif($eas(settings,login) == on,On,Off) did -ra $dname 3 Require Password: $iif($eas(settings,password) == on,On,Off) did -ra $dname 4 Require Email: $iif($eas(settings,email) == on,On,Off) did -ra $dname 5 Email Validation: $iif($eas(settings,emailvalidate) == on,On,Off) } If ($devent == sclick) { If ($did == 1) { If ($eas(settings,registration) == on) { writeini account/account.ini settings registration off did -ra $dname 1 User Registration: Off } Else { writeini account/account.ini settings registration on did -ra $dname 1 User Registration: On } } If ($did == 2) { If ($eas(settings,login) == on) { writeini account/account.ini settings login off did -ra $dname 2 User Login: Off } Else { writeini account/account.ini settings login on did -ra $dname 2 User Login: On } } If ($did == 3) { If ($eas(settings,password) == on) { writeini account/account.ini settings password off did -ra $dname 3 Require Password: Off } Else { writeini account/account.ini settings password on did -ra $dname 3 Require Password: On } } If ($did == 4) { If ($eas(settings,email) == on) { writeini account/account.ini settings email off did -ra $dname 4 Require Email: Off } Else { writeini account/account.ini settings email on did -ra $dname 4 Require Email: On } } If ($did == 5) { If ($eas(settings,emailvalidate) == on) { writeini account/account.ini settings emailvalidate off did -ra $dname 5 Email Validation: Off } Else { writeini account/account.ini settings emailvalidate on did -ra $dname 5 Email Validation: On } } If ($did == 6) { dclose $dname start account_system } } If ($devent == close) { start account_system } } ;;;;;;;;;;;;;; ;;;;;Menu;;;;; ;;;;;;;;;;;;;; menu * { - EAS Console: /account open } ;;;;;;;;;;;;;;;;; ;;;;;on TEXT;;;;; ;;;;;;;;;;;;;;;;; on *:TEXT:!account*:*: { If ($readini(account/account.ini,status,installed) != yes) { halt } If ($eas(checkversion) != $eas(version)) { .msg $nick Please wait while the system is updated. | halt } If ($eas(isRegistered,$nick) != yes) { If (!$2) && ($2 != register) { .msg $nick You are not currently registered for an account. If ($eas(settings,registration) == on) { .msg $nick To register for an account, please type: !account register $iif($eas(settings,password) == on,$iif($eas(settings,email) == on,<password> <email>,<password>),$iif($eas(settings,email) == on,<email>,)) } Else { .msg $nick Currently, the owner is not allowing any new registrations. } } Else { If ($eas(settings,password) == on) { If ($eas(settings,email) == on) { If (!$4) { .msg $nick Please type !account register <password> <email> | halt } If ($eas(settings,emailvalidate) == on) { If ($readini(account/account.ini,emailvalidate,$4) == registered) { .msg $nick This email is already registered to another account. | halt } } account register $nick $3 $4 account login $nick -s .msg $nick You have been sucessfully registered for an account! To begin, please type !account If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) } halt } Else { If (!$3) { .msg $nick Please type !account register <password> | halt } account register $nick $3 account login $nick -s .msg $nick You have been sucessfully registered for an account! To begin, please type !account If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) } halt } } Else { If ($eas(settings,email) == on) { If (!$3) { .msg $nick Please type !account register <email> | halt } If ($eas(settings,emailvalidate) == on) { If ($readini(account/account.ini,emailvalidate,$4) == registered) { .msg $nick This email is already registered to another account. | halt } } account register $nick $3 account login $nick -s .msg $nick You have been sucessfully registered for an account! To begin, please type !account If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) } halt } Else { account register $nick account login $nick -s .msg $nick You have been sucessfully registered for an account! To begin, please type !account If ($eas(settings,output) == on) { msg $eas(status,output) $nick has sucessfully registered for an account: $asctime(ddmmmyyyy hh:nn:ss TT) } halt } } } } Elseif ($alock($nick) == yes) { If ($eas(perm,$nick,op) == true) { goto accountlogin } If ($eas(perm,$nick,lockBypass) == true) { goto accountlogin } If ($eas(gperm,$eas(staffGroup,$nick),op) == true) { goto accountlogin } If ($eas(gperm,$eas(staffGroup,$nick),lockBypass) == true) { goto accountlogin } If ($ctime >= $alock($nick,unlock)) { account unlock $nick goto accountlogin } .msg $nick You are currently locked out of your account. .msg $nick You are locked out for the following reason: $alock($nick,reason) .msg $nick Your account will unlock on: $asctime($alock($nick,unlock),ddmmmyyyy hh:nn:ss TT) halt } goto accountlogin :accountlogin If ($eas(loggedin,$nick) != yes) { If (!$3) || ($eas(userPass,$nick) !=== $3) { .msg $nick Please login first by typing /msg $me !account login <password> | halt } Else { account login $nick .msg $nick You have been logged-in sucessfully! To begin, please type !account halt } } Else { If (!$2) { .msg $nick Please select from the following options: .msg $nick To view your changeable account settings, please type !account settings .msg $nick To view your unchangeable account settings, please type !account uas .msg $nick To logout, please type !account logout } Elseif ($2 == settings) { If (!$3) { .msg $nick The following are your changeable account settings (and how to change them): .msg $nick Password: $iif($eas(userPass,$nick),$eas(userPass,$nick),Not Set) - !account settings pass <new password> .msg $nick Email: $iif($eas(userEmail,$nick),$eas(userEmail,$nick,),Not Set) - !account settings email <new email> } Elseif ($3 == pass) { If (!$4) { .msg $nick Please type !account settings pass <new pass> | halt } writeini account/ $+ $nick $+ /account.ini status password $4 .msg $nick Your password has been changed sucessfully! If ($eas(settings,password) != on) { .msg $nick Currently, a password is not required to login. } } Elseif ($3 == email) { If (!$4) { .msg $nick Please type !account settings email <new email> | halt } If ($eas(settings,emailvalidate) == on) { If ($readini(account/account.ini,emailvalidate,$4) == registered) { .msg $nick That email is already registered to another account. | halt } Else { remini account/account.ini emailvalidate $eas(userEmail,$nick) writeini account/account.ini emailvalidate $4 } } writeini account/ $+ $nick $+ /account.ini status email $4 .msg $nick Your email has been changed sucessfully! If ($eas(settings,email) != on) { .msg $nick Currently, an email is not required. } } Else { .msg $nick Unknown command. For more help with this, please type !account settings } } Elseif ($2 == uas) { .msg $nick The following are your unchangeable account settings: .msg $nick Join Date: $asctime($eas(joinTime,$nick),ddmmmyyyy hh:nn:ss TT) .msg $nick Is your account locked? $alock($nick) .msg $nick Most recent lock date: $asctime($alock($nick,date),ddmmmyyyy hh:nn:ss TT) - by: $alock($nick,locker) .msg $nick Reason: $alock($nick,reason) } Elseif ($2 == logout) { account logout $nick .msg $nick You've been logged-out sucessfully! } Else { .msg $nick Unknown command. For more help with this, please type !account } } } ;;;;;;;;;;;;;;;;;;; ;;;;;on *:JOIN;;;;; ;;;;;;;;;;;;;;;;;;; on *:JOIN:*: { If ($nick == $me) { halt } If ($chan == $eas(status,output)) && ($eas(settings,enforcechannelaccess) == yes) { If ($eas(isStaff,$nick) != yes) { kick $chan $nick } Else { msg $chan Welcome $nick $+ ! Please remember this channel access is restricted. } } } ;;;;;;;;;;;;;;;;;;;;;; ;;;;;on *:CONNECT;;;;; ;;;;;;;;;;;;;;;;;;;;;; on *:CONNECT: { If ($eas(settings,autojoin) == on) { join $eas(status,output) } }
  18. Simply replaces your name in a sentence with your name colored red. This makes it easier to see if you are highlighted. ;Like chatting but don't have a good network? ;;Come to irc.leafghoul.net and join #chat, or #triviaholic for games! on ^*:text:*:#: { if $me isin $1- { echo -ph $chan $timestamp < $+ $nick($chan,$nick).pnick $+ > $replace($1-,$me,$+(4,$me,)) haltdef } }
  19. A new snippet from me! Thats rare ;D Okay. Lets see what we have here. I've titled it xChat Away Nicks as it directly relates to how xChat handles Nicks when a user is away, this script will change the nick of the user to Gray if they are away and back again when they return. Upside: VERY USEFUL! Yes, great if you dont want x-Smelly-Welly-Chat and prefer using mIRC. Downside: It's spammy when it syncs up with a server. Mainly I cannot help annoying mIRC messages regarding the nick colors. Silly mIRC has no obvious way to silence this obmination. Mini trivia: Coded around 5am. Uses my coder tools that are modified. Bugs/Problems: Sometimes it don't work, Maybe different IRCD's? Not a good idea on BNC's that you connect to with more than one client at a time. (Load on both to fix) ; xChat Away Nicks. ; Connect to a server and it will work! ; CAUTION: Syncing is noisy! ; This script practically disables /WHO as ; it's blocking the output, soon to be fixed. ; SCRIPT By Thomas Edwards (Fudgie/TMFKSOFT) 2012 on 1:CONNECT:{ timerxaway $+ $network 0 10 /raw -q who * echo xChat Away Nicks activated. Script will be spammy upon sync with server. } alias nickaway { cnick -a $1 14 HALTDEF } alias nickback { cnick -r $1 14 HALTDEF } raw 352:*:{ if (G isin $7) { if ($getvar(isaway,$6,$network) != true) { echo -t $active 14 $+ $6 is away. nickaway $+($6,!,$3,@,$4) setvar isaway $6 $network true } } else { if ($getvar(isaway,$6,$network) == true) { echo -t $active 14 $+ $6 is no longer away. nickback $+($6,!,$3,@,$4) unsetvar isaway $6 $network } } HALTDEF } raw 315:*:{ ; Blocking end of /who message HALTDEF } alias back { away } on 1:QUIT:{ ; If they quit we make sure they are removed, even if they're not it fixes its self. unsetvar isaway $nick $network nickback $address($nick,5) } alias setvar { set % $+ $1 $+ . $+ $2 $+ . $+ $3 $4- } alias getvar { return % [ $+ [ $1 ] $+ . $+ [ $2 ] $+ . $+ [ $3 ] ] } alias unsetvar { unset % $+ $1 $+ . $+ $2 $+ . $+ $3 } on 1:JOIN:{ if ($nick == $me) { who * } }
  20. This will allow you to relay, or link, if you will, two or more channels across two or more networks.this code only work in mirc 6.35 with nbs-irc 2.39 version.thanks then press alt+r copy this code in remote and Documentation at the top of the script. please pass your comments on my effort. ;====================================================== ; Relay by R3b3| ;====================================================== ; ; This will allow you to relay, or link, if you ; will, two or more channels across two or more ; networks. ; ; ; Configuration: ; Relay.networks, this is a list, seperated by a ; space, of all the networks we are going to be ; relaying across. alias -l relay.networks { return HellsWinter NFinate UnderNet } ; ; Relay.channels, this is a list, seperated by a ; space, of the channel names that we are going ; to be relaying, the channel names corrispond to ; the relay.networks above. alias -l relay.channels { return #hw-test #nf-test #un-test } ; ; Relay.fmt.text, this is the format of normal ; relayed text. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4- = Text alias -l relay.fmt.text { return $+(<,$1,/,$2,@,$3,>) $4- } ; ; Relay.fmt.action, this is the format of /me ; relayed text. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4- = Text alias -l relay.fmt.action { return * $+($1,/,$2,@,$3,) $4- } ; ; Relay.fmt.quit, this is the format of relayed ; quits. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4- = Quit Message ; alias -l relay.fmt.quit { return * $+($1,@,$3) Quit $4- } ; ; Relay.fmt.join, this is the format of relayed ; joins. ; $1 = Nick ; $2 = Channel ; $3 = Network alias -l relay.fmt.join { return * $+($1,@,$3) Joins $2 } ; ; Relay.fmt.part, this is the format of relayed ; parts. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4- = Part Message (if available) alias -l relay.fmt.part { return * $+($1,@,$3) Parts $2 ( $+ $4- $+ ) } ; ; Relay.fmt.kick, this is the format of relayed ; parts. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4 = Kicker ; $5- = Kick Message alias -l relay.fmt.kick { return * $+($4,@,$3) Kicks $+($1,@,$3) Out of $2 ( $+ $5- $+ ) } ; ; Relay.fmt.mode, this is the format of relayed ; modes. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4- = Modes alias -l relay.fmt.mode { return * $+($1,@,$3) Sets mode: $4- } ; ; Relay.fmt.topic, this is the format of relayed ; topics. ; $1 = Nick ; $2 = Channel ; $3 = Network ; $4- = Topic alias -l relay.fmt.topic { return * $+($1,@,$3) Sets topic: $4- } ; ; ; Examples: ; alias -l relay.networks { return UnderNet QuakeNet Efnet } ; alias -l relay.channels { return #mycoolchannel #my.cool.channel #my_cool_channel } ; This will set up a relay between the following ; three channels: ; #mycoolchannel (on undernet) ; #my.cool.channel (on quakenet) ; #my_cool_channel (on efnet) ; ; ; Contact: ; Cobi@winbots.org ; Cobi on NFinate (irc.nfinate.org, #nfinate) ; Cobi on Undernet (#phase, #rss, #game-trivia) ; Cobi on Winbots (#winbots) ; Cobi-Wan-Kenobi on Quakenet (#icechat) ; Cobi on SearchIRC Forums ; Winbots on UnrealIRCd Forums ; Cobi on mirc.net ; ; ChangeLog: ; 1.0 ; Initial Release. ; ; Source Code: on *:text:*:#:{ var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.text($nick,$chan,%net,$1-) scid %cid } inc %lcv } } } on *:action:*:#: { var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.action($nick,$chan,%net,$1-) scid %cid } inc %lcv } } } on *:quit: { var %tok = $findtok($relay.networks,$network,1,32) if ($nick ison $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.quit($nick,$gettok($relay.channels,%tok,32),%net,$1-) scid %cid } inc %lcv } } } on *:join:#: { if ($nick != $me) { var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.join($nick,$chan,%net) scid %cid } inc %lcv } } } } on *:part:#: { if ($nick != $me) { var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.part($nick,$chan,%net,$1-) scid %cid } inc %lcv } } } } on *:KICK:#: { var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.kick($knick,$chan,%net,$nick,$1-) scid %cid } inc %lcv } } } on *:rawmode:#: { var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.mode($nick,$chan,%net,$1-) scid %cid } inc %lcv } } } on *:topic:#: { var %tok = $findtok($relay.networks,$network,1,32) if ($chan == $gettok($relay.channels,%tok,32)) { var %lcv = 1 var %tot = $gettok($relay.networks,0,32) while (%lcv <= %tot) { var %cid = $cid var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) if (%ncid != %cid) { var %net = $network scid %ncid msg $gettok($relay.channels,%lcv,32) $relay.fmt.topic($nick,$chan,%net,$1-) scid %cid } inc %lcv } } } alias -l getcidfromnet { var %lcv = 1 var %tot = $scon(0) while (%lcv <= %tot) { if ($scon(%lcv).network == $1) { return $scon(%lcv).cid } inc %lcv } }
  21. I posted up a YMSG generic style login, and since then something happened that has prevented it from sending text to room. Not to mention it had typos (sorry). I've made a new connection using YMSG 17 protocol, Yahoos latest protocol. Theres Tons that can be done with this, its basically barebones login. With the packets coming on login there are buddy lists, ignore lists, alias name lists if you have them, add request lists as well as voice ticket when you join a room to enable the microphone. I use this login for a trivia bot on yahoo. The Problem you might have entering a room is knowing the room name as well as the 4 digit identifier for the category or whatever its for. I have another snippet posted on hawkee to get a yahoo rooms list, using that snippet with this one should work to get you a rooms list from the american yahoo server. or go here for yahoo real time list http://insider.msg.yahoo.com/ycontent/?chatcat Have Fun. 🙂 ;====TYPE /login :====IF YOU HAVEN'T ALREADY ENTERED A NICK/PASS/ROOM/ROOM ID ;====THE POPUPS WILL SET THEM ALL AS VAIABLES. ;====I HAVE LEFT MOST LOGIN INFORMATION SET AS VARIABLES, COOKIES PASSWORD ETC. ;====THE INTENTION WAS ONLY FOR PPL INTERESTED IN SCRIPTING mIRC/YAHOO CHAT. ;====THERE ARE MORE COOKIES ANS ENCRYPTED KEYS I DID NOT SAVE LIKE VOICE TICKET AND OTHER COOKIES. ;====THERES INFORMATION SUCH AS ALIAS NAMES ACCOUNT NAME IGNORE LIST BUDDY LIST ETC ALL IGNORED BY THIS SCRIPT ON SIGN IN. ;====HEY MAN ITS JUST A SNIPPET, ANYBODY HAVE A COOL SMILEY ADDON OR WANT TO HELP ME WITH A VOICE CONNECTION? alias -l tok_ker return $+(GET /config/pwtoken_get?src=ymsgr&login=,%y.id,&passwd=,%y.pw,&chal=,%y_chlng,$crlf,$crlf) alias -l git_aut return $+(GET /config/pwtoken_login?src=ymsgr&token=,$remove(%y_tokn,$chr(10)),$crlf,$crlf) alias -l shrt_pk return $+(1À€,%y.id,À€) alias -l case return $bvar(&ysl,12) alias -l d_bug return 9 $sockname $bvar(&ysl,1,20) $bvar(&ysl,18,$bvar(&ysl,0).text).text alias -l YMSG_head return Y M S G 0 17 0 0 0 $chr($len($shrt_pk)) 0 W 0 0 0 0 0 0 0 0 alias -l rm.wind if ($window(@ $+ %room) == $null) { //window -eil15S @ $+ %Y_room yroompops.txt } alias -l ymsg_17 $ypack(T,$+(1À€,%y.id,À€0À€,%y.id,À€277À€,%y_ck,À€278À€,%t_ck,À€307À€,$ym64,À€244À€,$y.rand,À€2À€,%y.id,À€2À€1À€98À€usÀ€135À€ym9.0.0.2162À€)) alias -l prjn $ypack(–,$+(109À€,%y.id,À€1À€,%y.id,À€6À€abcdeÀ€98À€usÀ€135À€ym9.0.0.2162À€)) alias -l jrm { $rm.wind | $ypack(˜,$+(1À€,%y.id,À€104À€,%y_room,À€129À€,%rm2,À€62À€2À€24À€1188648944À€)) } alias -l striptags { var %x,%y = $regsub($1-,/<[^>]+>/g,$null,%x) | return $striphex(%x) } alias -l striphex { var %z,%a = $regsub($1-,/[/[/#0-9A-Fa-fm]{9}/g,$null,%z) | return %z } alias -l aut_sox sockopen -e $1 login.yahoo.com 443 alias -l y.rand return $rand(16777219,60970879) on *:input:@ $+ %room: { if ($left($1,1) != /) && ($window(@ $+ %y_room) != $null) { /spk $1- } | echo @ $+ %y_room %y.id $+ : $1- } alias spk { %text = $1- | $ypack(¨,$+(1À€,%y.id,À€104À€,%y_room,À€117À€<font INF ID:FU2Booters:!M PROT:YMSG-17\mIRC VER: $+ $version $+ ></font><font face="Arial">[1m[#000000m,%text,</font>À€124À€1À€)) } alias prejn prjn | jrm alias login { if (!%Y.id) { %y.id = $?="Enter Your Yahoo Nickname." } if (!%Y.pw) { %Y.pw = $?*="Enter Your Yahoo Password." } if (!%Y_room) { set %y_room $?="Yahoo Room To Join." } if (!%rm2) { set %rm2 $?="ROOM IDENTIFIER To Join." } sockopen yh_chat_srv 68.180.217. $+ $rand(6,34) 80 } on 1:sockclose:yh_get_cookie: { ymsg_17 } on 1:sockread:yh_*: { if ($sockerr > 0) return sockread -f $sock($sockname).rq &ysl var %len $bvar(&ysl,0).text breplace &ysl 0 160 if ($sockname == yh_chat_srv) { if ($case = 87) { %y_chlng = $remove($gettok($bvar(&ysl,21,%len).text,$calc($numtok($bvar(&ysl,21,%len).text,192) - 1),192),€) %y_ssid = $bvar(&ysl,18,3).text echo -s 12,5Got Challenge 8:) $aut_sox(yh_get_tok) halt } if ($case = 241) { echo -a You are now logged onto Yahoo! Chat :) 1,8 Type /prejn to go to the room. | halt } if ($case = 150) { echo -a Ready To Join. | halt } if ($case = 168) { aline -p @ $+ %y_room 3 $+ $remove($gettok($bvar(&ysl,1,%len).text,4,192),€) 9 $+ $ansi2mirc($striptags($remove($gettok($bvar(&ysl,1,%len).text,6,192),€)))) | halt } if ($case = 152) && (admin isin $gettok($bvar(&ysl,1,%len).text,$count($bvar(&ysl,1,%len).text,À),192)) { $list_room($bvar(&ysl,21,%len).text) | halt } if ($case = 152) { aline -ln @ $+ %y_room $remove($gettok($bvar(&ysl,1,%len).text,8,192),€) | aline -p @ $+ %y_room 12 $remove($gettok($bvar(&ysl,1,%len).text,8,192),€) Joined # $+ %y_room $+ . | halt } if ($case = 155) { dline -l @ $+ %Y_room $fline(@ $+ %Y_room,$remove($gettok($bvar(&ysl,1,%len).text,6,192),€),1,1) | aline -p @ $+ %y_room 2 $remove($gettok($bvar(&ysl,1,%len).text,6,192),€) Parted # $+ %y_room $+ . | halt } if ($case = 85) { halt } } if ($sockname == yh_get_tok) { var %grab_tok $bvar(&ysl,1,%len).text %y_tokn = $remove($gettok(%grab_tok,2,10),$chr(13),ymsgr=) | %y_prtnr_id = $remove($gettok(%grab_tok,3,10),$chr(13),partnerid==) echo 12 -s Got Token :) $aut_sox(yh_get_cookie) halt } if ($sockname == yh_get_cookie) { if (crumb= isin $gettok($bvar(&ysl,1,%len).text,2,10)) { %Y_crumb = $gettok($remove($gettok($bvar(&ysl,1,%len).text,2,10),crumb=,$chr(13),$chr(10)),1,32) %Y_ck = $gettok($remove($gettok($bvar(&ysl,1,%len).text,3,10),Y=,$chr(13),$chr(10),$chr(59)),1,32) %T_ck = $gettok($remove($gettok($bvar(&ysl,1,%len).text,4,10),T=,$chr(13),$chr(10),$chr(59)),1,32) } } if ($bfind(&ysl,1,89 77 83 71)) { echo -s $replace($d_bug },160,) } } on 1:sockopen:yh_*: { if ($sockname == yh_get_cookie) { sockwrite -n yh_get_cookie $git_aut } if ($sockname == yh_get_tok) { sockwrite -n yh_get_tok $tok_ker } if ($sockname == yh_chat_srv) { bset &pcktB 1 Y M S G 0 17 0 0 0 $chr($len($shrt_pk)) 0 W 0 0 0 0 0 0 0 0 bwrite &Bpack 1 -1 &pcktB bwrite &Bpack -1 -1 $shrt_pk bread &Bpack 1 $calc($len($shrt_pk) + 20) &packB sockwrite yh_chat_srv &packB .remove &Bpack } } alias -l yahoo.size { var %a = $gettok($calc($len($1-) / 256),1,46) var %b = $calc($len($1-) - $calc(%a * 256)) return %a %b } alias -l ypack { bset &head 1 Y M S G 0 17 0 0 $yahoo.size($2-) 0 $1 0 0 0 12 0 bwrite &packt 1 -1 &head | bwrite &packt -1 -1 %y_ssid | bwrite &packt -1 -1 $2- bread &packt 1 $calc($len($2-) + 20)) &ysend sockwrite yh_chat_srv &ysend .remove &packt } alias -l Ym64 { var %offset = $md5(%y_crumb $+ %Y_chlng) var %inspc = 2 :loop var %spcd = %spcd $chr($base($right($left(%offset,%inspc),2),16,10)) if ($len(%offset) = %inspc) { return $replace($encode($remove(%spcd,$chr(32)) ,m),+,.,/,_,=,-) | halt } inc %inspc 2 goto loop } alias -l list_room { var %list $remove($1-,€) if (Captcha isin $gettok(%list,6,192)) { echo -a $gettok(%list,6,192) | halt } var %num_nms $numtok(%list,192) var %sum_num 1 while (%sum_num <= %num_nms) { if (110 isin $gettok(%list,%sum_num,192)) { aline -nl @ $+ %y_room $gettok(%list,$calc(%sum_num - 1),192) } inc %sum_num } }
  22. Now as I loaded it into my bot, the first thing I noticed was its all aliases so i changed them to on TEXT's then I noticed that you can't view a specific feed on request. So I wrote my own function which does just that. It may be slightly buggy considering the amount of feeds you use but nothing that cant be fixed with these commands "!rehashrss" and "!rsslist". Installation: Copy and paste into Remote. Don't forget to change the channel from #rss to whatever channel you want it to display in. I would write a function to do this through an alias but I'm kinda tired right now... Creators Notes: ;================================================== ; RSS Poster ; by Cobi ;================================================== ; Commands: ; /rss Starts the rss poster (shortcut for /loadrsshist and /rsscfg) ; /addrss name host webfile channel count interval -- adds feed to rss.cfg (Implies /rsstimer) ; /showrss name host webfile channel count -- shows rss feed in channel (Implies /getrss and /parserss) ; ; ----- The following are internal commands and should only be used if messing around with the code. ----- ; /loadrsshist Loads the history file so as not to post the same stuff over and over ; /closersshist Unloads the history file... ; /reloadrsshist Shortcut for /closersshist and /loadrsshist ; /rsscfg Loads rss.cfg file and parses it (Implies /rsstimer on every rss feed listed) ; /rsstimer name host webfile channel count interval starts a rss timer for the specified settings ; (Implies /showrss each interval) ; /getrss name host webfile file done -- downloades an rss feed then runs done when it is done (Implies /fixrss) ; /fixrss file -- fixes rss feed format. This is done automatically, and should only be done when debugging. ; /parserss file name channel count -- parses rss file and displays it in a channel ; ; Arguements: ; name = Name of feed (used for displaying purposes) ; host = Where to get the feed ( http://hostwebfile e.g. http://example.com/test.xml example.com is the host and /test.xml is the webfile.. ) ; webfile = file on host ; file = local rss file ; channel = channel to show rss postings in ; count = how many rss posts to show at once ; interval = how often (in seconds) to show rss posts ; done = what to do when done downloading file ; ; Examples: ; ; Add a few rss feeds: ; /addrss mirc.net mirc.net /rss.php?type=news #rss 6 600 ; /addrss SourceForge images.feedstermedia.com /feedcache/ostg/sourceforge/rss_sfnews.xml #rss 6 600 ; /addrss NPR www.npr.org /rss/rss.php?topicId=1001 #rss 6 600 ; /addrss Moreover p.moreover.com /page?o=rss002&c=Top%20stories&wiz=230176 #rss 6 600 ; /addrss Copyright www.copyright.gov /rss.xml #rss 6 600 ; /addrss podcastingnews www.podcastingnews.com /index.xml #rss 6 600 ; /addrss Infoworld www.infoworld.com /rss/news.xml #rss 6 600 ; /addrss BarkerJr.Net barkerjr.net /rss?c=2;f=5 #RSS 2 600 ; /addrss Linux-Security www.linuxsecurity.com /static-content/linuxsecurity_hybrid.rdf #rss 6 600 ; /addrss Planet-Source-Code www.planet-source-code.com /vb/channel/NewCode/channel.cdf #rss 6 600 ; /addrss /. slashdot.org /rss/index.rss #rss 6 600 ; /addrss ZDnet news.zdnet.com /2509-1_22-0-20.xml #rss 6 600 ; /addrss IRC101 www.irc101.org /tier2.xml #rss 6 600 ; /addrss MSDN msdn.microsoft.com /msdnmag/rss/recent.xml #rss 6 600 ; /addrss Microsoft www.microsoft.com /communities/rss.aspx?&Title=Recent+Posts&CMTYSvcSource=MSCOMBlogPosts&CMTYRawShape=list&Params=%7eCMTYDataSvcParams%5e%7eArg+Name%3d'DateFormat'+Value%3d'MMM+d%2c+yyyy'%2f%5e%7e%2fCMTYDataSvcParams%5e&NumberOfItems=50 #rss 6 600 ; /addrss &color;01,00W&color;00,01I&color;01,00R&color;00,01E&color;01,00D&color; wired.com /news/feeds/rss2/0,2610,,00.xml #rss 6 600 ; /addrss RTCW ict.mcast.edu.mt /ictweb/davidmica/web/rss.xml #rss 6 600 ; /addrss jaos software.jaos.org /cgi-bin/rss #rss 6 600 ; ; Reload the config file: ; /rehashrss ; ; Edit the config file: ; /run notepad rss.cfg ; ; Load the config file and start posting news: ; /rss ; ; Contact: ; Cobi@winbots.org ; Cobi on Undernet (#phase, #rss, #game-trivia) ; Cobi on Winbots (#winbots) ; Cobi-Wan-Kenobi on Quakenet (#icechat) ; Cobi on SearchIRC Forums ; Winbots on UnrealIRCd Forums ; Cobi on mirc.net ; ; ChangeLog: ; v1.3 -- fixed memory bug ; v1.2 -- fixed the issue when the tags are not one word ( blah) ; v1.1 -- fixed rss.performance issue ; v1.0 -- Initial Release My Notes: Changed !list to !rsslist so it doesnt interfere with service bots. Added an on TEXT for the following aliases incase your loading it through a bot: /rehashrss = !rehashrss /rss = !rss /rssoff = !rssoff Added a "!show " command. Put the title of the feed (the ones mentioned in !rsslist) in the parameter and all the news from that feed will be posted into the rss channel. Added a !help command which displays the commands. Added an on JOIN notice to users welcoming them with a tip to get them started. on *:TEXT:!rss:#rss: { loadrsshist | rsscfg } alias rss { loadrsshist | rsscfg } alias closersshist { window -c @rss.hist | window -c @rss.performance } alias reloadrsshist { closersshist | loadrsshist } alias rsscfg { var %time = $ticks var %lcv2 = 0 var %lcv = 1 var %lines = $lines(rss.cfg) unset %list while (%lcv <= %lines) { if ($read(rss.cfg,%lcv)) { bunset &line bset -t &line 1 $read(rss.cfg,%lcv) if ($regex(RSS,$bvar(&line,1,$bvar(&line,0)).text,<(.+)>(.+)</.+>)) { bunset &rss. $+ $regml(RSS,1) bset -t &rss. $+ $regml(RSS,1) 1 $regml(RSS,2) } elseif ($regex(RSS,$bvar(&line,1,$bvar(&line,0)).text,</item>)) { rsstimer $bvar(&rss.feed,1,$bvar(&rss.feed,0)).text $bvar(&rss.host,1,$bvar(&rss.host,0)).text $bvar(&rss.file,1,$bvar(&rss.file,0)).text $bvar(&rss.channel,1,$bvar(&rss.channel,0)).text $bvar(&rss.feeds,1,$bvar(&rss.feeds,0)).text $bvar(&rss.interval,1,$bvar(&rss.interval,0)).text set %list %list $replacex($bvar(&rss.feed,1,$bvar(&rss.feed,0)).text,&amp;,&,&quot;,",&nbsp;,$chr(32),&color;,,&bold;,,&underline,) bunset &line &rss.* inc %Lcv2 } } inc %lcv } if ($window(@rss.performance)) { aline @rss.performance --- aline @rss.performance Parsed %lcv Config Lines ( $+ %lcv2 rss entries) (rss.cfg) in $calc(($ticks - %time)/1000) Seconds } } alias rsstimer { ;$1 = feed name ;$2 = host ;$3 = file ;$4 = channel ;$5 = max ;$6 = interval showrss $1 $2 $3 $4 $5 .timerrss. $+ $1 0 $6 showrss $1 $2 $3 $4 $5 } alias showrss { ;$1 = feed name ;$2 = host ;$3 = file ;$4 = channel ;$5 = max set %time. $+ $1 $ticks .remove " $+ $1 $+ .rss $+ " getrss $1 $2 $3 $replace($1 $+ .rss,$chr(32),_) parserss $replace($1 $+ .rss,$chr(32),_) $1 $4 $5 } alias getrss { ;$1 = feed name ;$2 = host ;$3 = file ;$4 = save ;$5- = done set %rss. $+ $1 $+ .file $3 set %rss. $+ $1 $+ .host $2 set %rss. $+ $1 $+ .save $4 set %rss. $+ $1 $+ .done $5- sockopen rss. $+ $1 $2 80 } on *:SOCKOPEN:rss.*:{ sockwrite -tn $sockname GET % [ $+ [ $sockname $+ .file ] ] HTTP/1.1 sockwrite -tn $sockname Host: % [ $+ [ $sockname $+ .host ] ] sockwrite -tn $sockname Accept: *.*, */* sockwrite -tn $sockname Connection: close sockwrite -tn $sockname $crlf } on *:sockclose:rss.*:{ fixrss % [ $+ [ $sockname $+ .save ] ] | % [ $+ [ $sockname $+ .done ] ] | unset % $+ $sockname $+ .* } on *:sockread:rss.*:{ if ($sockerr) { echo 1 -a ERROR | return } if (% [ $+ [ $sockname $+ .status ] ] != downloading) { var %1 | sockread %1 | tokenize 32 %1 if ($1 == HTTP/1.1) { if ($2 != 200 && $2 != 206) { echo 1 -a ERROR } } elseif ($1 == Content-Range:) { set % [ $+ [ $sockname $+ .size ] ] $gettok($3,-1,47) } elseif ($1 == Content-Type:) { return } elseif (!$1) { set % [ $+ [ $sockname $+ .status ] ] Downloading return } } else { var %1 = % [ $+ [ $sockname $+ .save ] ] :sockread sockread &1 if (!$sockbr) { return } bwrite $+(",%1,") -1 &1 unset % [ $+ [ $sockname $+ .resume ] ] } } alias fixrss { ;$1 = rss file var %file = $1 bread $1 0 $file($1).size &file breplace &file 10 32 13 32 write -c $1 var %lcv = 1 var %size = $bvar(&file,0) while (%lcv <= %size) { parserss2 $1 $bvar(&file,%lcv,500).text inc %lcv 500 } } alias parserss { ;$1 = rss file ;$2 = feed name ;$3 = channel ;$4 = max var %time = $ticks | var %lcv = 1 | var %lcv2 = 0 | var %lines = $file($1).size bread $1 0 %lines &file1 while ((%lcv <= %lines) && (%lcv2 < $4)) { bunset &line | bcopy -c &line 1 &file1 %lcv $calc($iif($bfind(&file1,%lcv,$crlf),$bfind(&file1,%lcv,$crlf),$calc(%lines + 1)) - %lcv) | var %lcv = $calc($iif($bfind(&file1,%lcv,$crlf),$bfind(&file1,%lcv,$crlf),$calc(%lines + 1)) + 2) if (($bvar(&line,0) < 300) && ($regex(RSS,$bvar(&line,1,$bvar(&line,0)).text,<(.+)>(.+)</.+>))) { if (($regml(RSS,1)) && ($regml(RSS,2))) { bunset &rss. $+ $gettok($regml(RSS,1),1,32) | bset -t &rss. $+ $gettok($regml(RSS,1),1,32) 1 $regml(RSS,2) } } elseif (($bvar(&line,0) < 300) && ($regex(RSS,$bvar(&line,1,$bvar(&line,0)).text,</item>))) { checkalreadyrss $3 [[ $+ $2 $+ ]] $+ 10 $bvar(&rss.title,1,$bvar(&rss.title,0)).text $+ (14 $bvar(&rss.link,1,$bvar(&rss.link,0)).text ) | inc %lcv2 | bunset &line &rss.* } } if ($window(@rss.performance)) { aline @rss.performance --- aline @rss.performance Parsed %lcv Bytes ( $+ %lcv2 rss entries) ( $+ $1 $+ ) in $calc(($ticks - %time)/1000) Seconds } if (%time. [ $+ [ $2 ] ]) { if ($window(@rss.performance)) { aline @rss.performance Downloaded and Parsed %lcv Bytes ( $+ %lcv2 rss entries) ( $+ $1 $+ ) in $calc(($ticks - %time. [ $+ [ $2 ] ] )/1000) Seconds } | unset %time. $+ $2 } } alias addrss { ;$1 = feed name ;$2 = host ;$3 = file ;$4 = channel ;$5 = max ;$6 = interval write rss.cfg <item> write rss.cfg $chr(32) $+ $chr(32) $+ <feed> $+ $1 $+ </feed> write rss.cfg $chr(32) $+ $chr(32) $+ <host> $+ $2 $+ </host> write rss.cfg $chr(32) $+ $chr(32) $+ <file> $+ $3 $+ </file> write rss.cfg $chr(32) $+ $chr(32) $+ <channel> $+ $4 $+ </channel> write rss.cfg $chr(32) $+ $chr(32) $+ <feeds> $+ $5 $+ </feeds> write rss.cfg $chr(32) $+ $chr(32) $+ <interval> $+ $6 $+ </interval> write rss.cfg </item> rsstimer $1 $2 $3 $4 $5 $6 } on *:TEXT:!rehashrss:#rss: { timerrss.* off rsscfg } alias rehashrss { timerrss.* off rsscfg } on *:TEXT:!rssoff:#rss: { timerrss.* off closersshist } alias rssoff { timerrss.* off closersshist } on 100:TEXT:!addrss * * * * * *:{ addrss $2 $3 $4 $5 $6 $7 } alias checkalreadyrss { if (sponsored isin $1-) { goto done } if ($file(rss.hist.tmp)) { .remove rss.hist.tmp } filter -ffc rss.hist rss.hist.tmp * $+ $strip($1-) $+ * if ($file(rss.hist.tmp)) { .remove rss.hist.tmp } if ($filtered > 0) { goto done } write rss.hist $strip($1-) ; if (!$window(@rss.hist)) { echo 4 -a $nopath($script) $+ : ERROR: no history loaded... (try /loadrsshist) | halt } ; aline @rss.hist $strip($1-) msg $replacex($1-,&amp;,&,&quot;,",&nbsp;,$chr(32),&color;,,&bold;,,&underline,) :done } alias loadrsshist { if (!$file(rss.hist).size) { write rss.hist History File } ; .window -k0lh @rss.hist ; .loadbuf @rss.hist rss.hist ; .window -k0 @rss.performance } alias parserss2 { ;$1 = File ;$2- = XML data var %file = $1 ;[Code by FiberOPtics] Thanks.. :P var %a, %b = $regsub($2-,/(?<=>)(?=s*<)/g,$lf,%a) tokenize 10 %a ;[/Code by FiberOPtics] var %lcv = 1 while (%lcv <= $0) { bset -t &tmp $calc($bvar(&tmp,0) +1) $ [ $+ [ %lcv ] ] $+ $crlf inc %lcv } bwrite %file -1 $calc($bvar(&tmp,0) -2) &tmp bunset &tmp } on *:TEXT:!rsslist:#rss:{ msg $chan I syndicate the following: | msg $chan %list } alias rsslist { msg $chan I syndicate the following: | msg $chan %list } on *:TEXT:!show *:#rss: { if ($2) { %rssin = $replace($2-,$, ) %rssinput = * $+ %rssin $+ * if (%rssin isin %list) { while $read(rss.hist, w, %rssinput) != $null { write -dw * $+ $2- $+ * rss.hist } rehashrss } else { msg # Sorry, I do not syndicate that feed. } } else { msg # What feed would you like to see? rsslist } } on *:JOIN:#RSS: { notice $nick Welcome to #RSS! I will be delivering the news here. Say "!help" to get started. } on *:TEXT:!help:#RSS: { msg # To see a list of feeds use "!rsslist" msg # To check for any updates use "!rehashrss" msg # To view a specific feed use "!show <feed>" }
  23. chain

    JinxBot

    'm a major newb to perl and mIRC scripting, and likely will be for a while as I'm mostly just blundering through things and learning as I go rather than actively studying how to work the language. So, I know there will be some inefficiencies with this snippet, and maybe even a bug or two (hopefully nothing too serious...I've used it for a while, never had troubles), so if you find anything and have a solution I'd love if you'd point them out to me. Anyway, what this script is is just sort of a piece of fun for an IRC channel your bot is an op of. When active, the script will play out a classic piece of childhood whimsy and "jinx" anyone who says something directly after another person says the same thing. It sets channel mode to +m and removes voice from the second person, announcing to the channel that this person has been uncreative enough in his or her responses that they have been JINXED until someone says his or her name. It's simple, but my channel finds it to be a highly amusing fountain of guilt-free trolling, and since I've never seen a snippet that does anything similar I thought I'd share it with the world. To activate JinxBot, type !jinx on (any user can do this, because it is just a fun script and even in my smartassed channel no one has been able to take advantage of it). To deactivate (again, anyone is eligible) type !jinx off, or really, any second word other than "on". The main issues are that if someone has a long name or a nick that contains a status message, people will need to type the whole thing in order for them to be unjinxed, and, if you consider it an issue (it's easy to work around, but I left it in there for added fun), ops that obviously don't need +v are still given the JINX message. The main issue involving a limit to which variables in a message could unjinx a user has been fixed, however, with the help of a couple benevolent fellow Hawkee members. Huzzah! At the top of the snippet is a couple lines that just ensure that everyone in your channel will have +v when JinxBot goes off. It may be more efficient to simply edit the script so that it voices everyone in the channel and devoices the unlucky victim, especially if you're an obsessive-compulsive owner who doesn't like +s all over your channel when mode is not +m, but I figured that I shouldn't add anything in there that I don't fully understand yet. May edit the snippet later when I do 😉 . If you don't need the auto-voice snippet, just crop it off, obviously. Oh, and as you can see, I took the concession of ensuring it does not interfere with IRC Trivia, which by nature will have lots of repeated phrases and words. Jinxbot reactivates soon after Trivia ends. Mess with the script, distribute it, do what you want with it. It's simple stuff, and although it'd be nice, I don't expect to be lauded or credited for writing it. **AUTOVOICE** ON *:JOIN:#:{ mode $chan +v $nick } **TRIVIA COMPATIBILITY** on *:TEXT:!trivia*:#:{ if (%setting == on) { set %setting off msg $chan Breathe easy; JinxBot is now off. if (!$2) { set %timer 600 } else { set %timer $2 * 60 } msg $chan %timer until reactivation. .timer 1 %timer set %setting on .timer 1 %timer msg $chan Look out! Jinxbot is now on! } } **JINXBOT SCRIPT** on *:TEXT:!jinx*:#:{ set %setting $2 if (reset == %setting) { unset %one set %jinxed rtsl msg $chan JinxBot has been reset. set %setting on } if (on == %setting) { msg $chan Look out! JinxBot is now on! } else { msg $chan Breathe easy; JinxBot is now off. } } on *:TEXT:*:#:{ if (on == %setting) { if ($1- == %one) && ($nick != %nick) { msg $chan 4 $1- - JINX! $nick cannot speak until someone says his/her name! mode $chan +m mode $chan +v %jinxed mode $chan -v $nick set %jinxed $nick set %one $1- } if ($istok($1-,%jinxed,32)) { mode $chan +v %jinxed msg $chan The jinx on %jinxed has been lifted! set %jinxed rtsl set %one $1- } } set %one $1- set %nick $nick }
  24. This is a slight update to the TrivScript that I have been using for quite some time now and thought I'd post the update here that I have done (although not a lot of it was changed) The HTMl Build scores will output as "trivia.htm" and the old style code was changed to a new one. Credits: To the original author of this code. Update: Added the questions.txt file (just put it in the same directory of the script / bot > http://www.4shared.com/get/y_5UZfoece/questions.html alias trivia.version { return 0(10Version9: 104.80) } alias trivia.name { return 10Hi I'm $me } ;######################################################## ;# Direct IRC interactions. # ;######################################################## on *:START: { trivia.init } on *:LOAD: { init.load } on *:INVITE:*: { if ($trivia.turnedoff) { return } if ($trivchan) { join $chan } } on *:JOIN:*: { if ($trivia.turnedoff) { return } inc -u5 %trivia.netsplit set -u3 %ident $chan if ((%trivia.netsplit >= 3) || (!$trivchan) || (!$getset(status,bot))) { return } if (($nick != $me) && (!$isdis(31))) { if ($getset(status,onjoin)) { inform $msg.trivia.onjoin } } elseif ($getset(status,autostart) == 1) { trivia } award join $nick } on *:INPUT:#: { if ($trivia.turnedoff) { return } if ((!$trivchan) || (/* iswm $1-)) { return } set -u3 %ident $chan if ($pre $+ * iswm $strip($1-)) { processcommand $strip($1-) } elseif ($question.on) { processguess $1- } } on *:ctcpreply:ping*:{ if ($trivia.turnedoff) { return } if ($isdis(17)) return if (($eval(% $+ ping. $+ $nick,2)) && ($2 isnum)) { set -u3 %ident $eval(% $+ pingchan. $+ $nick,2) scid $eval(% $+ pingcid. $+ $nick) inform $msg.ping.reply unset % $+ ping. $+ $nick unset % $+ pingchan. $+ $nick unset % $+ pingcid. $+ $nick $eval(set -u $+ $slag(ping) % $+ pingantispam. $+ $nick 1,2) } } on *:TEXT:*:#:{ if ($trivia.turnedoff) { return } set -u3 %ident $chan if (!$trivchan) return if ($pre $+ * iswm $strip($1-)) { processcommand $strip($1-) } else if (($question.on) && ($left($1,1) != /)) { processguess $1- } } on *:TEXT:*:?: { if ($trivia.turnedoff) { return } set -u3 %ident $chan if (($pre $+ $gtok(29) $+ * iswm $strip($1-)) || ($pre $+ $gtok(30) $+ * iswm $strip($1-))) { processcommand $strip($1-) } } ;######################################################## ;# Channel setup and related checks. # ;######################################################## alias trivchan { var %i = 1 while ($tchan(%i)) { if (($tchan(%i,3) iswm $me) && ($tchan(%i,2) iswm $ifd($network,irc))) { if (($tchan(%i) iswm $chan) || ((!$chan) && ($me ison $tchan(%i)))) { if ($1) return $tchan(%i) return %i } } inc %i } } alias tchan { return $ifd($gettok($getset(chan,$1), $ifd($2,1), 59),$iif($2 isnum 2-3, *)) } ;######################################################## ;# Menubar and submenu functions. # ;######################################################## menu channel,menubar { Trivia .$showon(Trivia Options):{ if (!$dialog(trivset)) { dialog -m trivset trivset } } .$showon(Start Trivia) ..$showon(Standard):{ $trivia } ..$showon(Unlimited Game):{ $trivia(unlimited) } ..$showon(Team Game):{ $trivia(team) } ..$showon(Theme Game) ...$submenu($theme.submenu($1)) ..$showon(Specify round):{ $trivia($$?="How many question in the trivia round?") } .$showon(Stop Trivia):{ strivia } .$showon(Set Channel):{ chan.add $$chan } .$showon(-) .$showon(Features) ..$showon(Build Scores HTML):{ htmlbuild } ..$showon(Process HTML Commands):{ htmltrigger } ..$showon(HTML Options):{ if (!$dialog(trivbuild)) { dialog -m trivbuild trivbuild } } ..$showon(Themes Setup): { if (!$dialog(triviatheme)) { dialog -m triviatheme triviatheme } } ..$showon(Ranks Setup): { if (!$dialog(trivrank)) { dialog -m trivrank trivrank } } } alias theme.submenu { if (($1 == begin) || ($1 == end)) return - if ($getset(triviamode $+ $1, name)) return $getset(triviamode $+ $1, name) $+ : /trivia $getset(triviamode $+ $1, name) } menu menubar { Trivia .$showon(Force Question):{ ask } .$showon(Scores) ..$showon(Scores):{ if (!$dialog(triviascores)) { dialog -m triviascores triviascores } } ..$showon(Give Points): { trivia.credit $$?="Credit whom?" $$?="How many points do you wish to give, -# to remove score" } .$showon(Echo) ..$showon(Records):{ tsay $msg.trivia.records } ..$showon(HoF):{ tsay $msg.trivia.hof } ..$showon(Repeat):{ tsay $msg.question.current } ..$showon(Hint):{ tsay $msg.hint.hint } .$showon(Open) ..$showon(Questions):{ if $isfile($qfile(1)) { run $qfile(1) } } ..$showon(Additions):{ if $isfile(" $+ $triv(dir) $+ / $+ $triv(additions) $+ ") { run " $+ $triv(dir) $+ / $+ $triv(additions) $+ " } } ..$showon(Report):{ if $isfile(" $+ $triv(dir) $+ / $+ $triv(report) $+ ") { run " $+ $triv(dir) $+ / $+ $triv(report) $+ " } } .$showon(-) .Trivia Bot is [ $trivon ] ..$showon([ $trivdisflip ]) $+ :{ setset status bot $iif($getset(status,bot) == 1,0,1) } ..[ $trivoffflip ] $+ :{ setset status botstate $iif($getset(status,botstate) == 1,0,1) } .- .Trivia Unload:{ if ($?!="Really Unload?") { unload -rs $script } } } menu nicklist { $showon(Trivia) .$showon(Control) ..$showon(Ban):{ tban $$1 } ..$showon(Unban):{ tunban $$1 } .$showon(Add as Friend): { triviafriend.add $address($$1,7) } .$showon(Credit) ..$showon(Award) ...$showon(1): { trivia.credit $$1 1 } ...$showon(5): { trivia.credit $$1 5 } ...$showon(10): { trivia.credit $$1 10 } ..$showon(Deduct) ...$showon(1): { trivia.credit $$1 -1 } ...$showon(5): { trivia.credit $$1 -5 } ...$showon(10): { trivia.credit $$1 -10 } ..$showon(Input Amount): { trivia.credit $$1 $$?="How many points do you wish to give, -# to remove score" } } alias showon { if ($getset(status,botstate) != 1) return $1- } alias trivia.turnedoff { if ($getset(status,botstate) == 1) return $true } ;######################################################## ;# Menubar related, aliases. # ;######################################################## alias trivia.team.credit { if (($team) && ($2 isnum)) { var %list $get.showteams($1) var %amount $2 var %j $numtok(%list,32) while (%j >= 1) { var %name.teammate $gettok(%list,%j,32) setvar %name.teammate score $calc($getvar(%name.teammate,score) + %amount) process.scores.time %name.teammate %amount dec %j } } } alias trivia.credit { if ($2 isnum) { setvar $1 score $calc($getvar($1,score) + $2) process.scores.time $1 $2 tsay $iif($2 >= 0,$msg.trivia.awarded($1,$2),$msg.trivia.deducted($1,$2)) } } alias -l trivon { return $iif($getset(status,botstate),Off,$iif($getset(status,bot),$iif($trivia.paused,Paused,Enabled), Disabled)) } alias -l trivdisflip { return $iif($getset(status,bot),Disable,Enable) } alias -l trivoffflip { return $iif($getset(status,botstate),On,Off) } alias -l trivia.chan { return $iif($trivchan, Yes, No) } alias -l trivia.dir { return $iif($isdir(" $+ $triv(dir) $+ "), Yes, No) } alias -l trivia.file { return $iif($isfile($qfile(1)), Yes, No) } alias -l trivia.onoff { return $iif($trivia.on, On, Off) } alias -l team.onoff { return $iif($team, On, Off) } ;######################################################## ;# Init aliases. # ;######################################################## alias -l nset { if ($getset($1, $2) == $null) { setset $1- } } alias init.load { nset award 1 1 1 1 50 0 gives * a high five for getting ^ wins! Way to go * ! nset award 2 1 1 1 100 0 gives * a large pizza for getting ^ wins! Way to go * ! nset award 3 1 1 1 150 0 ^ wins... I am not worthy... nset award 4 2 1 1 3 0 hands * a cold beer for getting the last ^ questions! nset award 5 2 1 1 5 0 hands * 6-pack of icy beers for getting the last ^ questions! nset award 6 2 1 1 10 0 gives * keg of beer for kicking everybodies asses! ^ questions! nset award 7 2 1 1 15 0 bows before * a trivia god... nset award 8 2 2 2 3 5 You're on fire! nset award 9 3 4 5 1.5 0 Autoban based on speed. nset award 10 4 3 5 120 0 Autoban based on Words per minute. nset award 11 7 0 2 0 0 * has moved up in rank: ^ nset award 12 8 0 2 0 0 *, congratulations on your promotion to: ^ } alias trivia.init { nset status bot 1 | nset status echo 0 | nset status autohint 1 | nset status showanswer 1 | nset status cross 1 nset status number 30 | nset status hintpause 1 | nset trivia additions additions.txt nset color 1 $fixer($rand(1,15)) | nset color 2 $fixer($rand(1,15)) | nset trivia default 10 | nset trivia dteam 5 | nset color on 1 nset trivia delimiter * | nset trivia tnaoff 5 | nset trivia hintpause 5 | nset trivia perchint 30 | nset trivia numhint 1 nset trivia ppq 1 | nset trivia dph 0 | nset lag answered 10 | nset lag hint 10 | nset lag start 15 | nset lag timed 15 | nset lag ping 10 nset lag betweenhint 10 | nset lag timedout 60 | nset lag hintallow 10 | nset trivia dir $ifd($nofile($findfile($mircdir,$triv(questions), 1)),$mircdir) nset trivia report report.txt | nset trivia reset 1000 | nset team 0victory The *t1 and the *t2 tied | nset team 1 'Team 1's nset team 1victory The *t1 beat the *t2 | nset team 2 'Team 2's | nset team 2victory The *t2 beat the *t1 | nset team JoinBefore 2 nset team JoinBeforeOn 1 | nset status nodecheater 1 varcolors } alias -l trivia.fail { var %failedtriviafail = 0 if ($version < 5.91) { echo Please use mIRC 5.91 or later. var %failedtriviafai = 1 } if (!$server) { echo Please connect to a server before attempting to use $msg.trivia.version var %failedtriviafai = 1 } if ($getset(status,bot) == 0) { echo The trivia bot is off. Commands, Trivia, Disabled to reenable. var %failedtriviafai = 1 } if ($isdir(" $+ $triv(dir) $+ ") == $false) { echo The trivia directory, $triv(dir) $+ , is invalid. var %failedtriviafai = 1 } if ($triv(dir) == $null) { echo The trivia directory setting is blank, please set it to the desired directory. var %failedtriviafai = 1 } if ($numl <= 0) { echo There appears to be no questions within the question file(s). var %failedtriviafai = 1 } return %failedtriviafai } alias get.find { if ($qfind($1-)) return $qfind($1-) } ;######################################################## ;# Trivia command, related aliases. # ;######################################################## alias -l ifd { return $iif($1, $1, $2) } ;######################################################## ;# Command processing. # ;######################################################## alias pre { return $ifd(%command-prefix, !) } alias commandtokens { return state;disable;enable;op;trivia;strivia;pause;resume;theme;themes;stats;stat;won;hof;top10;hofstreak;row;streak;hoftime;hoffast;hofwpm;wpm;server;record;records;champ;version;web;add;report;ping;triviaping;help;join;showteams;roundscores;answer;next;hint;!hint;words;last;vowels;repeat;hofscoreday;hoftimeday;hofstreakday;hofwpmday;hofscoreweek;hoftimeweek;hofstreakweek;hofwpmweek;hofscoremonth;hoftimemonth;hofstreakmonth;hofwpmmonth;hofscoreyear;hoftimeyear;hofstreakyear;hofwpmyear;rank;promotion } alias optokens { return enable;disable;ban;unban;banned;ask;add;find;team } alias stattokens { return score;time;streak;wpm } alias timetokens { return day;week;month;year;total } alias starttokens { return Unlimited;team } alias ctok { return $findtok($eval($ $+ $gettok(commandtokens;optokens;stattokens;timetokens;starttokens,$ifd($2,1),59),2),$untrans($1),1,59) } alias gtok { return $trivtran($gettok($eval($ $+ $gettok(commandtokens;optokens;stattokens;timetokens;starttokens,$ifd($2,1),59),2),$1,59)) } alias rtok { return $gettok($eval($ $+ $gettok(commandtokens;optokens;stattokens;timetokens;starttokens,$ifd($2,1),59),2),$1,59) } alias -l processcommand { var %command = $right($1,$calc(-1 * $len($pre))) var %ctok = $ctok(%command) award command %command $2- if (!%ctok) { return } if (%ctok == 1) { inform $msg.trivia.state } if (%ctok == 2) { opcommand disable $2- } if (%ctok == 3) { opcommand enable $2- } if (%ctok == 4) { opcommand $2- } if (($getset(status,bot) == 0) || ($trivia.banned)) { return } if (%ctok == 5) { if (!$isdis(28)) { trivia $2- } } if (%ctok == 6) { if ((!$isdis(29)) && ($trivia.on) && ((!$team) || ($nick isop $iden))) { strivia $iden $nick } } if (%ctok == 8) { if (!$isdis(5)) { trivia.pause 1 } } if (%ctok == 7) { if ((!$trivia.paused) && (!$isdis(5))) { trivia.pause } } if (%ctok isnum 9-10) { if (!$isdis(18)) { inform $msg.trivia.themes } } if (%ctok isnum 11-13) { processcommand.stats $ifd($2,$nick) $ifd($3,$unit.default) } if (%ctok isnum 14-15) { if (!$isdis(8)) { processcommand.hof $ifd($2,score) $ifd($3,$unit.default) } } if (%ctok isnum 16-18) { if (!$isdis(10)) { processcommand.hof streak $unit.default } } if (%ctok isnum 19-20) { if (!$isdis(9)) { processcommand.hof time $unit.default } } if (%ctok isnum 21-22) { if (!$isdis(11)) { processcommand.hof wpm $unit.default } } if (%ctok isnum 45-60) { var %regmatch = / $+ (?: $+ $gtok(14) $+ $chr(124) $+ $rtok(14) $+ ) $+ \s?( $+ $gtok(1,3) $+ $chr(124) $+ $gtok(2,3) $+ $chr(124) $+ $gtok(3,3) $+ $chr(124) $+ $gtok(4,3) $+ $chr(124) $+ $rtok(1,3) $+ $chr(124) $+ $rtok(2,3) $+ $chr(124) $+ $rtok(3,3) $+ $chr(124) $+ $rtok(4,3) $+ )\s?( $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $rtok(1,4) $+ $chr(124) $+ $rtok(2,4) $+ $chr(124) $+ $rtok(3,4) $+ $chr(124) $+ $rtok(4,4) $+ )/ if ($regex(%command, %regmatch)) processcommand.hof $iif($regml(1),score) $ifd($regml(2),$unit.default) } if (%ctok isnum 61-62) { if (!$isdis(30)) inform $msg.trivia.rank($ifd($2,$nick)) } if (%ctok == 23) { inform $server } if (%ctok isnum 24-25) { if (!$isdis(12)) { inform $msg.trivia.records } } if (%ctok == 26) { inform $msg.trivia.champ } if (%ctok == 27) { inform $msg.trivia.version } if (%ctok == 28) { inform $msg.trivia.web } if (%ctok isnum 29-30) { if (!$isdis(19)) { trivia.report %ctok $2- } } if (%ctok isnum 31-32) { if (!$isdis(17)) { do.ping } } if (%ctok == 33) { if (!$isdis(32)) givehelp $2- } if (%ctok == 34) { if (($team) && (!$isdis(33))) { $setteam($nick, $2) } } if (%ctok == 35) { if ($team) { inform $msg.trivia.showteams } } if (%ctok == 36) { inform $msg.trivia.roundscores } if (%ctok == 37) { if (($thget(answer)) && (!$isdis(16))) { inform $msg.question.answer } } if ((!$question.on) || ($trivia.paused)) { return } if (%ctok == 38) { if (($calc($question.time * 2) >= $lag(timedout)) && (!$isdis(15))) { trivx $chan } } if (%ctok isnum 39-43) { if (($question.time >= $lag(hintallow))) { if (($getset(trivia, hintpause)) && ($getset(status, hintpause))) { hadd -u $+ $triv(hintpause) Trivia $+ $idenn Temp. $+ hinted. $+ $nick 1 } if (%ctok isnum 39-40) { if (!$isdis(22)) { give.hint $iden } } if (%ctok == 41) { if (!$isdis(25)) { inform $msg.hint.words } } if (%ctok == 42) { if (!$isdis(24)) { inform $msg.hint.last } } if (%ctok == 43) { if (!$isdis(23)) { inform $msg.hint.vowels } } } } if (%ctok == 44) { if (!$isdis(26)) { inform $$thget(trivq.say) } } } alias processcommand.hof { if (!$2) { var %unit = 5 } else { var %unit = $ctok($2,4) } var %by = $ctok($1,3) if ($getset(hide,$rtok(%by,3))) { return } if ((!%by) || (!%unit)) { inform $msg.trivia.hof.error | return } inform $msg.trivia.topstats($rtok(%by,3),$rtok(%unit,4)) } alias -l processcommand.stats { if (!$2) { var %unit = 5 } else { var %unit = $ctok($2,4) } if (!%unit) { inform $msg.trivia.stats.error | return } if ($1 isnum) { sort score $unit.set(%unit) } if ($1 isnum 1 - $hof.size) { inform $msg.trivia.stats($hof($1,1),$unit.set(%unit)) } else { inform $msg.trivia.stats($iif($1,$1,$nick),$unit.set(%unit)) } } alias unit.default { return $rtok($ifd($getset(status,scoreby),5),4) } alias unit.set { return $iif($rtok($1,4) != total,$rtok($1,4)) } alias unit.prefix { return $iif($ifd($1,$unit.default) != total, $ifd($1,$unit.default)) } ;######################################################## ;# !Op command structure. # ;######################################################## alias -l opcommand { var %otok = $ctok($1,2) if ($isdis(6)) { return } if ((%otok == 1) && (!$isdis(21)) && ($getset(status,bot) == 0) && ((!$2) || ($2 == $me))) { setset status bot 1 tsay $msg.trivia.enabled } if ((%otok == 2) && (!$isdis(21)) && ($getset(status,bot) == 1) && ((!$2) || ($2 == $me))) { setset status bot 0 tsay $msg.trivia.disabled strivia $iden $nick } if ((%otok == 3) && (!$isdis(20))) { if (!$2) { inform $msg.trivia.error.ban } else { tban $2 inform $msg.trivia.op.ban } } if ((%otok == 4) && (!$isdis(7))) { if (!$2) { inform $msg.trivia.error.unban } else { tunban $2 inform $msg.trivia.op.unban } } if (%otok == 5) { inform $msg.trivia.banlist } if ((%otok == 6) && (!$isdis(14))) { if ($2 !isnum) { inform $msg.trivia.error.badnum } else { ask $2 inform $msg.trivia.op.ask } } if ((%otok == 7) && (!$isdis(27))) { if (!$2) { inform $msg.trivia.error.noquestion } elseif ($triv(delimiter) !isin $2-) { inform $msg.trivia.error.nodelim } else { add $2- inform $msg.trivia.op.added } } if ((%otok == 8) && (!$isdis(13))) { if (!$2) { inform $msg.trivia.error.nosearch } else inform $msg.trivia.op.find($2-) } if ((%otok == 9) && (!$isdis(34))) { if ($2 ison $chan) { if ($validteam($3)) { $setteam($2, $3) } else { inform $msg.trivia.error.numberrequired($2) } } else { inform $msg.trivia.error.playerrequired } } } ;######################################################## ;# Trivia ON. # ;######################################################## alias trivia { if (($trivia.banned) || ($trivia.on) || (!$trivchan)) { return } if ($trivia.paused) { tsay $msg.trivia.pause return } trivia.flush if ($trivia.fail) return if ($hget(Trivia $+ $idenn)) { hfree Trivia $+ $idenn } hmake Trivia $+ $idenn 20 if (($hget(Asked $+ $idenn)) && ($getset(status,keepask))) { hfree Asked $+ $idenn } if (!$hget(Asked $+ $idenn)) hmake Asked $+ $idenn 50 trivia.defaultgame thset STime $time $date thset SUser $iif($nick,$nick,$me) if (($getset(Trivia,odefault) == unlimited) || (($ctok($1,5) == 1) && (!$isdis(2))) ) { thset Max Unlimited } if (($getset(Trivia,odefault) == team) || (($ctok($1,5) == 2) && (!$isdis(3)))) { thset team 1 } if (($1 isnum 1 - $numl) && (!$isdis(1))) { thset Max $int($1) } if ($1 == pi) { thset Max 3.14159265358979323846 } if ($1 == e) { thset Max 2.718281828459045 } if (!$isdis(18)) { trivia.themecheck $1- } if ($thget(team)) { trivia.teammode $2 } tsay $msg.trivia.started .timerq $+ $idenn 1 $ifd($lag(start),0) trivq $chan award roundstart $thget(Max) } ;######################################################## ;# Trivia OFF. # ;######################################################## alias strivia { set -u3 %ident $1 if ($team) { strivia.teammode } else if ($getset(status,bot)) { if ($getset(Var $+ $idenn, Lastwinner) == $2) { setset Var $+ $idenn Row 0 } tsay $msg.trivia.stopped if ($thget(Current) >= 10) { tsay $strivia.end($triv(Record)) } award RoundStop $thget(Current) } trivia.flush } alias strivia.end { if ($1 == 1) { return $msg.trivia.hof } elseif ($1 == 2) { return $msg.trivia.topstats(streak) } elseif ($1 == 3) { return $msg.trivia.topstats(time) } elseif ($1 == 4) { return $msg.trivia.topstats(wpm) } elseif ($1 == 5) { return $msg.trivia.champ } elseif ($1 == 6) { return $msg.trivia.web } elseif ($1 == 7) { return $msg.trivia.roundscores } return $msg.trivia.records } ;######################################################## ;# STATUS CLEARING. # ;######################################################## alias -l trivia.flush { if (!$getset(status,keepask)) if ($hget(Asked $+ $idenn)) { hfree Asked $+ $idenn } if ($hget(Trivia $+ $idenn)) { hfree Trivia $+ $idenn } trivia.timersoff unset %cache.nick unset %cache.line } alias -l trivia.timersoff { .timer* $+ $idenn off } ;######################################################## ;# DEFAULT setup. # ;######################################################## alias trivia.defaultgame { thset File questions.txt thset Scores $scoresfil if ($tchan($trivchan, 4)) { thset Scores $tchan($trivchan, 4) } if ($tchan($trivchan, 5)) { thset File var %i = 5 while ($tchan($trivchan, %i)) { thset File $thget(file) $+ ; $+ $tchan($trivchan, %i) inc %i } } thset Max $triv(default) thset PPQ $iif($getset(Trivia,PPQ) != $null,$getset(Trivia,PPQ),1) thset DPH $iif($getset(Trivia,DPH) != $null,$getset(Trivia,DPH),0) thset RRS $iif($getset(Status,RRS) != $null,$getset(Status,RRS),0) thset guess $iif($getset(trivia,limitguess) != $null,$getset(trivia,limitguess),0) thset lagstart $iif($getset(lag, start) != $null, $getset(lag, start), 0) thset laganswered $iif($getset(lag, answered) != $null, $getset(lag, answered), 0) thset lagtimedout $iif($getset(lag, timedout) != $null, $getset(lag, timedout), 0) thset laghint $iif($getset(lag, hint) != $null, $getset(lag, hint), 0) thset lagtimed $iif($getset(lag, timed) != $null, $getset(lag, timed), 0) thset laghintallow $iif($getset(lag, hintallow) != $null, $getset(lag, hintallow), 0) thset lagbetweenhint $iif($getset(lag, betweenhint) != $null, $getset(lag, betweenhint), 0) } ;######################################################## ;# THEMED start. # ;######################################################## alias trivia.themecheck { var %i = 1 while ($getset(triviamode $+ %i, Name)) { if ($1 == $getset(triviamode $+ %i, Name)) { trivia.themestart %i if (($2 isnum) && ($2 <= $numq) && ($2 > 0) && (!$isdis(4))) { thset Max $int($2) } return } inc %i } } alias trivia.themestart { var %j = $setini(triviamode $+ $1,0) while (%j >= 1) { var %mode = $setini(triviamode $+ $1, %j) thset %mode $getset(triviamode $+ $1, %mode) dec %j } } ;######################################################## ;# TEAM setup. # ;######################################################## alias -l trivia.teammode { thset Score1 0 thset Score2 0 thset Score3 0 thset Score4 0 if ($1 isnum 1 - $numq) { thset Max $int($1) } else { thset Max $triv(dteam) } tsay $msg.team.start } alias -l strivia.teammode { var %s1 = $thget(Score1) var %s2 = $thget(Score2) var %s3 = $thget(Score3) var %s4 = $thget(Score4) if ($getset(team,4-team)) { if ((%s1 > %s2) && (%s1 > %s3) && (%s1 > %s3)) { tsay $msg.team.over($te(1).victory) award TeamVictory 1 } elseif ((%s2 > %s1) && (%s2 > %s3) && (%s2 > %s4)) { tsay $msg.team.over($te(2).victory) award TeamVictory 2 $get.showteams(2) } elseif ((%s3 > %s1) && (%s3 > %s2) && (%s3 > %s4)) { tsay $msg.team.over($te(3).victory) award TeamVictory 3 } elseif ((%s4 > %s1) && (%s4 > %s2) && (%s4 > %s3)) { tsay $msg.team.over($te(4).victory) award TeamVictory 4 } else { tsay $msg.team.over($te(0).victory) award TeamVictory 0 } } else { if (%s1 > %s2) { tsay $msg.team.over($te(1).victory) } elseif (%s1 < %s2) { tsay $msg.team.over($te(2).victory) } else { tsay $msg.team.over($te(0).victory) } } if ($getset(status, noshowt)) { tsay $msg.trivia.showteams } } alias -l setteam { if (($thget(Current) >= $getset(Team, JoinBefore)) && ($getset(Team, JoinBeforeOn) == 1)) { inform $msg.team.joinover return } if ($validteam($2)) { if ($thget(Team. $+ $1) == $2) { inform $msg.team.alreadyon } else { tsay $msg.team.add($getset(team,$2), $1) } thset $eval(Team. $+ $1,1) $2 setvar $1 team $2 } } alias -l validteam { if ($1 isnum 1-2) return 1 if (($1 isnum 3-4) && ($getset(team,4-team))) return 1 return 0 } alias -l setteam.hash { if ($validteam($2)) { thset $eval(Team. $+ $1,1) $2 } } ;######################################################## ;# Trivia QUESTION. # ;######################################################## alias trivq { set -u3 %ident $1 if (!$hget(Trivia $+ $idenn)) { return } if ($trivia.fail) return thset Current $calc($thget(Current) + 1) if (($team) && ($thget(Current) == $getset(Team, JoinBefore)) && ($getset(Team, JoinBeforeOn) == 1)) { tsay $msg.team.joinbefore } create.question .timerend $+ $idenn 1 $lag(timedout) trivx $iden trivia.startautohint setset Var $+ $idenn Asked $calc($getset(Var $+ $idenn,Asked) + 1) thset Start $ticks trivia.sayquestion $right($thget(catq),-1) if ($getset(status,echo) == 1) { echo $iden $msg.trivia.echoanswer } if ($getset(status,answers)) { tsay $msg.hint.space } award Question $lag(timedout) } alias -l create.question { while ($thget(Ask1)) { var %qread = $qread($thget(Ask1)) ask.deleteitem 1 thset Catq if (%qread) return } var %temp.ask = $trivia.getq thset Catq $qcat(%temp.ask) hadd Asked $+ $idenn %temp.ask %temp.ask } alias -l trivia.getq { unset %ask while ((!%ask) || ($hget(Asked $+ $idenn, %ask))) { var %tempnumqvalue = $numq if (%tempnumqvalue == 0) { echo Attempted start without any questions to process. Bailing. halt } if ($hget(Asked $+ $idenn,0).item >= %tempnumqvalue) { hdel -w Asked $+ $idenn * } var %ask = $rand(1, %tempnumqvalue) if (!$qread(%ask)) { hadd Asked $+ $idenn %ask NA } } thset Asking %ask return %ask } ;######################################################## ;# QUESTION MISC. # ;######################################################## alias qfile { if (($1 !isnum) || ($1 < 1)) return if (($thget(File)) && ($gettok($thget(File),$1,$asc(;)))) return $shortfn(" $+ $triv(dir) $+ \ $+ $gettok($thget(File),$1,$asc(;)) $+ ") if ($tchan($ifd($trivchan,1),$calc(4 + $1))) return $shortfn(" $+ $triv(dir) $+ \ $+ $tchan($ifd($trivchan,1),$calc(4 + $1)) $+ ") } alias numl { return $calc($numq - $numnonq) } alias numq { if ($1 isnum) { return $lines($qfile($1)) } var %i = 0, %j = 1 while ($qfile(%j)) { if (!$eval(% $+ numq $+ $qfile(%j),2)) { set -u600 % $+ numq $+ $qfile(%j) $lines($qfile(%j)) } %i = $calc(%i + $eval(% $+ numq $+ $qfile(%j),2)) inc %j } return %i } alias qcat { if ($getset(status,nocat) == 1) return var %nf = $numfile($1) if ($exists($gettok(%nf,1,$asc(;)))) { return $read($gettok(%nf,1,$asc(;)), wnt, #*, $gettok(%nf,2,$asc(;))) } } alias numnonq { window -h @numnonq var %j = 1, %nonqcount = 0 while ($qfile(%j)) { if ($eval(% $+ nonq $+ $qfile(%j),2)) { var %nonqcount = $calc(%numqcount + $eval(% $+ nonq $+ $qfile(%j),2)) } else { if ($exists($qfile(%j))) { filter -fwgx $qfile(%j) @numnonq /\ $+ $triv(delimiter) $+ / var %nonqcount = $calc(%nonqcount + $filtered) set -u600 % $+ nonq $+ $qfile(%j) $filtered } } inc %j } window -c @numnonq return %nonqcount } alias numcat { if ($window(@categories)) { window -c @categories } window -eh @categories var %j = 1 while ($qfile(%j)) { if ($exists($qfile(%j))) filter -fw $qfile(%j) @categories #* inc %j } .timer 1 0 window -c @categories return $line(@categories,0) } alias numfile { var %i = 0, %j = 1, %l while ($qfile(%j)) { %l = %i inc %i $numq(%j) if ($1 isnum %l - %i) { return $qfile(%j) $+ ; $+ $calc($1 - %l) } if (($1 !isnum) && ($exists($qfile(%j))) && ($read($qfile(%j), nwt, $+(*,$1-,*), 1))) return $qfile(%j) $+ ; $+ $readn inc %j } } alias -l qfind { var %i = 0, %j = 1, %l if ($1 == $null) { return } while ($qfile(%j)) { if (($exists($qfile(%j))) && ($read($qfile(%j), nwt, $+(*,$1-,*), 1))) return $read($qfile(%j),$readn) - $qfile(%j) - $readn inc %j } } alias qread { var %nf = $numfile($1) var %delim = \ $+ $triv(delimiter) if (($exists($gettok(%nf,1,$asc(;)))) && ($regex($iif($1 isnum,$read($gettok(%nf,1,$asc(;)), nt, $gettok(%nf,2,$asc(;))),$1-),/^([^ $+ %delim $+ ]+)([ $+ %delim $+ ].*)$/))) { thset tok1 $regml(1) if ($regex($regml(2), /[ $+ %delim $+ ]([^ $+ %delim $+ ]+)/g)) { thset numfile %nf thset tokq $calc($regml(0) + 1) var %i = 1 while (%i <= $regml(0)) { thset tok $+ $calc(%i + 1) $regml(%i) inc %i } } } else { if ($1 == scramble) { thset temp.bonus S } if ($1 == reverse) { thset temp.bonus R } if ($1 == shotgun) { thset temp.bonus G } return $false } return $true } alias -l ask.deleteitem { hdel Trivia $+ $idenn Ask $+ $$1 var %i = $1 while ($thget(Ask $+ $calc(%i + 1))) { thset Ask $+ %i $thget(Ask $+ $calc(%i + 1)) inc %i } if ($thget(Ask $+ %i)) { hdel Trivia $+ $idenn Ask $+ %i } } alias -l trivia.startautohint { if ($getset(status,autohint) == 1) { .timerhint $+ $idenn 1 $lag(hint) trivia.autohint $iden } } alias -l trivia.autohint { give.hint $1 if ($triv(numhint) > 1) { .timerhint $+ $idenn $calc($triv(numhint) - 1) $lag(betweenhint) give.hint $1 } } alias decheater { if ($getset(status,nodecheater) == 1) return $1- var %t.rt = $1-, %i = $count($1-,$chr(32)), %t.ps while (%i > 0) { if ($rand(1,2) == 1) { %t.ps = $pos($1-,$chr(32),%i) %t.rt = $+($left(%t.rt, $calc(%t.ps - 1)), $chr(160),$right(%t.rt,$calc((%t.ps) * -1))) } dec %i } return %t.rt } ;######################################################## ;# QUESTION over. # ;######################################################## alias trivx { set -u3 %ident $1 if (!$hget(Trivia $+ $idenn)) { return } if (!$2) { if (($getset(status,showanswer)) && (!$getset(status,shownone))) { if ($thget(temp.type) == K) { tsay $msg.answer.timeout.kaos } else if ($thget(temp.type) == T) { tsay $msg.answer.timeout.total } else if ($thget(temp.type) == P) { tsay $msg.answer.timeout.pick } else { tsay $msg.answer.timeout } } else { tsay $msg.answer.timeout2 } setset Var $+ $idenn Row 0 thset Unanswered $calc($thget(Unanswered) + 1) award NoAnswer $trivq.answer } trivia.timersoff if ($window($total.win)) { window -c $total.win } thset Answer $trivq.answer if ($hget(Trivia $+ $idenn)) hdel -w Trivia $+ $idenn Temp.* if ($hget(Trivia $+ $idenn)) hdel -w Trivia $+ $idenn tok* if (($nick) && ($getvar($nick,score) >= $triv(reset)) && ($getset(status,champ) == 1)) { trivia.newchamp } if ((($team) && ($thget(Score $+ $isteam($nick)) > $calc($thget(Max)/2))) || (($getset(status,emptyoff)) && ($nick($iden,0) <= 1)) || (($getset(status, naoff) == 1) && ($thget(unanswered) >= $triv(naoff))) || (($thget(Max) != unlimited) && ($thget(Current) >= $thget(Max)))) { strivia $1 if (($getset(status, emptyoff) == 1) && ($nick($iden,0) <= 1)) tsay $msg.trivia.emptyoff if (($getset(status, naoff) == 1) && ($thget(Unanswered) >= $triv(naoff))) tsay $msg.trivia.unactive return } .timerq $+ $idenn 1 $iif($1, $lag(answered), $lag(timed)) trivq $iden } alias -l trivia.processscore { if ($getset(Var $+ $idenn, Lastwinner) == $nick) { setset Var $+ $idenn Row $calc($getset(Var $+ $idenn, Row) + $ifd($2,1)) } else { setset Var $+ $idenn Row $ifd($2,1) } setset Var $+ $idenn Wins $calc($getset(Var $+ $idenn,Wins) + $ifd($2,1)) setset Var $+ $idenn Lastwinner $nick setvar $nick Lastwin $date thset WPM $calc(($len($1) * 60) / ($thget(Time) * 5)) if (($thget(WPM) > $getvar($nick,wpm)) || (!$getvar($nick,wpm))) { setvar $nick wpm $thget(WPM) } if (($getset(Var $+ $idenn, Row) > $getvar($nick,streak)) || (!$getvar($nick,streak))) { setvar $nick Streak $getset(Var $+ $idenn, Row) } if (($thget(Time) < $getvar($nick,time)) || (!$getvar($nick,time))) { setvar $nick Time $thget(Time) } thset temp.cng $calc(($thget(PPQ) * $ifd($2,1)) - ($thget(DPH) * $max.hinted)) if ($thget(temp.points) != $null) { thset temp.cng $calc(($thget(temp.points) - ($max.hinted * $thget(temp.hintreduction))) * $ifd($2,1)) } thset temp.mrank $getmrank($nick) thset temp.rank $getrank($nick,$unit.default,$thget(temp.cng)) thset temp.newrank $calc($thget(temp.rank) - %uprank) setvar $nick Score $calc($getvar($nick, Score) + $thget(temp.cng)) setvar $nick Answered $calc($getvar($nick, Answered) + $iif($2 > 0,$2,1)) thset $eval(Score. $+ $nick,1) $calc($thget($eval(Score. $+ $nick,1)) + $thget(temp.cng)) process.scores.time $nick $thget(temp.cng) $getset(Var $+ $idenn, Row) $thget(Time) $thget(WPM) } alias trivia.processawards { if (%uprank) award uprank $tranord($thget(temp.newrank)) if ($getmrank($nick) != $thget(temp.mrank)) award promotion $getmrank($nick) award score $user.score($nick) award row $getset(Var $+ $idenn, Row) award time $thget(Time) award wpm $thget(WPM) award answered $thget(Time) } alias -l answered { thset Time $question.time if (($1 == $null) || ($trivia.banned) || ($trivia.negationcheck) || (($team) && (!$isteam($nick)))) { return } $trivia.processscore($1,$2) if (($getset(build,instabuild)) && ($getset(build,instabuild) // $getset(Var $+ $idenn,Wins))) { htmltrigger $iden } tsay $msg.answer.correct($getset(status,tradwin),$thget(WPM),$thget(temp.newrank),$iif(%uprank,$thget(temp.rank))) if ($team) { thset Score $+ $isteam($nick) $calc($thget( Score $+ $isteam($nick)) + 1) tsay $msg.team.score award TeamAnswered $isteam($nick) } trivia.processawards if ($thget(RRS)) { tsay $msg.trivia.roundscores } hdel Trivia $+ $idenn Unanswered if (($isTotal) && ($total.over)) { tsay $msg.trivia.totalover } if ((($thget(temp.type) != T) && ($thget(temp.type) != K)) || ($total.over)) { trivx $chan $true } } alias -l trivq.answer { return $iif(((($thget(temp.type) == T) || ($thget(temp.type) == K) || ($getset(status,showmatched))) && ($thget(temp.matched))), $thget(temp.matched),$tok(2)) } ;######################################################## ;# QUESTION Typing. # ;######################################################## alias -l trivia.sayquestion { if ($regex($tok(1), /^([^:]+):\s?(.+)|((?i)Scramble|Uword)$/)) { thset temp.mode $lower($regml(1)) thset temp.rest $regml(2) if (($gettok($thget(temp.mode),1,44) isnum) && ($getset(status,nobonus) != 1)) { thset temp.points $gettok($thget(temp.mode),1,44) if ($gettok($thget(temp.mode),2,44) isnum) { thset temp.hintreduction $gettok($thget(temp.mode),2,44) } var %tq $msg.question.points($1-,$thget(temp.rest)) } elseif ($regex($thget(temp.mode), /pick\s(\d+)/)) { var %tq $msg.question.standard($1-,$thget(temp.rest)) thset temp.type P thset temp.pick $regml(1) } elseif (kaos == $thget(temp.mode)) { var %tq $msg.question.kaos($1-) thset temp.type K total.init } elseif (multi == $thget(temp.mode)) { var %tq $msg.question.multi($1-) thset temp.type M } elseif (total == $thget(temp.mode)) { var %tq $msg.question.total($1-) thset temp.type T total.init } elseif (scramble == $thget(temp.mode)) || (uword == $thget(temp.mode)) { var %tq $msg.question.scramble($1-,$thget(temp.rest)) thset temp.type S } } if (!%tq) { var %tq $msg.question.standard($1-) } thset trivq.say $iif($getset(status,nosaycurrent) != 1, $e1($thget(Current)) $+ $e2(.)) $decheater(%tq) tsay $thget(trivq.say) } ;######################################################## ;# TOTAL question type, control. # ;######################################################## alias unfix { var %i = 2 while (%i <= $tokq) { if ($1- == $fix($tok(%i))) { return $tok(%i) } inc %i } } alias total.win { return @total $+ $idenn } alias total.init { var %i = 2 if ($window($total.win)) { window -c $total.win } window -h $total.win while (%i <= $tokq) { aline -n $total.win $tok(%i) inc %i } thset temp.totalanswers $total.left } alias total.left { return $line($total.win,0) } alias total.answers { return $thget(temp.totalanswers) } alias total.answered { return $calc($total.answers - $total.left) } alias total.is { return $fline($total.win,$1-,1) } alias total.rem { dline $total.win $total.is($1-) } alias total.over { return $iif(!$line($total.win,0), 1) } alias isTotal { return $iif((($thget(temp.type) == T) || ($thget(temp.type) == K)),$true) } alias gettotalhints { var %i = 1, %totalhint while (%i <= $line($total.win,0)) { %totalhint = $left(%totalhint,850) $+ $iif(%totalhint,$chr(44)) $plot($1,$line($total.win,%i)) inc %i } return %totalhint } alias gettotalremain { var %i = 1, %totalremain while (%i <= $line($total.win,0)) { %totalremain = $left(%totalremain,850) $+ $iif(%totalremain != $null,$chr(44)) $line($total.win,%i) inc %i } return %totalremain } ;######################################################## ;# Trivia block answer. # ;######################################################## alias -l trivia.negationcheck { if ($thuser(Hinted)) { inform $msg.trivia.hintpaused return $true } if (($getset(status,limitguess)) && (!$isTotal) && ($ifd($thuser(Guess),0) >= $thget(guess))) { inform $msg.trivia.guessed($thuser(guess)) return $true } } ;######################################################## ;# Guess processing. # ;######################################################## alias -l processguess { if ($trivia.paused) { return } if (($team) && (!$isteam($nick))) { if ($validteam($getvar($nick,team))) { $setteam.hash($nick,$getvar($nick,team)) } } var %pick = $regex($lower($fix($1-)), $trivia.pattern) thuset Guess $calc($thuser(guess) + 1) if (%pick == 0) { return } var %answered, %matched = $regml(1), %i = 1 thset temp.match $regml(0) while ($thget(temp.match) >= %i) { thset temp.match. $+ %i $regml(%i) inc %i } if (($thget(temp.type) == P) || ($thget(temp.type) == T) || ($thget(temp.type) == K)) { var %j = 1, %k, %f, %numb.correct = 0 while (%j <= $thget(temp.match)) { var %k = %j, %f = $true while (%k >= 1) { if ((%j != %k) && ($thget(temp.match. $+ %j) == $thget(temp.match. $+ %k))) { %f = $false } dec %k } if ($isTotal) { if ($total.is($unfix($thget(temp.match. $+ %j)))) { total.rem $unfix($thget(temp.match. $+ %j)) inc %numb.correct } else { %f = $false } } if (%f) %answered = %answered $unfix($thget(temp.match. $+ %j)) else { dec %pick } inc %j } if (($thget(temp.type) == P) && (%pick < $thget(temp.pick))) return if (($isTotal) && (%numb.correct == 0)) return } else { var %answered = $unfix($thget(temp.match. $+ 1)) } thset temp.matched %answered $answered(%answered,%numb.correct) } alias fix { if ($getset(status,nospellfix)) { return $lower($strip($1-)) } var %temp.fix = $lower($strip($1-)) .echo -q $regsub(%temp.fix,/([^\s]+)s(?=(\s|$))/g, \1, %temp.fix) .echo -q $regsub(%temp.fix,/(?<=^|\s)(?:the|an|a)\s([^\s]+)/g, \1, %temp.fix) %temp.fix = $remove(%temp.fix,',-,!,`,.,,´,?,%,$chr(36),$chr(44)) %temp.fix = $replace(%temp.fix,À,A,Á,A,Â,A,Ã,A,Ä,A,Å,A,Æ,AE,Ç,C,È,E,É,E,Ê,E,Ë,E,Ì,I,Í,I,Î,I,Ï,I,Ð,D,Ñ,N,Ò,O,Ó,O,Ô,O,Õ,O,Ö,O,Ø,O,Ù,U,Ú,U,Û,U,Ü,U,Ý,Y) %temp.fix = $replace(%temp.fix,ß,B,à,a,á,a,â,a,ã,a,ä,a,å,a,æ,ae,ç,c,è,e,é,e,ê,e,ë,e,ì,i,í,i,î,i,ï,i,ð,o,ñ,n,ò,o,ó,o,ô,o,õ,o,ö,o,ù,u,ú,u,û,u,ü,u,ý,y,ÿ,y) return $replace(%temp.fix,kn,n,y,i,k,c,x,c,q,c,e,a,ah,a,u,o,ph,f,m,n,ll,l,aa,a,oo,o,cc,c,z,s) } alias trivia.pattern { if ($thget(temp.pattern)) { return $thget(temp.pattern) } var %i 2, %max = $iif($thget(temp.type) == M, 2, $tokq), %pattern = $chr(40) while (%i <= %max) { if (%i != 2) { %pattern = %pattern $+ $chr(124) } %pattern = %pattern $+ $lower($fix($tok(%i))) inc %i } %pattern = %pattern $+ $chr(41) if (($thget(temp.type) != P) && ($thget(temp.type) != T) && ($thget(temp.type) != K)) { if ($getset(status, exactmatch)) { %pattern = ^ $+ %pattern $+ $ } elseif ($getset(status, nomid)) { %pattern = ^ $+ %pattern $+ (?=\s|$) $+ $chr(124) $+ (?:^|\s) $+ %pattern $+ $ } else { %pattern = (?:^|\s) $+ %pattern $+ (?=\s|$) } } else { %pattern = (?:^|\s) $+ %pattern $+ (?=\s|$) } %pattern = / $+ %pattern $+ /g thset temp.pattern %pattern return %pattern } ;######################################################## ;# PAUSE/RESUME processing. # ;######################################################## alias trivia.paused { if (($thget(paused)) && ($hget(Trivia $+ $idenn))) { return $true } } alias trivia.pause { if ($1) { if ($trivia.paused) { .timerq $+ $idenn -r .timerend $+ $idenn -r .timerhint $+ $idenn -r thset paused 0 tsay $msg.trivia.resume } else if (($thget(paused) != 1) && (!$timer(q $+ $idenn)) && (!$timer(end $+ $idenn)) && (!$timer(hint $+ $idenn)) && ($hget(Trivia $+ $idenn))) trivx } else { .timerq $+ $idenn -p .timerend $+ $idenn -p .timerhint $+ $idenn -p thset paused 1 tsay $msg.trivia.pause } } ;######################################################## ;# Hint setup. # ;######################################################## alias -l give.hint { set -u3 %ident $1 if ((!$hget(Trivia $+ $idenn)) || ($max.hinted >= $triv(numhint))) { return } if (!$nick) { thset Temp.Hints $calc($thget(Temp.Hints) + 1) var %hintpercent = $calc($triv(perchint) * $thget(Temp.Hints)) var %nexthintpercent = $calc($triv(perchint) * ($thget(Temp.Hints) + 1)) if ($thget(Temp.Skip.Hint $+ $thget(Temp.Hints)) == 1) { return } if ($hintrepnum(%hintpercent) == $hintrepnum(%nexthintpercent)) thset Temp.Skip.Hint $+ $calc($thget(Temp.Hints) + 1) 1 if ($thget(Temp.Hints) == 1) tsay $eval($ $+ msg.hint. $+ $hintfirst $+ ( %hintpercent ),2) else tsay $msg.hint.hint(%hintpercent) } else { thuset Hint $calc($iif($calc($thget(Temp.Hints) + 0) > $calc($thuser(hint) + 0),$thget(Temp.Hints),$thuser(hint)) + 1) if ($thget(Temp.Skip.Hint $+ $thuser(hint)) == 1) { return } var %sayhint = $msg.hint.hint($calc($triv(perchint) * $thuser(hint))) if (msg * iswm %respond) { tsay %sayhint thset Temp.Skip.Hint $+ $thuser(hint) 1 } else inform %sayhint } award Hint $thget(Temp.Hints) } alias -l hintfirst { var %hintfirst = $getset(trivia, firsthint) if (!%hintfirst) return hint if (%hintfirst == 1) return last if (%hintfirst == 2) return vowels if (%hintfirst == 3) return $gettok(hint.last.vowels.space.scramble, $rand(1,5), $asc(.)) } alias -l get.hint { if ($thget(Temp.type) == M) { return } if (($thget(temp.rhint. $+ $2)) && ($1 == hint)) { return $thget(temp.rhint. $+ $2) } var %perhint = $iif($2,$2,$triv(perchint)), %hintc if ($isTotal) { thset temp.rhint. $+ $2 $gettotalhints(%perhint) return $thget(temp.rhint. $+ $2) } if ($1 == words) { return $numtok($trivq.answer,32) } if ($1 == space) { return $deletter($trivq.answer) } if ($1 == last) { return $right($trivq.answer,1) } if ($1 == vowels) { return $iif($regsub($trivq.answer, /([^aeiouAEIOU\s])/g, $trivchar, %hintc), %hintc, $trivq.answer) } if ($1 == scramble) { return $scramble($trivq.answer) } if ($getset(status, plot)) { return $plot(%perhint, $trivq.answer) } if ($getset(status, scatter)) { thset temp.rhint. $+ $2 $scatter(%perhint, $trivq.answer) return $thget(temp.rhint. $+ $2) } else { return $standard(%perhint, $trivq.answer) } } alias -l trivchar { return $iif($chr($triv(ch)),$chr($triv(ch)),_) } alias -l nonpunct { return /([^';:"\s\xA0\,\?\<\>\|\\\/\[\]\!\@\#\$\%\^\&\*\(\)\{\}\-])/g } alias -l deletter { var %hintc .echo -q $regsub($1-, $nonpunct, $trivchar, %hintc) return %hintc } alias -l hintrepnum { return $int($calc(($len($trivq.answer) / 100) * $1 + 1)) } alias -l standard { var %in = $replace($2-, $chr(32), $chr(160)), %break = $hintrepnum($1) return $replace($left(%in, %break) $+ $iif($getset(status,cross) == 1, $deletter($right(%in, $calc(-1 * %break)))), $chr(160), $chr(32)) } alias -l scramble { tokenize 32 $1- var %i = 1, %temp.smbl while (%i <= $0) { var %word = $eval($+($,%i),2) while (%word != $null) { var %rand = $rand(1, $len(%word)), %temp.smbl = %temp.smbl $+ $mid(%word, %rand, 1), %word = $left(%word, $calc(%rand - 1)) $+ $right(%word, $calc(-1 * %rand)) } %temp.smbl = %temp.smbl $+ ; inc %i } return $lower($replace(%temp.smbl,;,$chr(32))) } alias -l reverse { var %i = $len($1-),%reversed, %space while (%i >= 1) { if (!%space) { %reversed = %reversed $+ $mid($replace($1-,$chr(32),$chr(160)),%i,1) } %space = $false if ($chr($mid($1-,%i,1)) == 32) { %space = $true } dec %i } return $replace(%reversed,$chr(160),$chr(32)) } alias scatter { var %hintc = $2- if ($thget(temp.scattermask)) var %schint = $thget(temp.scattermask) else { var %schint !.echo -q $regsub(%hintc,$nonpunct,@,%schint) } var %rnum = $int($calc(($regex(%schint,/@/g) / 100) * (100 - $1))) while (%rnum >= 0) { if ($regex(%schint,/(@)/g)) !.echo -q $regsub(%hintc,/(?<=^.{ $+ $calc($regml($rand(1,$regml(0))).pos - 1) $+ })./,@, %hintc) dec %rnum } thset temp.scattermask %hintc return $replace(%hintc,@,$trivchar) } alias plot { if ($1 >= 100) { return $2- } var %hintc, %i = 1, %j = 0, %rnum = $int($calc(($regsub($2-,$nonpunct,@,%hintc) / 100) * $1)) while (%i <= %rnum) { if ($regex(%hintc, /(?:^|\s|\xA0)[^\s\xA0@]{ $+ %j $+ }(@)/g) == 1) { inc %j } %hintc = $+($left(%hintc,$calc($regml(1).pos - 1)), $mid($2-,$regml(1).pos,1),$right(%hintc,$calc($regml(1).pos * -1))) inc %i } return $replace(%hintc,@,$trivchar) } alias startandrandom { if ($1 > 0) return $replace($hget(hints,$1),@,$trivchar) if ($hget(hints)) hfree hints var %hintc = $2-, %onhint = 10, %f while (%hintc) { var %w = $gettok(%hintc,1,32), %rt = $regsub(%w,$nonpunct,@,%f), %hintc = $gettok(%hintc,2-,32), %k = 1 while (%k <= %onhint) { hadd -m hints %k $hget(hints,%k) %f if ($regex(%w,$nonpunct) > 1) !.echo -q $regsub(%w, /(?<=^.{ $+ $iif(%k == 1, 0, $calc($regml($rand(1,$regml(0))).pos - 1)) $+ })(.)/,@, %w) $regsub(%f, /(?<=^.{ $+ $calc($regml(1).pos - 1) $+ })./,$regml(1), %f) inc %k } } } ;######################################################## ;# CHAMP aliases. # ;######################################################## alias -l trivia.newchamp { .rename $scoresfil $asctime(yymmddhhmmss) $+ .bak setset Champ $calc($setini(Champ, 0) + 1) $nick tsay $msg.trivia.victory($nick) award Champ $nick trivia.flush haltdef } ;######################################################## ;# HALL Of FAME, RANKING. # ;######################################################## alias sort { if (!$exists($scoresfil)) { return } window -h $twin filter -fwcgut $+ $iif($1 != time,e) [ $$gttok($iif($2 != total,$2) $+ $1) $asc(;) ] $scoresfil $twin $iif(($2) && ($2 != total),/^ $+ $str([^;]*;,$calc($$gttok($2)-1)) $+ $eval($ $+ get. $+ $2,2) $+ ;.* $+ /,/.*/) } alias -l msg.trivia.topx { if ($calc($3 - $2) > 20) { return $msg.trivia.error.topx } sort $1 $unit.default var %temp.by = $gttok($1), %i = $2, %temp.ten = $e2(Places) $e1($2) $e2(to) $e1($3) $+ $e2(:) while (%i <= $3) { var %temp.ten = %temp.ten $e1($iif($hof(%i,1),$hof(%i,1) - $hof(%i,%temp.by)) $+ $e2(;) inc %i } return %temp.ten } alias -l msg.trivia.topstats { sort $1 $iif($2 != total, $2) var %temp.by = $gttok($iif($2 != total, $2) $+ $1), %temp.ten = $e1($hof(1,1)) $e2(has the best $1 of) $e1($hof(1,%temp.by)) $iif($2 != total,$e2( for the $2 )) $+ $e2(;) var %i = 2 while (%i <= $iif(%topnum,%topnum,10)) { var %temp.ten = %temp.ten $iif($hof(%i,1),$e1($hof(%i,1)) $e2(-) $e1($hof(%i,%temp.by)) $+ $e2(;)) inc %i } return $iif(!$hof(1,1),$e2(No elements in the hall of fame.),%temp.ten) } alias topnum { set %topnum $1 } alias -l twin { return @trivia $+ $scoresfil } alias -l getrank { sort score $iif($2 != total, $2) set -u0 %getrank $fline($twin,$+($1,;*),1) if (!%getrank) { return $hof.size } var %score = $getvar($hof(%getrank,1),$iif($2 != total, $2) $+ score) while (%score == $getvar($hof(%getrank,1),$iif($2 != total, $2) $+ score)) { dec %getrank } inc %getrank if (%getrank != 1) { set -u0 %getnextrank $calc(%getrank - 1) set -u0 %getnextrankuser $hof(%getnextrank,1) set -u0 %getnextrankat $user.score(%getnextrankuser,$2) } unset %uprank if (!$3) { return %getrank } set -u0 %uprank 1 var %upscore = $calc(%score + $3) while ((%upscore >= $getvar($hof($calc(%getrank - %uprank),1),$iif($2 != total, $2) $+ score)) && (%getrank >= %uprank)) { inc %uprank } dec %uprank return %getrank } alias mrankon { if (!$getset(trivia, ranks)) { return $false } if ($setini(ranks,0) == 0) { return $false } else { return $true } } alias getmrank { if (!$getset(trivia, ranks)) { return } var %score = $user.score($1,$2), %i = $setini(ranks,0), %te = 0, %temax = 0 while (%i >= 1) { %te = $setini(ranks,%i) if ((%score >= %te) && (%te >= %temax)) { %temax = %te } dec %i } return $getset(ranks,%temax) } alias getnextmrank { var %next.rank = $getnextmrankat($1) return $iif(%next.rank, $getset(ranks,%next.rank), None) } alias getnextmrankat { if (!$getset(trivia, ranks)) { return } var %score = $1, %i = $setini(ranks,0), %te = 0, %temax = 0, %by = 0 while (%i >= 1) { %te = $setini(ranks,%i) if ((%score <= %te) && ((!%by) || ($calc(%score + %by) >= %te))) { %temax = %te %by = $calc(%te - %score) } dec %i } return %temax } alias -l recordstat { sort $1 $unit.default return $hof(1,1) } ;######################################################## ;# TIME SCORE DURATIONS AND GENERAL ALIASES # ;# All time alias just return the number of that time # ;# unit which have occurred since Jan 1st, 1970 # ;# Do not alter the unit.tokens. It will break the bot. # ;######################################################## alias unit.tokens { return year.month.week.day } alias get.day { return $int($calc(($ctime - $timezone) / 86400)) } alias get.week { return $int($calc((($get.day - 4) - $iif($getset(status,monday),0,1)) / 7)) } alias get.month { return $calc(($get.year * 12) + $asctime($ctime,mm)) } alias get.year { return $calc($asctime($ctime,yyyy) - 1970) } alias process.scores.time { var %i = 1 while (%i <= 4) { var %unit = $gettok($unit.tokens,%i,$asc(.)) var %uvalue = $eval($ $+ get. $+ %unit,2) if ((%unit) && (%uvalue)) { if ($getvar($1,%unit) != %uvalue) { setvar $1 %unit %uvalue setvar $1 %unit $+ score $calc(0 + $2) setvar $1 %unit $+ streak $calc(0 + $3) setvar $1 %unit $+ time $ifd($4,9999) setvar $1 %unit $+ wpm $calc(0 + $5) } else { if ($2) setvar $1 %unit $+ score $calc($getvar($1,%unit $+ score) + $2) if ($3 > $getvar($1,%unit $+ streak)) setvar $1 %unit $+ streak $3 if ($4 < $getvar($1,%unit $+ time)) setvar $1 %unit $+ time $4 if ($5 > $getvar($1,%unit $+ wpm)) setvar $1 %unit $+ wpm $5 } } inc %i } } ;######################################################## ;# VAR MANIPULATIONS. # ;######################################################## alias setvar { if ($3 == $null) return if ($exists($tempfil)) var %backburner = $read($tempfil, wnt, $1 $+ ;*) if (%backburner != $null) mergeentry $tempfil $scoresfil $1 var %newline = $readvar($1) if (!%newline) { %newline = $1 } if ($numtok(%newline,59) < $numtok($tvartoks, $asc(.))) { %newline = %newline $+ $str(;0,$calc($numtok($tvartoks, $asc(.)) - $numtok(%newline,59))) if ($gettok(%newline,9,59) == 0) { %newline = $puttok(%newline,trivia,9,59) } if (($gettok(%newline,8,59) == 0) && ($address($1,5))) { %newline = $puttok(%newline,$address($1,5),8,59) } if ($gettok(%newline,6,59) == 0) { %newline = $puttok(%newline,$date,6,59) } if ($gettok(%newline,3,59) == 0) { %newline = $puttok(%newline,9999,3,59) } } %newline = $puttok(%newline,$3-,$gttok($2),59) write $iif($readn,-l $+ $readn) $scoresfil %newline set -u3 %cache.nick $1 set -u3 %cache.line %newline } alias readvar { if ($exists($scoresfil)) var %scoreline = $read($scoresfil, wnt, $1 $+ ;*) if (!%scoreline) { return } if (!$2) { return %scoreline } else { return $gettok(%scoreline, $gttok($2), 59) } } alias getvar { if ($1 == %cache.nick) { var %scoreline = %cache.line } else { var %scoreline = $readvar($1) if (!%scoreline) { return } set -u3 %cache.nick $1 set -u3 %cache.line %scoreline } if (!$2) { return %scoreline } else { return $gettok(%scoreline, $gttok($2), 59) } } alias -l gttok { return $findtok($tvartoks, $1, 1, $asc(.)) } alias -l tvartoks { return name.score.time.streak.wpm.lastwin.answered.address.team.admin.block.day.dayscore.daystreak.daytime.daywpm.week.weekscore.weekstreak.weektime.weekwpm.month.monthscore.monthstreak.monthtime.monthwpm.year.yearscore.yearstreak.yeartime.yearwpm } alias -l varfil { return $iif($2 == $null, $iif($1 == 0, $lines($scoresfil), $gettok($read($scoresfil, $1),1,59)), $gettok($read($scoresfil, $1),$2,59)) } alias trivini { return $iif($exists(trivia.ini),trivia.ini,$iif($exists(" $+ $scriptdir $+ \ $+ trivia.ini $+ ")," $+ $scriptdir $+ \ $+ trivia.ini $+ ",trivia.ini)) } alias -l setset { if ($3- != $null) { writeini -n $trivini $1 $2 $3- } else { remini -n $trivini $$1 $2 } } alias getset { return $readini($trivini, n, $1, $2) } alias -l setini { return $iif($2 != $null, $ini($trivini, $1, $2), $ini($trivini, $1)) } alias -l thuser { return $thget($eval(Temp. $+ $1 $+ . $+ $nick,1)) } alias -l thuset { thset $eval(Temp. $+ $1 $+ . $+ $nick,1) $2- } alias -l thset { if ($hget(Trivia $+ $idenn)) hadd Trivia $+ $idenn $1- } alias thget { return $hget(Trivia $+ $idenn, $1) } ;######################################################## ;# Color aliases. # ;######################################################## alias -l colorcode { return $gettok(colors off.white.black.blue.green.lightred.brown.purple.orange.yellow.lightgreen.cyan.lightcyan.lightblue.pink.grey.lightgrey,$calc($1 + 1),$asc(.)) } alias -l fixer { return $base($1,10,10,2) } alias varcolors { unset %c1 %c1o %c2 %c2o if ((!$getset(color,on)) || (!$tc(1)) || (!$tc(2))) { return } %c1o = $iif($tc(1).b,$chr(2)) $+ $iif($tc(1).u,$chr(31)) $+ $chr(3) %c2o = $iif($tc(2).b,$chr(2)) $+ $iif($tc(2).u,$chr(31)) $+ $chr(3) %c1 = %c1o $+ $fixer($calc($tc(1) - 1)) $+ $iif(($tc(3)) && ($getset(color,bon)), $chr(44) $+ $fixer($calc($tc(3) - 1))) %c2 = %c2o $+ $fixer($calc($tc(2) - 1)) $+ $iif(($tc(4)) && ($getset(color,bon)), $chr(44) $+ $fixer($calc($tc(4) - 1))) } alias rdc { if ($getset(status,nocolorshort) == 1) return $1 var %a !.echo -q $regsub($1,/(?<=\x03|\x03\d\d\x2C)(\d)(?!\d)/g,0\1, %a) while ($regsub(%a, /(?<=\x03\d\d\x2C\d\d|\x03\d\d\x03|\x03)([\x02\x1F\x16\s\xA0]+)(\x03(?:\d\d(?:\x2C\d\d)?)?)/g,\2\1, %a)) { } !.echo -q $regsub(%a, /(\x02)([\x1F\x16\s\xA0]*)\1/g,\2, %a) $& $regsub(%a, /(\x1F)([\x02\x16\s\xA0]*)\1/g,\2, %a) $& $regsub(%a, /(\x16)([\x02\x1F\s\xA0]*)\1/g,\2, %a) $& $regsub(%a, /(?:\x03(?:\d\d(?:\x2C\d\d)?)?)+(\x03(?:(?!\d)|\d\d\x2C\d\d))/g,\1, %a) $& $regsub(%a, /(?:\x03\d\d)(\x2C\d\d)(?:\x03\d\d)*(\x03\d\d)/g,\2\1, %a) $& $regsub(%a, /(?<=\x03\d\d)(\x2C\d\d)([^\x03]+\x03\d\d)\1/g,\1\2, %a) while ($regsub(%a,/(\x03\d\d)((\x2C\d\d)?[^\x03]+)\1(?!\x2c\d)/g,\1\2, %a)) { } !.echo -q $regsub(%a, /^\x03(?!\d)|(\x03(\d\d(\x2C\d\d)?)?|\x02|\x16|\x1F)+$/g,,%a) $& $regsub(%a, /(?<=\x03|\x03\d\d\x2C)0(\d)(?!\d)/g,\1, %a) return %a } ;######################################################## ;# AWARD setups. # ;######################################################## alias -l msg.trivia.award { return %c2 $+ $replace($eval($1,2),^, %c2o $+ $e1($2) $+ %c2,*, %c2o $+ $e1($nick) $+ %c2) $+ %c2o } alias -l award { if ($getset(status,noawards)) { return } var %i = 1, %award = $calc($findtok($award.on.tok, $1, 1, $asc(.)) - 1), %trigger = $2- while ($aw(%i)) { tokenize 32 $aw(%i) if (%award == $1) { if (($2 == 0) || (($2 == 1) && (%trigger == $4)) || (($2 == 2) && (%trigger isnum $4 - $5)) || (($2 == 3) && (%trigger >= $4)) || (($2 == 4) && (%trigger <= $4)) || (($2 == 5) && (%trigger == $getrank($nick,$unit.default))) || (($2 == 6) && ($rand(1,$4) <= $5)) || (($2 == 7) && ($4 $+ * iswm %trigger)) || (($2 == 8) && (* $+ $4 iswm %trigger))) { $award.act($3,%trigger,$6-) } } inc %i } } alias award.act { var %do if ($1 == 1) { var %do = tact $rdc($msg.trivia.award($3,$2)) } if (($1 == 2) || ($1 == 5)) { var %do = tsay $rdc($msg.trivia.award($3,$2)) } if ($1 == 3) { var %do = notice $nick $rdc($msg.trivia.award($3,$2)) } if ($1 == 4) { var %do = trivia.credit $nick $3 } if ($1 == 5) { var %do = tban $nick } if ($1 == 6) { var %do = $eval($replace($3-,*,$2),3) } .timer 1 0 schan $chan %do } alias schan { set -u3 %ident $1 $2- } alias award.on.tok { return Null.Score.Row.Time.WPM.Join.Question.Uprank.Promotion.Answered.RoundStart.RoundStop.Command.NoAnswer.Hint.HTMLUpdate.Champ.TeamVictory.TeamAnswered } alias award.val.tok { return Always.Exactly.Between.At Least.At Most.Ranked.Random.Begins.Ends } alias award.do.tok { return Null.Describe.Msg.Notice.Give Points.Ban.Special } ;######################################################## ;# MESSAGING. # ;######################################################## alias -l inform { if ((!$1) || (!$server)) { return } if (!%respond) { var %respondlevel = $getset(status,respondlevel) set -u2 %respond .notice $nick if (%respondlevel == 2) { } if (%respondlevel == 3) { set -u2 %respond msg $iden } if (%respondlevel == 4) { set -u2 %respond msg $nick } if (%respondlevel == 5) { set -u2 %respond describe $iden } } $iif($scid(%cid.force),scid %cid.force) $iif($nick == $me, .timer -m 1 $calc($timer(0) * 100)) %respond $check.auto.strip($rdc($1-)) } alias here { set %cid.force $cid } alias -l tsay { if (($1) && ($server) && ($me ison $iden)) { $iif($nick == $me, .timer -m 1 $calc($timer(0) * 100)) msg $iden $check.auto.strip($rdc($1-)) } } alias -l tact { if (($1) && ($server) && ($me ison $iden)) describe $iden $check.auto.strip($rdc($1-)) } alias -l check.auto.strip { return $iif(c isincs $gettok($chan($iden).mode,1,32), $strip($1-), $1-) } ;######################################################## ;# Direct basic processing, for special functions. # ;######################################################## alias -l do.ping { if ($eval(% $+ pingantispam. $+ $nick,2)) return ctcp $nick ping set -u120 % $+ ping. $+ $nick $ticks set -u120 % $+ pingchan. $+ $nick $chan set -u120 % $+ pingcid. $+ $nick $cid } alias -l trivia.report { inform $msg.trivia.thanks write " $+ $triv(dir) $+ / $+ $iif($1 == 29, $triv(additions), $triv(report)) $+ " $nick $adate $time $2- } ;######################################################## ;# FRIENDS/BANNED. # ;######################################################## alias addressize { if (*!*@* iswm $1) { return $1 } return $1 $+ !*@* } alias -l is.friend { var %i = 1 while ($getset(friend, %i)) { if ($addressize($getset(friend, %i)) iswm $address($ifd($1,$nick),5)) { return %i } inc %i } } alias -l is.banned { var %i = 1 while ($getset(banned,%i)) { if ($addressize($getset(banned, %i)) iswm $address($ifd($1,$nick),5)) { return %i } inc %i } } alias -l trivia.banned { var %banned = $is.banned($1) if (%banned) { if (!$1) { inform $msg.trivia.banned } return %banned } } alias -l ban.size { return $calc(1 + $setini(banned, 0)) } alias -l tban { if (!$trivia.banned($$1)) { setset banned $ban.size $1 } } alias -l tunban { var %i = $trivia.banned($$1) while ($getset(banned, $calc(%i + 1))) { setset banned %i $getset(banned, $calc(%i + 1)) inc %i } setset banned %i } ;######################################################## ;# MISC. # ;######################################################## alias timealias { var %ticks = $ticks echo -a ... $eval($ $+ $1,2) ... $calc(($ticks - %ticks) / 1000) ... $1 } alias timealias2 { var %ticks = $ticks, %i = 1, %result while (%i <= $2) { var %result = $eval($ $+ $eval($1-,2),2) inc %i } return $calc(($ticks - %ticks) / (1000 * $2)) } alias iden { return $iif($chan, $chan, $iif(%ident, %ident, $tchan(1))) } alias idenn { return $iden $+ . $+ $ifd($network,irc) } alias -l deleteplayer { if ($getvar($1)) { write -dl $+ $readn $scoresfil } } alias -l hof.size { return $line($twin,0) } alias -l hof { return $gettok($line($twin,$1),$2,59) } alias -l scoresfil { return $nopath($ifd($thget(scores),$ifd($tchan($trivchan, 4), TriviaScores.fil))) } alias -l user.score { return $getvar($1,$unit.prefix($2) $+ score) } alias -l trivia.on { if (($timer(q $+ $idenn)) || ($timer(end $+ $idenn))) { return $true } } alias -l question.on { if ($timer(end $+ $idenn)) { return $true } } alias -l tokq { return $thget(tokq) } alias -l tok { return $thget(tok $+ $1) } alias -l question.time { return $calc(($ticks - $thget(Start)) / 1000) } alias -l te { return $getset(team, $1 $+ $prop) } alias -l teamscore { return $thget(Score $+ $1) } alias -l max.hinted { return $iif($calc($thget(Temp.Hints) + 0) > $calc($thuser(Hint) + 0), $thget(Temp.Hints), $thuser(hint)) } alias -l isteam { return $thget(Team. $+ $1) } alias -l chkadate { return $iif($getset(status,adate), $+($gettok($1,2,$asc(/)),/,$gettok($1,1,$asc(/)),/,$gettok($1,3,$asc(/))), $1) } alias -l team { if ($thget(team) == 1) { return $true } } alias -l tempini { return triviascbb.ini } alias -l lag { return $iif($thget(lag $+ $1), $thget(lag $+ $1), $getset(lag,$1)) } alias -l slag { return $getset(lag,$1) } alias -l tc { return $getset(color, $1 $+ $iif($prop == b, -bold) $+ $iif($prop == u, -underline)) } alias -l triv { return $getset(trivia, $1) } alias -l aw { return $getset(award, $1) } ;######################################################## ;# MESSAGE COLOR CODE SETTING ALIASES. # ;######################################################## alias e1 { return %c1 $+ $1- $+ %c1o } alias e2 { return %c2 $+ $trivtran($1-) $+ %c2o } alias trivtran { if (!$triv(translate)) return $1- if ($isfile($transfile)) { var %tran = $read($transfile, wtn, $1- $+ ::=*) if ($regex(%tran, /.*::=(.*))) { return $regml(1) } if (#* iswm $read($transfile,n,1)) var %nowrite 1 } if (!%nowrite) write $transfile $1- $+ ::= $+ $1- return $1- } alias untrans { if (!$triv(translate)) return $1- if ($isfile($transfile)) { var %tran = $read($transfile, wtn, *::= $+ $1-) if ($regex(%tran, /(.*)::=.*)) { return $regml(1) } } return $1- } alias tranord { return $1 $+ $trivtran($remove($ord($1),$1)) } alias transfile { return " $+ $triv(translate) $+ " } ;######################################################## ;# MESSAGES. # ;######################################################## alias -l msg.ping.reply { return $e1($nick) $+ $e2($chr(44) your ping is) $e1($calc(($ticks - % [ $+ ping. [ $+ [ $nick ] ] ] ) / 1000)) $e2(secs.) } alias -l msg.answer.correct { return $iif($1,$msg.answer.correct2($2,$3,$4),$e2( $+ 4Rank:) $e1($getmrank($nick) 8- 4Name:7 $nick) $iif(!$getset(status,shownone),$e2(8- 4Answer:) $e1($trivq.answer)) $iif(!$getset(hide,time),$e2(8- 4Time:) $e1($thget(Time))) $iif(!$getset(hide,streak),$e2(8- 4Streak:) $e1($getset(Var $+ $idenn, Row))) $iif(!$getset(hide,score),$e2(8- 4Points:) $e1($user.score($nick)))) $iif(!$getset(hide,wpm),$e2(8- 4WPM:) $e1($int($2))) $iif(!$getset(hide,score),$e2(8- 4Rank:) $e1($tranord($3)) $iif($4,$e2(8- 4Previously:) $e1($tranord($4))))) } alias -l msg.answer.correct2 { return $e1($getmrank($nick) 8- $nick) $e2(got the answer) $+ $iif(!$getset(status,shownone),$e2(:) $e1($trivq.answer),$e2(.)) $iif(!$getset(hide,time),$e2(in) $e1($thget(Time)) $e2(seconds.)) $iif(!$getset(hide,score),$e2(Points:) $e1($user.score($nick))) $e2(Rank:) $e1($tranord($2)) } alias -l msg.answer.timeout { return $e2(Time's up! The answer was:) $e1($trivq.answer) } alias -l msg.answer.timeout.total { return $e2(Time's up! Remaining answers were:) $e1($left($gettotalremain,850)) } alias -l msg.answer.timeout.kaos { return $e2(Time's up!) $e1($total.answered) $e2(/) $e1($total.answers) $e2(answered) } alias -l msg.answer.timeout.pick { return $e2(Time's up! The answer was:) $e1($left($get.picklist,850)) } alias -l msg.answer.timeout2 { return $e2(Time's up!) } alias -l msg.question.multi { return $iif($1, $e1($1) $+ $e2(:)) $e2(Multiple Choice:) $e1($right($tok(1),-7)) $+ $e2(;) $e1($get.multianswers) } alias -l msg.question.total { return $iif($1, $e1($1) $+ $e2(:)) $e2(Give all correct responses:) $e1($right($tok(1),-7)) } alias -l msg.question.kaos { return $iif($1, $e1($1) $+ $e2(:)) $e2(Kaos:) $e1($right($tok(1),-5)) } alias -l msg.question.points { return $iif($1, $e1($1) $+ $e2(:)) $e2(For) $e1($ifd($thget(temp.points),0)) $e2(point $+ $iif($thget(temp.points) != 1,s) $+ :) $e1($get.question($2-)) } alias -l msg.question.scramble { return $iif($1, $e1($1) $+ $e2(:)) $iif($getset(status, sayscramble),$e2(Unscramble the following:)) $iif($2,$e1($2) $+ $e2(:)) $e1($scramble($tok(2)) $+ ?) } alias -l msg.question.standard { return $iif($1, $e1($1) $+ $e2(:)) $e1($get.question($ifd($2,$tok(1)))) } alias -l msg.question.answer { return $e2(The answer to the last question was $+ :) $e1($thget(answer)) } alias -l msg.trivia.stats { return $iif($getvar($1,$2 $+ score), $e1($getmrank($1,$iif(!$2,total,$2)) $1) $+ $e2(:) $iif(!$getset(hide,score),$e2(Rank:) $e1($tranord($getrank($1,$2))) $e2(out of) $e1($hof.size) $+ $e2(.) $e2(Current wins:) $e1($getvar($1,$2 $+ score)) $+ $e2(.)) $iif(!$getset(hide,streak),$e2(Best streak:) $e1($getvar($1,$2 $+ streak)) $+ $e2(.)) $iif(!$getset(hide,time),$e2(Best time:) $e1($getvar($1,$2 $+ time)) $e2(secs.)) $iif(!$getset(hide,wpm),$e2(WPM:) $e1($getvar($1,$2 $+ wpm)) $+ $e2(.)) $iif($getvar($1,lastwin), $e2(Last Win:) $e1($chkadate($getvar($1, lastwin))) $+ $e2(.)), $e2(No such user exists.)) } alias -l msg.trivia.rank { return $iif($user.score($1), $e1($getmrank($1) $1) $+ $e2(:) $iif(!$getset(hide,score),$e2(Current wins:) $e1($user.score($1)) $+ $e2(.)) $iif(($mrankon) && ($getnextmrankat($user.score($1)) != 0),$e2(Next rank:) $e1($getnextmrank($user.score($1))) $iif(!$getset(hide,score),$e2(after:) $e1($calc($getnextmrankat($user.score($1)) - $user.score($1))) $e2(more points.))) $iif(!$getset(hide,score),$e2(Rank:) $e1($tranord($getrank($1,$unit.default))) $e2(out of) $e1($hof.size) $+ $e2(.) $iif(%getrank != 1,$e1($calc(%getnextrankat - $user.score($1))) $e2(points below) $e1(%getnextrankuser) $+ $e2(.))),$e2(Error.)) } alias -l msg.trivia.state { return $msg.trivia.version $e2(is currently) $e1($trivon) $+ $e2(.) $iif($getset(status,champ),$e2(Champ Mode Set to) $e1($triv(reset)) $e2(Wins.)) $e2(Question file contains) $e1($numq) $e2(lines.) $e1($numl) $e2(questions. Trivia is:) $e1($trivia.onoff) $+ $e2(.) $iif($trivia.on, $iif($question.on,$e2(Time left:) $e1($calc($thget(lagtimedout) - $question.time))) $e2(Question:) $e1($thget(Current)) $+ $e2(/) $+ $e1($thget(Max)) $e2(Team Game:) $e1($team.onoff) $+ $e2(. Trivia Round started by) $e1($thget(SUser)) $e2(on) $e1($thget(STime))) $e2(Bot time is:) $e1($time) } alias -l msg.trivia.enabled { return $e2(Enabling the trivia. Have an op type:) $e1($pre $+ $gtok(2)) $e2(to disable the bot.) } alias -l msg.trivia.disabled { return $e2(Disabling the trivia. Have an op type:) $e1($pre $+ $gtok(3)) $e2(to enable the bot.) } alias -l msg.trivia.victory { return $e2(The game has been beaten by) $e1($1) $e2(all hail the new champ whose name shall reign supreme!) } alias -l msg.trivia.unactive { return $e2(The game has been disabled due to inactivity.) } alias -l msg.trivia.emptyoff { return $e2(The game has been disabled due lack of players.) } alias -l msg.trivia.pause { return $e2(Trivia paused.) $e1($pre $+ $gtok(8)) $e2(to resume.) } alias -l msg.trivia.resume { return $e2(Trivia resumed.) } alias -l msg.trivia.started { return $e2(Starting the trivia. Round of) $e1($iif($thget(Max) == Unlimited,$gtok(1,5),$thget(Max))) $e2(questions.) $e1($pre $+ $gtok(6)) $e2(to stop. Total:) $e1($numl) } alias -l msg.trivia.stopped { return $e2(Stopping the trivia.) $e1($pre $+ $gtok(5) $iif(!$isdis(1),< $+ $trivtran(number) $+ >)) $e2(to restart.) } alias -l msg.trivia.awarded { return $e1($1) $e2(was awarded) $e1($2) $e2(point $+ $iif($2 > 1,s) $+ . Current Wins:) $e1($user.score($1)) } alias -l msg.trivia.deducted { return $e1($1) $e2(was deducted) $e1($calc($2 * -1)) $e2(point $+ $iif($2 < -1,s) $+ . Current Wins:) $e1($user.score($1)) } alias -l msg.trivia.hof { return $msg.trivia.champ(1) $msg.trivia.topstats(score) } alias -l msg.trivia.error.midq { return $e2(Cannot pause while trivia game has a question issued.) } alias -l msg.trivia.banned { return $e2(You cannot play $+ $chr(44) you are banned.) } alias -l msg.trivia.guessed { return $e2(You already guessed) $e1($1) $e2(times.) } alias -l msg.trivia.thanks { return $e2(Thank you for your contribution!) } alias -l msg.trivia.totalover { return $e2(All correct responses have been given!) } alias -l msg.trivia.version { return $e1($trivia.name $+ $trivia.version) } alias -l msg.trivia.onjoin { return $iif($getset(trivia,onjoin),$get.onjoin($getset(trivia,onjoin)),$e2(Welcome) $e1($getmrank($nick) $nick) $+ $e2($chr(44)) $e1($msg.trivia.version) $e2(is activated. Type ') $+ $e1($pre $+ $gtok(33)) $+ $e2(' for a list of commands or just ') $+ $e1($pre $+ $gtok(5)) $+ $e2(' to start a game!)) } alias -l msg.trivia.records { return $iif(!$getset(hide,streak),$e2(Record streak:) $e1($recordstat(streak)) $e2(of) $e1($hof(1,4)) $+ $e2(.)) $iif(!$getset(hide,time),$e2(Record time:) $e1($recordstat(time)) $e2(of) $e1($hof(1,3)) $+ $e2(.)) $iif(!$getset(hide,wpm),$e2(Record wpm:) $e1($recordstat(WPM)) $e2(of) $e1($hof(1,5)) $+ $e2(.)) } alias -l msg.trivia.themes { return $e2(Current themes are:) $e1($get.themes) } alias -l msg.trivia.champ { return $iif($getset(status,champ), $e2(Current champ:) $e1($getset(Champ, $ini($trivini, Champ, 0))) $+ $e2(. $get.champ($1))) } alias -l msg.trivia.showteams { return $msg.trivia.showteam(1) $msg.trivia.showteam(2) $iif($getset(team, 4-team), $msg.trivia.showteam(3) $msg.trivia.showteam(4)) } alias -l msg.trivia.showteam { return $iif($get.showteams($1), $e2(Current members of) $e1($te($1)) $e2(are:) $e1($get.showteams($1))) } alias -l msg.trivia.hintpaused { return $e2(You requested a $pre $+ $gtok(39) less than) $e1($triv(hintpause)) $e2(seconds ago.) } alias -l msg.trivia.roundscores { return $e2(Current Round:) $e1($get.roundscores) } alias -l msg.trivia.banlist { return $e2(The following people are banned:) $e1($get.banlist) } alias -l msg.team.start { return $e2(Team Trivia: ') $+ $e1($pre $+ $gtok(34) 1) $+ $e2(' or ') $+ $e1($pre $+ $gtok(34) 2) $+ $iif($getset(team,4-team),$e2(' or ') $+ $e1($pre $+ $gtok(34) 3) $+ $e2(' or ') $+ $e1($pre $+ $gtok(34) 4)) $+ $e2(' to add to a team.) } alias -l msg.team.add { return $e2(Team:) $e1($1) $e2(has a new member:) $e1($2) } alias -l msg.team.joinover { return $e2(I am sorry no more people can join/change at this time.) } alias -l msg.team.toomany { return $e2(That team currently has enough players.) } alias -l msg.team.joinbefore { return $e2(Teams are no longer accepting player.) } alias -l msg.team.alreadyon { return $e2(You are already on that team.) } alias -l msg.team.score { return $e1($getmrank($nick) $nick) $e2(won. Point for) $e1($te($isteam($nick))) $+ $e2(.) $msg.team.cscore(1,2) $iif($getset(team,4-team), $msg.team.cscore(3,4)) } alias -l msg.team.cscore { return $e1($te($1)) $e2(has) $e1($thget(Score $+ $1)) $e2(points.) $e1($te($2)) $e2(has) $e1($thget(Score $+ $2)) $e2(points.) } alias -l msg.team.over { return %c2 $+ $replace($1-, *t1, %c2o $+ $e1($te(1)) $+ %c2,*t2, %c2o $+ $e1($te(2)) $+ %c2,*t3,%c2o $+ $e1($te(3)) $+ %c2,*t4,%c2o $+ $e1($te(4)) $+ %c2) $+ %c2o $+ $e2(!) } alias -l msg.hint.words { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(there $iif($$get.hint(words) == 1,is,are)) $e1($$get.hint(words)) $e2(word $+ $iif($$get.hint(words) != 1,s) in the answer.) } alias -l msg.hint.vowels { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(the vowels are:) $e1($$get.hint(vowels)) } alias -l msg.hint.last { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(the last character in the answer is:) $e1($$get.hint(last)) } alias -l msg.hint.space { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(answer space:) $e1($$get.hint(space)) } alias -l msg.hint.scramble { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(scrambled:) $e1($$get.hint(scramble)) } alias -l msg.hint.hint { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e1($$get.hint(hint,$1)) } alias -l msg.features.built { return $e2(Trivia scores updated:) $e1($1) $e2(!) } alias -l msg.trivia.hof.error { return $e1($pre $+ $gtok(14) < $+ $gtok(1,3) $+ $chr(124) $+ $gtok(2,3) $+ $chr(124) $+ $gtok(3,3) $+ $chr(124) $+ $gtok(4,3) $+ > < $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $gtok(5,4) $+ >) $e2(to display the hall of fame table of your choice.) } alias -l msg.trivia.stats.error { return $e1($pre $+ $gtok(11) < $+ $trivtran(player) $+ $chr(124) $+ $trivtran(number) $+ > < $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $gtok(5,4) $+ >) $e2(to display stats on that individual.) } alias -l msg.trivia.op.ban { return $e2(User is banned.) } alias -l msg.trivia.error.ban { return $e2(You need to specify a user or address to ban.) } alias -l msg.trivia.error.unban { return $e2(You need to specify a user or address to unban.) } alias -l msg.trivia.op.unban { return $e2(User is unbanned.) } alias -l msg.trivia.error.badnum { return $e2(You need to specify a valid question number to be asked.) } alias -l msg.trivia.op.ask { return $e2(Question will be asked.) } alias -l msg.trivia.error.noquestion { return $e2(You need append the question that is to be added directly into the question file.) } alias -l msg.trivia.error.nodelim { return $e2(You need at least one delimiter to indicate: question $+ $triv(delimiter) $+ answer) } alias -l msg.trivia.op.added { return $e2(Question has been added.) } alias -l msg.trivia.error.nosearch { return $e2(You need at least some search text.) } alias -l msg.trivia.op.find { return $iif($get.find($1-),$e1($get.find($1-)),$msg.trivia.error.find) } alias -l msg.trivia.error.find { return $e2(That text was not found.) } alias -l msg.trivia.error.topx { return $e2(Range too great.) } alias -l msg.trivia.error.numberrequired { return $e2(You must specify a valid team number for) $e1($1-) $e2(.) } alias -l msg.trivia.error.playerrequired { return $e2(You must specify a player.) } alias -l msg.trivia.echoanswer { return $e2(Answer:) $e1($trivq.answer) } ;######################################################## ;# Help structure. # ;######################################################## alias -l givehelp { if (!$1-) { inform $e2(Commands:) $e1($pre $+ $gtok(6) $pre $+ $gtok(5) $pre $+ $gtok(39) $pre $+ $gtok(34) $pre $+ $gtok(29) $pre $+ $gtok(30) $pre $+ $gtok(31) $pre $+ $gtok(27) $pre $+ $gtok(28) $pre $+ $gtok(14) $pre $+ $gtok(19) $pre $+ $gtok(16) $pre $+ $gtok(21) $pre $+ $gtok(25) $pre $+ $gtok(38) $pre $+ $gtok(23) $pre $+ $gtok(26) $pre $+ $gtok(44) $pre $+ $gtok(37) $pre $+ $gtok(11) $pre $+ $gtok(1) $pre $+ $gtok(3) $pre $+ $gtok(2) $pre $+ $gtok(10) $pre $+ $gtok(41) $pre $+ $gtok(42) $pre $+ $gtok(43) $pre $+ $gtok(35) $pre $+ $gtok(36) $pre $+ $gtok(4) $pre $+ $gtok(7) $pre $+ $gtok(8) $pre $+ $gtok(62)) inform $e1($pre $+ $gtok(33) < $+ $trivtran(command) $+ >) $e2(for specific help. Some commands may be disabled.) } var %ctok = $iif($pre $+ * iswm $1, $ctok($right($1,$calc(-1 * $len($pre)))), $ctok($1)) if ((%ctok == 1)) { inform $e1($gtok(%ctok) -----) $e2(Displays the state of the bot) } if ((%ctok == 6)) { inform $e1($gtok(%ctok) ---) $e2(Stops trivia) } if ((%ctok == 3)) { inform $e1($gtok(%ctok) ----) $e2(Enables trivia bot) } if ((%ctok == 2)) { inform $e1($gtok(%ctok) ---) $e2(Disables trivia bot) } if ((%ctok == 7)) { inform $e1($gtok(%ctok) ----) $e2(Pauses trivia bot) } if ((%ctok == 8)) { inform $e1($gtok(%ctok) ----) $e2(Resumes trivia bot) } if ((%ctok == 4)) { inform $e1($gtok(%ctok) < $+ $trivtran(command) $+ > -) $e1($gtok(1,2)) $+ $e2($chr(44)) $e1($gtok(2,2)) $+ $e2($chr(44)) $e1($gtok(3,2)) $+ $e2($chr(44)) $e1($gtok(4,2)) $+ $e2($chr(44)) $e1($gtok(5,2)) $+ $e2($chr(44)) $e1($gtok(6,2)) $+ $e2($chr(44)) $e1($gtok(7,2)) $+ $e2($chr(44)) $e1($gtok(8,2)) $+ $e2($chr(44) commands to allow ops to control the trivia bot.) } if ((%ctok == 5)) { inform $e1($gtok(%ctok) x --) $e2(Starts trivia, x can be a number, "unlimited", <theme> or "team" for team mode) } if ((%ctok == 39)) { inform $e1($gtok(%ctok) ------) $e2(Gives a hint) } if ((%ctok == 42)) { inform $e1($gtok(%ctok) ------) $e2(Gives the last character of the answer) } if ((%ctok == 41)) { inform $e1($gtok(%ctok) ------) $e2(Gives the number of words in the answer) } if ((%ctok == 43)) { inform $e1($gtok(%ctok) ------) $e2(Gives the vowels of the answer) } if ((%ctok == 34)) { inform $e1($gtok(%ctok) x ----) $e2(Joins a team, must be in team mode, x can be a 1 or 2) } if ((%ctok == 29)) { inform $e1($gtok(%ctok) -------) $e2(Allows you to add questions: $pre $+ $gtok(29) What is the square root of 4*two*2) } if ((%ctok == 30)) { inform $e1($gtok(%ctok) ----) $e2(Lets you report problems with the questions: $pre $+ $gtok(30) The square root of 4 is also -2) } if ((%ctok == 31)) { inform $e1($gtok(%ctok) -----) $e2(Checks your lag from the bot) } if ((%ctok == 27)) { inform $e1($gtok(%ctok) ---) $e2(Displays the version of the bot) } if ((%ctok == 28)) { inform $e1($gtok(%ctok) -------) $e2(Displays the web page for the bot) } if ((%ctok == 14)) { inform $e1($gtok(%ctok) < $+ $gtok(1,3) $+ $chr(124) $+ $gtok(2,3) $+ $chr(124) $+ $gtok(3,3) $+ $chr(124) $+ $gtok(4,3) $+ > < $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $gtok(5,4) $+ > -------) $e2(Displays the hall of fame, for requested entry) } if ((%ctok == 19)) { inform $e1($gtok(%ctok) ---) $e2(Displays the record times. Same as $pre $+ $gtok(14) $gtok(2,3)) } if ((%ctok == 16)) { inform $e1($gtok(%ctok) --) $e2(Displays the record streaks. Same as $pre $+ $gtok(14) $gtok(3,3)) } if ((%ctok == 21)) { inform $e1($gtok(%ctok) ----) $e2(Displays the record words per minute. Same as $pre $+ $gtok(14) $gtok(4,3)) } if ((%ctok == 25)) { inform $e1($gtok(%ctok) ---) $e2(Displays the record $gtok(2,3) & $gtok(3,3) & $gtok(4,3)) } if ((%ctok == 23)) { inform $e1($gtok(%ctok) ----) $e2(Displays the bot's server) } if ((%ctok == 26)) { inform $e1($gtok(%ctok) -----) $e2(Displays the champ stats) } if ((%ctok == 36)) { inform $e1($gtok(%ctok)) $e2(Displays the scores for the current round.) } if ((%ctok == 35)) { inform $e1($gtok(%ctok)) $e2(Displays the teams and which players are on each.) } if ((%ctok == 44)) { inform $e1($gtok(%ctok) ----) $e2(Repeats the question) } if ((%ctok == 37)) { inform $e1($gtok(%ctok) ----) $e2(Provides the answer to the last question to an op who requests it) } if ((%ctok == 38)) { inform $e1($gtok(%ctok) ----) $e2(After half the time to answer has expired allows an instant timeout.) } if ((%ctok == 10)) { inform $e1($gtok(%ctok) ----) $e2(Lists available themes) } if ((%ctok == 11)) { inform $e1($gtok(%ctok) ------) $e2(Returns your current stats, or $pre $+ $gtok(11) <player> for somebody else) } if ((%ctok == 62)) { inform $e1($gtok(%ctok) ----) $e2(Displays score required for next promotion.) } } ;######################################################## ;# MESSAGE PROCESSES. # ;######################################################## alias -l get.question { var %gq $1- if (!$getset(status,noautoqm)) { var %aqm = 1 } if ($right(%gq,1) isin :!?.-) { var %aqm = 0 } if ($right(%gq,1) isin -) { var %gq = $left(%gq,-1) } if ($thget(temp.bonus) == S) { %gq = $scramble(%gq) } if ($thget(temp.bonus) == R) { %gq = $reverse(%gq) } if ($thget(temp.bonus) == G) { %gq = $scatter(75,%gq) } return %gq $+ $iif(%aqm,?) } alias -l get.banlist { var %i = 1, %b.temp while ($getset(banned,%i)) { var %b.temp = %b.temp $getset(banned,%i) inc %i } return %b.temp } alias -l get.roundscores { if ($window(@round $+ $idenn)) { window -c @round $+ $idenn } window -hn @round $+ $idenn .timer 1 0 window -c @round $+ $idenn var %i = 1 while ($hmatch(Trivia $+ $idenn, Score.*, %i)) { var %j = $line(@round $+ $idenn,0) while (( $hget(Trivia $+ $idenn, $hmatch(Trivia $+ $idenn, Score.*, %i)) > $thget(Score. $+ $line(@round $+ $idenn, %j))) && (%j >= 1)) { dec %j } iline @round $+ $idenn $calc(%j + 1) $remove($hmatch(Trivia $+ $idenn, Score.*, %i),Score.) inc %i } var %roundscores %i = 1 while (%i <= 15) { %roundscores = %roundscores $iif($line(@round $+ $idenn,%i),$line(@round $+ $idenn,%i) $+ - $+ $thget(Score. $+ $line(@round $+ $idenn,%i))) inc %i } return %roundscores } alias sortroundscores { var %j = 1 while (%j <= $line(@round $+ $idenn,0)) { var %k = %j while (%k <= $line(@round $+ $idenn,0)) { if ($thget(Score. $+ $line(@round $+ $idenn, %j)) > $thget(Score. $+ $line(@round $+ $idenn, %k))) { var %temp.name = $line(@round $+ $idenn, %j) rline @round $+ $idenn %j $line(@round $+ $idenn, %k) rline @round $+ $idenn %j %temp.name } inc %k } inc %j } } alias get.showteams { var %i = 1 while ($hmatch(Trivia $+ $idenn, Team.*, %i)) { if ($isteam($remove($hmatch(Trivia $+ $idenn, Team.*, %i),Team.)) == $1) { var %temp.team = %temp.team $remove($hmatch(Trivia $+ $idenn, Team.*, %i),Team.) } inc %i } return %temp.team } alias -l get.champ { if (($setini(Champ,0) <= 0) || (!$getset(status,champ))) { return } var %temp.champ, %i = $calc($ini($trivini, Champ, 0) - 1) while ((%i >= 1) && (!$1)) { var %temp.champ = %temp.champ $getset(Champ, %i) dec %i } return %temp.champ } alias -l get.multianswers { var %i 2, %answers.t if ($window(@multianswer)) { window -c @multianswer } window -h @multianswer .timer 1 0 window -c @multianswer while ($tok(%i)) { aline @multianswer $tok(%i) inc %i } filter -wwct 1 13 @multianswer @multianswer * var %i 2 var %answers.t $line(@multianswer,1) while ($line(@multianswer, %i)) { var %answers.t = %answers.t $+ , $line(@multianswer, %i), %i = $calc(%i + 1) } return %answers.t } alias -l get.themes { var %i = 1 while ($getset(triviamode $+ %i, name)) { var %temp.themes = %temp.themes $getset(triviamode $+ %i, name) inc %i } return $e1(%temp.themes) } alias -l get.onjoin { return %c2 $+ $replace($1-,$chr(35),$+(%c2o,%c1,$chan,%c1o,%c2),*, $+(%c2o,%c1,$getmrank($nick) $nick,%c1o,%c2),@, $+(%c2o,%c1,$tranord($getrank($nick,$unit.default)),%c1o,%c2),^, $+(%c2o,%c1,$ifd($getvar($nick,score),0),%c1o,%c2)) $+ %c2o } alias -l get.picklist { if ($tokq <= 2) return $tok(2) var %i = 2, %picklist while (%i <= $tokq) { %picklist = %picklist $tok(%i) if (%i < $calc($tokq - 1)) { %picklist = %picklist $+ $chr(44) } if (%i == $calc($tokq - 1)) { %picklist = %picklist $trivtran(and) } inc %i } return %picklist } ;######################################################## ;# HTML BUILD # ;######################################################## alias bgcolor { return #000000 } alias textcolor { return #2CABE9 } alias linkcolor { return #33FF00 } alias alinkcolor { return #666600 } alias vlinkcolor { return #666666 } alias htmlbuild { var %start.ticks = $ticks set %htmlfile " $+ $mircdir $+ \ $+ $ifd($getset(build,genname),trivia.htm) $+ " sort score $unit.default if ($exists(%htmlfile)) { .remove %htmlfile } write %htmlfile <HTML><head><title> $+ Triva Scores! $+ </title></head> write %htmlfile <body bgcolor=" $+ $bgcolor $+ " text=" $+ $textcolor $+ " link=" $+ $linkcolor $+ " alink=" $+ $alinkcolor $+ " vlink=" $+ $vlinkcolor $+ "> write %htmlfile <center> <font size="10"> Latest Trivia Score! </font></center><br><br> write %htmlfile <center><table BORDER COLS=4 WIDTH="90%" ><tr><tr> write %htmlfile <th><center> $+ $trivtran(Ranking) $+ </center></th><th><center> $+ $trivtran(Name) $+ </center></th> $+ $iif(!$getset(hide,score),<th><center> $+ $trivtran(Score) $+ </center></th>) $+ $iif(!$getset(hide,time),<th><center> $+ $trivtran(Best Time) $+ </center></th>) $+ $iif(!$getset(hide,streak),<th><center> $+ $trivtran(Best Streak) $+ </centeR></th>) $+ $iif(!$getset(hide,wpm),<th><center> $+ $trivtran(Best WPM) $+ </center></th>) $+ </tr> var %i = 1, %j = $hof.size if ($getset(build,top) isnum 1 - %j) { %j = $getset(build,top) } if ($version >= 6.15) { set %count.num.t %i filter -wkr %i $+ - $+ %j $twin htmlprocess unset %count.num.t } else { while (%i <= %j) { write %htmlfile <tr><th><center> $+ %i $+ </center></th><td><center> $+ $hof(%i,1) $+ </center></td> $+ $iif(!$getset(hide,score),<td><center> $+ $hof(%i,$gttok($unit.mark $+ score)) $+ </center></td>) $+ $iif(!$getset(hide,time),<td><center> $+ $hof(%i,$gttok($unit.mark $+ time)) $+ </center></td>) $+ $iif(!$getset(hide,streak),<td><center> $+ $hof(%i,$gttok($unit.mark $+ streak)) $+ </center></td>) $+ $iif(!$getset(hide,wpm),<td><center> $+ $hof(%i,$gttok($unit.mark $+ wpm)) $+ </center></td>) $+ </tr> inc %i } } write %htmlfile </table><center><br> echo -a $e2(Finished:) $e1(%htmlfile) $e2(is written. In) $e1($calc(($ticks - %start.ticks) / 1000)) $+ $e2(secs.) unset %htmlfile } alias htmlprocess { write %htmlfile <tr><th><center> $+ %count.num.t $+ </center></th><td><center> $+ $gettok($1,1,59) $+ </center></td> $+ $iif(!$getset(hide,score),<td><center> $+ $gettok($1,$gttok($unit.mark $+ score),59) $+ </center></td>) $+ $iif(!$getset(hide,time),<td><center> $+ $gettok($1,$gttok($unit.mark $+ time),59) $+ </center></td>) $+ $iif(!$getset(hide,streak),<td><center> $+ $gettok($1,$gttok($unit.mark $+ streak),59) $+ </center></td>) $+ $iif(!$getset(hide,wpm),<td><center> $+ $gettok($1,$gttok($unit.mark $+ wpm),59) $+ </center></td>) $+ </tr> inc %count.num.t } alias xmlbuild { if ($version < 6.15) { echo -a Update to a later version of mIRC. This code will not work with versions prior to 6.15. return } var %start.ticks = $ticks set %xmlfile " $+ $mircdir $+ \ $+ triv-rss-091.xml $+ " sort score $unit.default if ($exists(%xmlfile)) { .remove %xmlfile } write %xmlfile <?xml version="1.0" ?> write %xmlfile <rss version="0.91"> write %xmlfile <channel> write %xmlfile <title> $trivia.name </title> write %xmlfile <link> $trivia.web </link> write %xmlfile <description>Latest Scores</description> write %xmlfile <language>en-us</language> write %xmlfile <copyright>Copyright $asctime(yyyy) $+ </copyright> write %xmlfile <lastBuildDate> $asctime($gmt, ddd $+ $chr(44) dd mmm yyyy HH:nn:ss) GMT </lastBuildDate> var %i = 1, %j = $hof.size if ($getset(build,top) isnum 1 - %j) { %j = $getset(build,top) } set %count.num.t %i filter -wkr %i $+ - $+ %j $twin xmlprocess unset %count.num.t write %xmlfile </channel> write %xmlfile </rss> echo -a $e2(Finished:) $e1(%xmlfile) $e2(is written. In) $e1($calc(($ticks - %start.ticks) / 1000)) $+ $e2(secs.) unset %xmlfile } alias xmlprocess { write %xmlfile <item> write %xmlfile <title> $+ $gettok($1,1,59) $+ </title> write %xmlfile <description> Score: $gettok($1,$gttok($unit.mark $+ score),59) Record Time: $gettok($1,$gttok($unit.mark $+ time),59) Streak: $gettok($1,$gttok($unit.mark $+ streak),59) WPM: $gettok($1,$gttok($unit.mark $+ wpm),59) </description> write %xmlfile <link> $+ $trivia.web $+ </link> write %xmlfile </item> inc %count.num.t } alias xmlbuildon { setset build xml 1 } alias xmlbuildoff { setset build xml 0 } alias unit.mark { return $iif($unit.default != total,$unit.default) } alias htmltrigger { if ($getset(build,xml)) { xmlbuild } if ($getset(build,generate)) { htmlbuild } if (($getset(build,auto)) && ($exists($+(",$triv(dir),\,ftpbatch.txt,")))) { run -n ftp $+(-s:,",$triv(dir),\,ftpbatch.txt") } if (($getset(build,copy)) && ($exists(" $+ $getset(build,from) $+ ")) && ($exists(" $+ $getset(build,to) $+ "))) { .copy -o " $+ $getset(build,from) $+ " " $+ $getset(build,to) $+ \ $+ $nopath($getset(build,from)) $+ " } if ($getset(build,web)) { tsay $msg.features.built($getset(build,web)) } award HTMLUpdate 0 } ;######################################################## ;# SPECIAL COMMANDS. # ;# /find <text> : Finds the text in your current # ;# question files for the channel. # ;# /add <question> : directly adds the given question. # ;# /ask <question|#> : Force asks a given question. # ;# /sortfile : Sorts the selcted file alphanumerically. # ;# /killdup : Kills exact duplicate questions in file. # ;# /killfixdup : Uses internal fix routine to kill same # ;# questions with a little more checking. # ;# /reformfile <filename> <regex> <regex> : Uses the # ;# regsub command to reform a file. For example: # ;# /reformfile q.txt ([^\|]+)\|([^\*]+) \2*\1 # ;# would change q.txt from answer|question form to # ;# question*answer form. You need to know regex. # ;# /tpurge <#> : Moves everybody with less that # point # ;# to a secondary file called backburner. If they # ;# score another point they will be restored. # ;# /tdpurge <#> : Anybody who hasn't played in # days. # ;# /copyentry <filefrom> <fileto> <nickname> : Copies. # ;# /debackburn : Reverses effect of /tpurge commands. # ;# /mergefiles <filefrom> <fileto> : Merges two score # ;# files into one score file. # ;# /tfind : finds score files that should be merged. # ;# /tmerge <fromplayer> <toplayer> : merge player score # ;# /trename <fromplayer> <toplayer> : renames player # ;# /triviaad <#> <message> : displays message every <#> # ;# of minutes. # ;# /triviaad2 <#> <message> : Same but colored. # ;# /truntimes <timeon> <timeoff> : turns bot on and off # ;# only plays during the given times. # ;######################################################## alias find { echo $get.find($1-) } alias add { if ($exists($qfile(1))) write $qfile(1) $1- } alias ask { var %asknm = 1 while ($thget(Ask $+ %asknm)) { inc %asknm } if ($hget(Trivia $+ $idenn)) { thset Ask $+ %asknm $iif($1-,$1-,$$?="Force which question number(#) or ask what question(Question*Answer)?") } } alias sortfile { var %file = " $+ $sfile($mircdir) $+ " filter -ffct 1 13 %file %file * } alias killdup { var %file = " $+ $sfile($mircdir) $+ ", %i = 0 window -hn @temp.window window -hn @temp.windowfile filter -fwct 1 13 %file @temp.windowfile * while ($line(@temp.windowfile,0) >= %i) { var %line = $line(@temp.windowfile,%i) if (%line) { aline -n @temp.window %line } unset %line inc %i } filter -wfc @temp.window %file * window -c @temp.window window -c @temp.windowfile } alias killfixdup { var %file = $sfile($mircdir), %i = 0, %fixed = 0 window -hn @temp.windowfix window -hn @temp.windowfile .timer 1 0 window -c @temp.windowfix .timer 1 0 window -c @temp.windowfile filter -fwct 1 13 " $+ %file $+ " @temp.windowfile * while ($line(@temp.windowfile,0) >= %i) { if ($line(@temp.windowfile,%i)) { aline -n @temp.windowfix $fix($line(@temp.windowfile,%i)) if (%fixed != $line(@temp.windowfix,0)) { write $nopath(%file) $+ .fix $line(@temp.windowfile,%i) } var %fixed = $line(@temp.windowfix,0) } inc %i } echo -s Killed dups, saved as %file $+ .fix $+ ! } alias reformfile { if (!$exists($1)) { echo File not found. | return } var %i = 1, %replace, %matchez = 0 while (%i <= $lines($1)) { if ($regsub($read($1,%i),$2, $3, %replace)) { write $1 $+ .ref %replace | inc %matchez } inc %i } echo Done, %matchez lines replaced, saved as $1 $+ .ref } alias tpurge { var %i = 1 sort score while ($hof(%i,1)) { if ($hof(%i,2) <= $$1) { copyentry $$scoresfil $$tempfil $hof(%i,1) } inc %i } } alias tdpurge { var %i = 1 sort score while ($hof(%i,1)) { if ($round($calc(($ctime($date) - $ctime($hof(%i,6)))/86400),0) > $$1) { copyentry $$scoresfil $$tempfil $hof(%i,1) } inc %i } } alias copyentry { if (!$exists($1)) { echo -a $1 does not exist. | return } if (!$exists($2)) { echo -a $2 does not exist. | return } write $2 $$read($1, w, $3 $+ ;*) write -dl $+ $$readn $1 } alias debackburn { mergefiles $tempfil $scoresfil } alias mergefiles { echo Merging files $1 and $2 if (!$exists($1)) { echo -a $1 does not exist. | return } if (!$exists($2)) { echo -a $2 does not exist. | return } while ($lines($1) > 0) { if ($numtok($read($1,1),$asc(;)) <= 1) { echo -a ERROR, file does not appear to be standard format. | return } var %player = $gettok($read($1,1),1,$asc(;)) mergeentry $1 $2 %player } } alias mergeentry { if (!$exists($1)) { echo -a $1 does not exist. | return } if (!$exists($2)) { echo -a $2 does not exist. | return } var %merger = $read($1, wnt, $3 $+ ;*) var %other = $read($2, wnt, $3 $+ ;*) var %merger.line = $readn if (%merger) { if (%other) { write $2 PlayerMoving= $+ %merger write -d1 $+ %merger.line $1 tmergeplayers PlayerMoving= $+ $3 $3 } else copyentry $1 $2 $3 } } alias tfind { if ($exists($scoresfil)) { echo -a Finding Duplicate Entries window -h $twin filter -fwc $scoresfil $twin var %k = $line($twin,0) while (%k > 0) { %hostname = $replace($mask($gettok($line($twin,%k), $gttok(address), 59),2),.,\.,*,.*) if (%hostname) { var %j = 1 var %fline = $fline($twin,$str([^;]*;,7) $+ %hostname $+ ;.*,1,2) while (%fline) { if (%j == 2) { echo -a Multiple references: echo -a ... $gettok($line($twin,%prev.fline),1,59) ... $gettok($line($twin,%prev.fline),$gttok(address),59) } if (%j >= 2) { echo -a ... $gettok($line($twin,%fline),1,59) ... $gettok($line($twin,%fline),$gttok(address),59) dline $twin %prev.fline } inc %j var %prev.fline = %fline var %fline = $fline($twin,$str([^;]*;,7) $+ %hostname $+ ;.*,2,2) } } dec %k } } echo -a To combine entries use: /tmerge <from-nick> <to-nick> window -c $twin } alias tmerge { tmergeplayers $1 $2 tsay $msg.trivia.stats($2) } alias tmergeplayers { if (($$getvar($$1,score)) && ($$getvar($$2,score))) { var %i = $numtok($unit.tokens, $asc(.)) while (%i > 0) { var %unit = $gettok($unit.tokens, %i, $asc(.)) if ($getvar($1, %unit) == $eval($ $+ get. $+ %unit,2)) { if ($getvar($2, %unit) == $eval($ $+ get. $+ %unit,2)) { setvar $2 %unit $+ score $calc($getvar($2,%unit $+ score) + $getvar($1,%unit $+ score)) if ($getvar($1, %unit $+ WPM) > $getvar($2,%unit $+ WPM)) { setvar $2 %unit $+ WPM $getvar($1, %unit $+ WPM) } if ($getvar($1, %unit $+ streak) > $getvar($2,%unit $+ streak)) { setvar $2 %unit $+ streak $getvar($1, %unit $+ streak) } if ($getvar($1, %unit $+ time) < $getvar($2,%unit $+ time)) { setvar $2 %unit $+ time $getvar($1, %unit $+ time) } } else { setvar $2 %unit $+ score $getvar(%unit $+ score) setvar $2 %unit $+ WPM $getvar(%unit $+ WPM) setvar $2 %unit $+ streak $getvar(%unit $+ streak) setvar $2 %unit $+ time $getvar(%unit $+ time) } } dec %i } setvar $2 score $calc($getvar($2,score) + $getvar($1,score)) if ($getvar($1, wpm) > $getvar($2,wpm)) { setvar $2 wpm $getvar($1, wpm) } if ($getvar($1, streak) > $getvar($2,streak)) { setvar $2 streak $getvar($1, streak) } if ($getvar($1, time) < $getvar($2,time)) { setvar $2 time $getvar($1, time) } setvar $2 admin $or($getvar($1,admin),$getvar($2,admin)) deleteplayer $1 } } alias trename { setvar $1 name $2 tsay $msg.trivia.stats($2) } alias triviad { if (($1 >= 1) && ($2)) { .timertriviaad 0 $calc($$1 * 60) timer.ad $chan $2- } else { .timertriviaad off } } alias triviad2 { if (($1 >= 1) && ($2)) { .timertriviaad 0 $calc($$1 * 60) msg $chan $e1($2-) } else { .timertriviaad off } } alias truntimes { if (($regex($1,/\d+:\d+/)) && ($regex($2,/\d+:\d+/))) { .timertriviarunon -o $1 1 1 tboton $1 .timertriviarunoff -o $2 1 1 tbotoff $2 } else { .timertriviarun* off } } alias tboton { .timertriviarunon -o $1 1 1 tboton $1 setset status bot 1 trivia } alias askrotate { set %askcount $calc((%askcount + 1) % $numq) ask %askcount } alias tbotoff { .timertriviarunoff -o $1 1 1 tbotoff $1 if ($trivia.on) { strivia } setset status bot 0 } alias tempfil { return backburner.txt } alias timer.ad { if (!$trivia.on) { msg $1 $e1($2-) } } ;######################################################## ;# DIALOGS. # ;######################################################## dialog trivset { title "Trivia Settings" size -1 -1 912 544 option pixels tab General, 1, 4 8 896 523 box Channels, 9, 12 36 502 108, tab 1 text Delimiter, 10, 22 443 68 20, tab 1 text Add/Report, 11, 18 405 92 20, tab 1 button Add, 24, 24 204 64 20, tab 1 edit , 30, 84 113 418 22, tab 1 autohs edit $triv(delimiter), 31, 20 463 34 24, tab 1 edit $triv(additions), 32, 112 405 86 24, tab 1 autohs edit $triv(report), 33, 204 405 86 24, tab 1 autohs edit $triv(dir), 35, 100 371 402 24, tab 1 autohs text Percent Hint, 14, 532 84 68 20, tab 1 edit $triv(perchint), 99, 676 84 40 26, tab 1 text Number of hints, 15, 532 66 136 20, tab 1 edit $triv(numhint), 861, 676 58 40 26, tab 1 text Hint Reduction, 16, 536 352 108 20, tab 1 edit $triv(DPH), 863, 704 356 48 24, tab 1 text Points per answer, 17, 536 326 148 20, tab 1 edit $triv(PPQ), 65, 704 326 48 24, tab 1 list 108, 82 48 424 64, tab 1 size button Add, 115, 18 60 58 20, tab 1 button Remove, 119, 18 88 62 20, tab 1 text Channel:, 125, 16 116 62 20, tab 1 edit , 132, 96 300 398 24, tab 1 autohs box "Points", 133, 520 308 308 76, tab 1 box "Global", 134, 12 344 496 152, tab 1 button "Scores", 141, 36 304 56 20, tab 1 button "Define", 20, 424 440 55 21, tab 1 check "Trivia Ranks", 148, 364 416 116 24, tab 1 check Crosshatch, 47, 532 124 116 20, tab 1 text Chr, 21, 652 124 31 26, tab 1 edit , 961, 684 124 28 26, tab 1 box "Hints", 80, 524 48 304 256, tab 1 radio "Scatter", 58, 612 196 75 20, group tab 1 radio "Plot", 129, 692 196 75 20, tab 1 radio "Basic", 130, 536 196 75 20, tab 1 text $hint.example, 199, 536 172 274 20, tab 1 check "Say Hint Number", 147, 532 144 160 24, tab 1 radio "Standard", 149, 532 248 92 20, group tab 1 radio "Last Letter", 150, 624 252 100 20, tab 1 radio "Vowels", 151, 536 276 72 20, tab 1 radio "Random", 152, 624 280 88 20, tab 1 text "First Hint Type", 153, 536 224 122 20, tab 1 button "Remove", 12, 24 272 64 20, tab 1 list 34, 92 200 410 92, tab 1 sort size box "Channel Properties", 83, 12 144 498 192, tab 1 edit $triv(translate), 131, 232 464 272 24, tab 1 autohs button "Translation File", 136, 108 468 115 20, tab 1 button "Trivia Dir", 13, 20 376 67 17, tab 1 text "Nick", 543, 28 168 34 20, tab 1 edit "", 544, 64 168 76 25, tab 1 autohs text "Network", 66, 160 168 70 20, tab 1 edit "", 67, 236 164 116 25, tab 1 autohs check Auto-Hint, 41, 532 103 132 20, tab 1 tab Options, 6 text questions, 18, 72 219 80 21, tab 6 check No-activity off, 88, 20 187 140 20, tab 6 edit $triv(naoff), 89, 16 215 50 32, tab 6 text seconds, 19, 250 211 76 25, tab 6 check Hint-Pause, 96, 200 185 140 20, tab 6 edit $triv(hintpause), 97, 198 211 50 32, tab 6 check Echo Answer, 40, 20 60 140 20, tab 6 check Timeout Answer, 45, 200 106 140 20, tab 6 check Join Message, 46, 12 336 120 20, tab 6 check Traditional win, 48, 20 105 140 20, tab 6 check Auto-Start, 49, 385 60 140 20, tab 6 check Say Scramble:, 53, 202 60 140 20, tab 6 check Showteam End, 55, 200 81 140 20, tab 6 check Answer Space, 56, 384 127 140 20, tab 6 check No Mid-Match, 57, 574 160 140 20, tab 6 check Show Matched, 59, 200 131 140 20, tab 6 check Use Adate, 60, 20 82 140 20, tab 6 check No ? end, 830, 574 60 140 20, tab 6 check No Spell Correct, 817, 574 140 140 20, tab 6 check "Monday Week", 126, 384 83 140 20, tab 6 check Limit Guesses, 51, 384 166 140 20, tab 6 edit $triv(limitguess), 144, 384 191 36 32, tab 6 check Round HoF, 52, 384 105 140 20, tab 6 edit , 22, 12 368 728 89, tab 6 read multi autovs edit $triv(onjoin), 138, 148 336 596 29, tab 6 autohs check No Partial Match, 43, 574 180 140 20, tab 6 text "tries", 146, 420 192 58 28, tab 6 check No Decheater, 44, 574 80 140 20, tab 6 check No Color Short, 61, 574 100 140 20, tab 6 check "Score", 106, 28 292 84 20, tab 6 check "Time", 169, 120 292 80 20, tab 6 check "Streak", 171, 204 292 80 20, tab 6 check "WPM", 173, 288 292 72 20, tab 6 box "Hide Stat", 174, 12 264 368 60, tab 6 check "No Catergories", 62, 574 120 140 20, tab 6 check "Empty Off", 54, 20 127 140 20, tab 6 check "No Bonus", 50, 574 200 140 20, tab 6 check "No Q number", 63, 574 220 140 20, tab 6 box Settings, 70, 8 40 732 288, tab 6 check "Keep Ask", 156, 20 150 140 20, tab 6 check "Show Nothing", 143, 200 156 140 20, tab 6 tab Defaults, 2 box , 23, 280 63 322 80, tab 2 box , 25, 602 67 174 76, tab 2 check Colors, 116, 280 48 88 20, tab 2 push text Primary, 110, 286 74 60 17, tab 2 text Secondary, 120, 286 110 84 21, tab 2 edit $tc(1), 121, 372 74 35 28, tab 2 read edit $tc(2), 122, 376 110 35 28, tab 2 read edit $tc(3), 123, 607 74 43 28, tab 2 read edit $tc(4), 124, 607 110 43 28, tab 2 read check B, 117, 541 74 24 24, tab 2 push check U, 118, 568 74 24 24, tab 2 push check B, 127, 541 110 24 24, tab 2 push check U, 128, 568 110 20 24, tab 2 push combo 111, 412 74 124 240, tab 2 size drop combo 112, 412 110 124 240, tab 2 size drop combo 113, 652 74 120 240, tab 2 size drop combo 114, 652 110 120 240, tab 2 size drop box Time, 26, 12 188 264 244, tab 2 text Before Start, 27, 30 208 155 25, tab 2 text Between Questions (answered), 36, 30 342 155 25, tab 2 text Given to Answer, 37, 30 234 155 25, tab 2 text Before Auto-Hint, 38, 30 288 155 25, tab 2 text (timed-out), 39, 30 369 155 25, tab 2 text Before hint allowed, 862, 30 261 155 25, tab 2 text Between Ping Delay, 167, 30 398 155 25, tab 2 text Between Auto-Hints, 177, 30 315 155 25, tab 2 edit $slag(start), 135, 192 208 65 24, tab 2 edit $slag(answered), 145, 192 346 65 24, tab 2 edit $slag(timedout), 155, 192 234 65 24, tab 2 edit $slag(hint), 165, 192 290 65 24, tab 2 edit $slag(timed), 175, 192 374 65 24, tab 2 edit $slag(hintallow), 185, 192 262 65 24, tab 2 edit $slag(ping), 195, 192 402 65 28, tab 2 edit $slag(betweenhint), 205, 192 318 65 24, tab 2 box Questions, 64, 14 40 262 144, tab 2 text Default Round, 68, 120 54 78 17, tab 2 text Champ Goal, 69, 284 380 94 21, tab 2 text Team Round, 71, 120 102 70 17, tab 2 edit $triv(default), 299, 148 74 91 24, tab 2 edit $triv(reset), 215, 384 380 79 28, tab 2 edit $triv(dteam), 217, 164 122 71 24, tab 2 button $record.type($triv(Record)), 218, 82 150 149 20, tab 2 button Themes, 700, 374 304 68 20, tab 2 radio Unlimited, 201, 24 82 96 20, tab 2 radio Team, 202, 24 104 92 20, tab 2 radio Normal, 203, 24 60 84 20, tab 2 check Disable, 816, 284 300 80 20, tab 2 box , 8, 278 284 186 56, tab 2 check "Background", 158, 600 48 92 24, tab 2 push check Champ Mode, 42, 284 356 136 21, tab 2 box , 179, 278 344 188 68, tab 2 box Score By, 178, 280 200 184 84, tab 2 check "Change", 182, 288 224 84 20, tab 2 combo 183, 288 248 128 100, tab 2 size drop tab Teams, 3 box Names, 72, 12 80 872 140, tab 3 text Team 1, 73, 28 112 60 20, tab 3 text Team 2, 74, 28 152 60 20, tab 3 text Team 3, 308, 396 112 60 20, disable tab 3 text Team 4, 309, 396 152 60 20, disable tab 3 box Victories, 75, 20 220 868 220, tab 3 text Tied Message, 76, 32 256 66 20, tab 3 text Team 1 Wins, 77, 32 285 66 20, tab 3 text Team 2 Wins, 78, 32 314 66 20, tab 3 text Team 3 Wins, 303, 32 343 66 20, disable tab 3 text Team 4 Wins, 304, 32 372 66 20, disable tab 3 edit $te(1), 380, 92 112 280 27, tab 3 autohs edit $te(2), 381, 92 152 280 27, tab 3 autohs edit $te(4), 382, 468 152 280 27, disable tab 3 autohs edit $te(3), 383, 468 112 280 27, disable tab 3 autohs edit $te(0).victory, 320, 96 256 770 25, tab 3 autohs edit $te(1).victory, 321, 96 285 770 25, tab 3 autohs edit $te(2).victory, 322, 96 314 770 25, tab 3 autohs edit $te(3).victory, 323, 96 343 770 25, disable tab 3 autohs edit $te(4).victory, 324, 96 372 770 25, disable tab 3 autohs check Limit Join Period, 330, 284 52 152 27, tab 3 push edit $te(JoinBefore), 335, 440 51 112 27, tab 3 radio 2 Teams, 28, 48 48 92 20, tab 3 radio 4 Teams, 29, 152 52 84 20, tab 3 tab Awards, 4 box Awards, 79, 14 56 872 220, tab 4 button Delete, 411, 828 236 52 20, tab 4 button Add, 412, 828 84 52 20, tab 4 list 420, 19 72 800 190, tab 4 size text "* is winner's nick.", 81, 398 425 144 25, tab 4 text "^ is value of trigger", 82, 554 425 156 25, tab 4 check Disable, 819, 20 36 84 21, tab 4 combo 137, 94 296 144 100, tab 4 size drop edit "", 139, 432 300 68 25, tab 4 text "Award", 140, 26 392 62 24, tab 4 edit "", 142, 92 388 712 33, tab 4 autohs text "Trigger on", 154, 32 296 58 24, tab 4 combo 159, 314 300 108 100, tab 4 size drop text "and", 160, 518 300 30 20, hide tab 4 edit "", 161, 556 300 68 25, hide tab 4 text "points", 162, 480 324 46 20, tab 4 text "Do Action", 163, 36 348 50 24, tab 4 text "values", 164, 264 300 42 24, tab 4 combo 166, 90 348 144 120, tab 4 size drop tab Status, 5 text Trivia Script version:, 84, 24 48 150 20, tab 5 text $strip($msg.trivia.version), 85, 184 48 150 20, tab 5 text Trivia bot is currently:, 86, 24 70 150 20, tab 5 text $trivon, 504, 184 70 80 20, tab 5 text Current mIRC version is:, 87, 24 92 150 20, tab 5 text $version, 90, 184 92 80 20, tab 5 text Current Trivia directory exists:, 91, 24 114 150 20, tab 5 text $trivia.dir, 92, 184 114 80 20, tab 5 text Currently in Trivia Channel:, 93, 24 136 150 20, tab 5 text $trivia.chan, 94, 184 136 80 20, tab 5 text Question file in Directory:, 95, 24 158 150 20, tab 5 text $trivia.file, 98, 184 158 80 20, tab 5 text Number of questions:, 103, 24 180 150 20, tab 5 text $numl, 104, 184 180 78 20, tab 5 button Delete Scores, 515, 280 104 128 20, tab 5 button Scores, 519, 280 76 124 20, tab 5 list 601, 26 210 284 114, tab 5 sort size button Unban, 602, 314 296 80 20, tab 5 button Ban, 603, 314 218 80 20, tab 5 list 610, 18 336 292 154, tab 5 sort size button Add Friend, 611, 314 342 80 20, tab 5 button Remove, 612, 318 468 80 20, tab 5 tab Commands, 7 box Command Limits, 105, 288 184 300 48, tab 7 combo 806, 300 200 276 132, disable tab 7 size drop text Command Prefix, 107, 28 456 82 20, tab 7 edit %command-prefix, 850, 112 452 88 29, tab 7 text blank = default, 109, 32 484 170 24, tab 7 button "Build HTML Options", 157, 304 476 207 25, tab 7 list 800, 20 60 256 356, tab 7 size text "Commands", 170, 20 40 102 16, tab 7 combo 809, 300 248 276 100, disable tab 7 size drop box "Respond Method", 168, 288 232 300 48, tab 7 check "Disable", 801, 296 80 92 24, tab 7 text "Name", 172, 292 112 42 20, tab 7 edit "", 803, 344 112 236 21, tab 7 read edit "", 802, 288 132 296 49, tab 7 read autovs box "Default Respond Method", 180, 284 348 304 72, tab 7 combo 181, 300 364 280 136, tab 7 size drop box "Command Attributes", 176, 284 56 308 292, tab 7 button Cancel, 101, 618 486 52 20, cancel button OK, 100, 673 486 52 20, ok button Apply, 102, 560 486 48 20 link $nopath($trivia.web), 518, 560 460 160 20 } ;######################################################## ;# DIALOG EVENTS. # ;######################################################## on *:dialog:trivset:init:*:{ var %i = 1 while ($getset(chan, %i)) { did -a $dname 108 $gettok($getset(chan, %i), 1, 59) inc %i } if ($did(108,1)) { did -c $dname 108 1 } var %i = $numtok($status.toks, $asc(.)) while (%i >= 1) { if ($getset(status, $gettok($status.toks, %i, $asc(.))) == 1) { did -c $dname $calc(39 + %i) } dec %i } if (!$did(58).state) { if (!$getset(status, plot)) { did -c $dname 130 } else { did -c $dname 129 } } if ($getset(trivia,ranks) == 1) { did -c $dname 148 } if ($getset(status,naoff) == 1) { did -c $dname 88 } if ($getset(status,hintpause) == 1) { did -c $dname 96 } if ($getset(status,autostart) == 1) { did -c $dname 49 } if ($getset(status,monday) == 1) { did -c $dname 126 } if ($getset(status,noautoqm) == 1) { did -c $dname 830 } if ($getset(status,noawards) == 1) { did -c $dname 819 } if ($getset(status,nospellfix) == 1) { did -c $dname 817 } if ($getset(status,sayhintnum) == 1) { did -c $dname 147 } if ($getset(status,keepask) == 1) { did -c $dname 156 } if ($getset(status,shownone) == 1) { did -c $dname 143 } did -c $dname $calc(149 + $getset(trivia,firsthint)) if ($getset(hide,score) == 1) { did -c $dname 106 } if ($getset(hide,time) == 1) { did -c $dname 169 } if ($getset(hide,streak) == 1) { did -c $dname 171 } if ($getset(hide,wpm) == 1) { did -c $dname 173 } if ($getset(color,on) == 1) { did -c $dname 116 } if ($getset(color,bon) == 1) { did -c $dname 158 } if ($getset(color,1-bold) == 1) { did -c $dname 117 } if ($getset(color,1-underline) == 1) { did -c $dname 118 } if ($getset(color,2-bold) == 1) { did -c $dname 127 } if ($getset(color,2-underline) == 1) { did -c $dname 128 } if ($getset(trivia,odefault) == Unlimited) { did -c $dname 201 } elseif ($getset(trivia,odefault) == Team) { did -c $dname 202 } else { did -c $dname 203 } if ($getset(team,Joinbeforeon) == 1) { did -c $dname 330 } if ($getset(team,4-team) == 1) { trivset.teams 1 did -c $dname 29 } else { did -c $dname 28 } var %i = 0 while (%i <= 16) { did -a $dname 111,112,113,114 $colorcode(%i) inc %i } did -a $dname 806 Default did -a $dname 806 User did -a $dname 806 Voice did -a $dname 806 Half-Op did -a $dname 806 Op did -a $dname 806 Friend did -a $dname 806 Nobody did -c $dname 806 1 did -a $dname 183 Day did -a $dname 183 Week did -a $dname 183 Month did -a $dname 183 Year did -a $dname 183 Total did -c $dname 183 $ifd($getset(status,scoreby),5) did -a $dname 181,809 Default did -a $dname 181,809 Notice did -a $dname 181,809 MSG Channel did -a $dname 181,809 MSG User did -a $dname 181,809 Describe Channel did -c $dname 181 $ifd($getset(status,respondlevel),1) did -c $dname 809 1 did -c $dname 111 $calc($did(121) + 1) did -c $dname 112 $calc($did(122) + 1) did -c $dname 113 $calc($did(123) + 1) did -c $dname 114 $calc($did(124) + 1) awards.load var %i = 1 while ($setini(banned,%i)) { did -a $dname 601 $getset(banned,%i) inc %i } did -a $dname 961 $iif($chr($triv(ch)),$chr($triv(ch)),_) disable.load trivia.load.friends check.toggle.multichan check.toggle.options check.color.toggle check.awards.toggle multichan.load } on *:dialog:trivset:sclick:100,102:{ setset trivia delimiter $did(31) setset trivia additions $did(32) setset trivia report $did(33) setset trivia dir $did(35) setset trivia translate $did(131) setset status plot $did(129).state setset status naoff $did(88).state setset status monday $did(126).state setset status noautoqm $did(830).state setset status noawards $did(819).state setset status nospellfix $did(817).state setset status sayhintnum $did(147).state setset status keepask $did(156).state setset status shownone $did(143).state setset hide score $did(106).state setset hide time $did(169).state setset hide streak $did(171).state setset hide wpm $did(173).state setset trivia naoff $did(89) setset status hintpause $did(96).state setset trivia hintpause $did(97) setset trivia limitguess $did(144) setset trivia perchint $did(99) setset trivia numhint $did(861) setset trivia DPH $did(863) setset trivia PPQ $did(65) var %i = 0 while (%i < 4) { if ($did($calc(149 + %i)).state == 1) setset trivia firsthint %i inc %i } setset trivia ranks $did(148).state setset color on $did(116).state setset color bon $did(158).state setset color 1-bold $did(117).state setset color 1-underline $did(118).state setset color 2-bold $did(127).state setset color 2-underline $did(128).state setset team JoinBeforeon $did(330).state setset team Joinbefore $did(335) setset color 1 $int($did(121)) setset color 2 $int($did(122)) setset color 3 $int($did(123)) setset color 4 $int($did(124)) varcolors var %i = 1 while (%i <= 8) { setset lag $gettok(start.answered.timedout.hint.timed.hintallow.ping.betweenhint, %i, $asc(.)) $int($did($calc(125 + (%i * 10)))) inc %i } var %i = $numtok($status.toks, $asc(.)) while (%i >= 1) { setset status $gettok($status.toks, %i, $asc(.)) $did($calc(39 + %i)).state dec %i } setset trivia onjoin $did(138) setset trivia default $int($did(299)) setset trivia odefault if ($did(201).state == 1) { setset trivia odefault Unlimited } if ($did(202).state == 1) { setset trivia odefault Team } setset trivia reset $int($did(215)) setset trivia dteam $int($did(217)) setset award var %i = 1 while (%i <= $did(420).lines) { setset award %i $did(420,%i) inc %i } setset team 1 $did(380) setset team 2 $did(381) setset team 3 $did(382) setset team 4 $did(383) setset team 0victory $did(320) setset team 1victory $did(321) setset team 2victory $did(322) setset team 3victory $did(323) setset team 4victory $did(324) setset team 4-team $did(29).state var %i = 1 setset trivia ch $asc($right($did(961),1)) %command-prefix = $did(850) disable.save setset status respondlevel $did(181).sel setset status scoreby $did(183).sel } on *:dialog:trivset:sclick:816:{ setset disable 18.disable $did($did).state check.toggle.options } on *:dialog:trivset:sclick:12:{ if ((!$did(34).sel) || (!$did(108).sel)) { return } var %todel = $did(34).sel did -d $dname 34 %todel did -c $dname 34 %todel save.qs } on *:dialog:trivset:sclick:24:{ var %temp.file = $$sfile($iif($isdir($did(35)),$did(35),$mircdir)) did -a $dname 34 $nopath(%temp.file) did -ra $dname 35 $nofile(%temp.file) save.qs } on *:dialog:trivset:edit:30:{ var %temp.num = $did(108).sel tchan.set $did(108).sel 1 $did(30) did -o $dname 108 $did(108).sel $did(30) did -c $dname 108 %temp.num } on *:dialog:trivset:sclick:108:{ multichan.load } on *:dialog:trivset:sclick:115:{ var %toadd = $$?="Add what channel?" did -a $dname 108 %toadd chan.add %toadd } on *:dialog:trivset:sclick:119:{ var %todel = $did(108).sel chan.del %todel did -d $dname 108 %todel did -c $dname 108 %todel did -r $dname 30,34,132 multichan.load check.toggle.multichan } on *:dialog:trivset:sclick:136:{ var %temp.file = $$sfile(" $+ $mircdir $+ \ $+ *.txt $+ ", Choose a trivia translation file.) did -ra $dname 131 $nopath(%temp.file) } on *:dialog:trivset:sclick:13:{ var %temp.file = $$sdir($mircdir, Choose a trivia directory.) echo -s .... %temp.file did -ra $dname 35 %temp.file } on *:dialog:trivset:edit:132:{ tchan.set $$did(108).sel 4 $$did(132) } on *:dialog:trivset:edit:67:{ tchan.set $$did(108).sel 2 $$did(67) } on *:dialog:trivset:edit:544:{ tchan.set $$did(108).sel 3 $$did(544) } on *:dialog:trivset:sclick:141:{ did -ra $dname 132 $nopath($$sfile(" $+ $mircdir $+ \ $+ *.fil $+ ",Choose a scores file.)) tchan.set $$did(108).sel 4 $did(132) } ;######################################################## ;# MOUSE EVENTS. # ;######################################################## on *:dialog:trivset:mouse:40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,88,96,106,126,143,156,169,171,173,817,830:{ if (%didt == $did) { return } if ($did == 43) { exp Forbids any partial matches, for example if the answer is "truck" and you guess "not a truck" it won't take the answer. } if ($did == 44) { exp Disables the decheater feature, which might produce blocks between words or odd characters on some fonts. Prevents people from using some cheating scripts. } if ($did == 50) { exp Disables bonus. For example if a question is "2004: This picture won movie of the year-" the bot would take this question to be worth 2004 points. } if ($did == 54) { exp If the room is empty the bot turns off. } if ($did == 61) { exp Turns off the color shortening. Color shortening is a feature which reduces the amount of text sent by optimizing the colorcodes. } if ($did == 62) { exp Turns off categories. If categories exist in a question file #Category after a list of questions, it doesn't look for or display it. } if ($did == 106) { exp Hide score. Refuses to indicate how many more points any person has. } if ($did == 169) { exp Hide time. Refuses to indicate how long it took for any person to answer. } if ($did == 171) { exp Hide streak. Refuses to indicate the current or record streak. } if ($did == 173) { exp Hide WPM. Refuses to indicate the Words Per Minute people achieve. } if ($did == 40) { exp Echo's the answer so that you can see it after the question is read. } if ($did == 60) { exp Uses the American dating style for the $pre $+ stats response. MM/DD/YY rather than DD/MM/YY. } if ($did == 63) { exp Stops showing the number before the question in the question message. } if ($did == 48) { exp Traditional win provides more less clinical information about the correct answer. } if ($did == 56) { exp Provides the spacing of the answer directly after the question is read. } if ($did == 46) { exp Gives a message to each person who joins the trivia channel, providing information about the bot. * = nick, $chr(35) = channel, @ = rank, ^ = score. eg: Welcome to #, * trivia bot is active... "!trivia" to start a game. Blank uses default. } if ($did == 53) { exp For scramble questions, this forces the standard scramble category to read Unscramble the Following. } if ($did == 57) { exp Rather than accept answers anywhere in a response, this feature forces the bot to ignore answered contained entirely inside a response. } if ($did == 49) { exp This feature makes the bot start up as soon as you rejoin the trivia channel. } if ($did == 42) { exp This allows for champ mode, when a specific score is reached the game resets the score and logs the winner. } if ($did == 58) { exp Rather than start the hint from left to right it displays random letters in the hint. } if ($did == 41) { exp This feature automaticly displays a hint to the channel after a time specified in Defaults. } if ($did == 45) { exp This allows people to be told the correct answer after nobody in the room answered correctly. } if ($did == 55) { exp When a team game is ends this provides a list of players on each team. } if ($did == 59) { exp By default the bot displays the first answer in the answer file as correct. But, with this enabled the matched answer is displayed. } if ($did == 88) { exp After a specified number of questions, the bot will turn itself off. } if ($did == 96) { exp After a hint is requested this feature blocks the correct answer from being accepted from that person for a given amount of time. } if ($did == 47) { exp This allows for unfinished part of a hint to use a specific character to indicate where letters are missing. } if ($did == 51) { exp This option limits the number of guesses to the specific value. } if ($did == 52) { exp This option makes a round hall of fame displayed along with the win messages throughout a trivia round. } if ($did == 156) { exp This feature retains the hash table that scores the asked questions beyond one round of trivia. Make repeats happen less often. } if ($did == 143) { exp After a win, this feature would will turn off any acknowledgement of the answer to the room. Protect questions. } if ($did == 126) { exp In the United States and other countries the week starts on Sunday, this is default. This feature starts the week mark a day later. } if ($did == 817) { exp Turns off the spell correction and only allows exact answers to be accepted. } if ($did == 830) { exp Turns off the automatic ? at the end of each question. A - at the end of the question also does this. } set -u5 %didt $did } alias exp { did -ra $dname 22 $$1- } ;######################################################## ;# Stray. # ;######################################################## on *:dialog:trivset:sclick:20:{ if (!$dialog(trivrank)) dialog -m trivrank trivrank } on *:dialog:trivset:sclick:28,29:{ trivset.teams $iif($did != 28,1) } alias hint.example { return This is an example of a hint } on *:dialog:trivset:sclick:58,129,130:{ if ($did == 58) { did -ra $dname 199 $scatter(50,$hint.example) } else if ($did == 129) { did -ra $dname 199 $plot(50,$hint.example) } else { did -ra $dname 199 $standard(50,$hint.example) } } on *:dialog:trivset:sclick:111,112,113,114:{ did -ra $dname $calc($did + 10) $calc($did($did).sel - 1) } on *:dialog:trivset:sclick:218:{ var %record = $calc($triv(Record) + 1) if (%record == 9) { var %record = 1 } did -ra $dname $did $record.type(%record) setset Trivia Record %record } ;######################################################## ;# Awards. # ;######################################################## on *:dialog:trivset:sclick:412:{ did -a $dname 420 0 0 0 0 0 Award did -c $dname 420 $did(420).lines check.award.click } on *:dialog:trivset:sclick:411:{ did -d $dname 420 $$did(420,1).sel | check.awards.toggle } on *:dialog:trivset:sclick:420:{ check.award.click } alias check.award.click { check.awards.toggle tokenize 32 $$did(420).seltext did -c $dname 137 $calc($1 + 1) did -c $dname 159 $calc($2 + 1) did -c $dname 166 $calc($3 + 1) did -ra $dname 139 $4 did -ra $dname 161 $5 did -ra $dname 142 $6- check.award.range } alias check.award.range { did $iif((($did(159).seltext == Between) || ($did(159).seltext == Random)),-v,-h) $dname 160,161 } on *:dialog:trivset:sclick:137,159,166:{ award.modified } on *:dialog:trivset:edit:139,142,161:{ award.modified } alias award.modified { if (!$did(420).sel) { return } var %t.line = $did(420).sel did -o $dname 420 $did(420).sel $calc($did(137).sel - 1) $calc($did(159).sel - 1) $calc($did(166).sel - 1) $did(139) $did(161) $did(142) did -c $dname 420 %t.line check.award.range } ;######################################################## ;# Settings. # ;######################################################## on *:dialog:trivset:sclick:515:{ if ($?!="Are you sure you wish to delete all scores?") { rename $scoresfil $asctime(yymmddhhmmss) $+ .bak trivia.flush } } on *:dialog:trivset:sclick:518:{ run $trivia.web } on *:dialog:trivset:sclick:519:{ dialog -m triviascores triviascores } on *:dialog:trivset:sclick:602:{ tunban $did(601,1).sel did -d $dname 601 $$did(601,1).sel } on *:dialog:trivset:sclick:603:{ var %ban = $$?"Enter the nick or address (nick!ident@host) of a person to ban, note wildcards are permitted." tban %ban did -a $dname 601 %ban } on *:dialog:trivset:sclick:611:{ var %friend.add = $$?"Enter the nick or address (nick!ident@host) of a friend to add, note wildcards are permitted." did -a $dname 610 %friend.add triviafriend.add %friend.add } on *:dialog:trivset:sclick:612:{ triviafriend.del $$did(610).sel trivia.load.friends } on *:dialog:trivset:sclick:700:{ if (!$dialog(triviatheme)) { dialog -m triviatheme triviatheme } } on *:dialog:trivset:sclick:157:{ if (!$dialog(trivbuild)) { dialog -m trivbuild trivbuild } } ;######################################################## ;# Disables # ;######################################################## on *:dialog:trivset:sclick:800:{ disable.access disable.check.disabled } on *:dialog:trivset:sclick:801:{ setset disable $$did(800).sel $+ .disable $did($did).state did -oc $dname 800 $did(800).sel $gettok($disable.tokens,$did(800).sel,$asc(;)) $iif($getset(disable,$did(800).sel $+ .disable),( $+ Disabled $+ )) disable.check.disabled } on *:dialog:trivset:sclick:806:{ setset disable $$did(800).sel $+ .limitlevel $did($did).sel } on *:dialog:trivset:sclick:809:{ setset disable $$did(800).sel $+ .respondlevel $did($did).sel } alias disable.access { did $iif($getset(disable,$did(800).sel $+ .disable) == 1,-c,-u) trivset 801 did -ra trivset 802 $gettok($disable.info.tokens,$did(800).sel,$asc(;)) did -ra trivset 803 $did(800).seltext did -c trivset 806 $ifd($getset(disable,$did(800).sel $+ .limitlevel),1) did -c trivset 809 $ifd($getset(disable,$did(800).sel $+ .respondlevel),1) } alias disable.check.disabled { did $iif(!$did(801).state,-e,-b) $dname 802,803,806,809 } alias disable.save { } alias disable.load { did -r trivset 800 tokenize $asc(;) $disable.tokens var %i = 1 while (%i <= $0) { did -a trivset 800 $eval($ $+ %i,2) $iif($getset(disable,%i $+ .disable),( $+ Disabled $+ )) inc %i } } alias disable.tokens { return trivia N;trivia unlimited;trivia team;trivia team N;pause/resume;op;op unban;hof;hoftime;hofstreak;hofwpm;records;op find;op ask;next;answer;ping;themes;add/report;op ban;disable/enable;hint;vowels;last;words;repeat;op add;trivia;strivia;promotion;join message;help;join N;op team } alias disable.info.tokens { return Start N question game;Start unlimited Game;Start team game;Start team game for N questions;pause/resume;operator commands;op unban;hall of fame;hoftime;hofstreak;hofwpm;records;op find;op ask;End current question early;Answer to last question;ping;themes;add/report;op ban;disable/enable;hint;vowels;last;words;repeat;op add;trivia;strivia;promotion;join channel message;general help and command specific help;join team command;op team <player> <#>, sets team assignment } alias isdis { check.respond $1 if ($getset(disable, $1 $+ .disable) == 1) { return $true } if (($chan) && ($nick) && (!$trivia.allowed($1))) { return $true } } alias -l trivia.allowed { var %level = $getset(disable,$$1 $+ .limitlevel) if ((!%level) || (%level == 1)) { %level = 1 if ($1 == 6) %level = 4 } if (%level == 7) { return } if (($is.friend) && (%level <= 6)) { return $true } if (($nick isop $chan) && (%level <= 5)) { return $true } if (($nick ishelp $chan) && (%level <= 4)) { return $true } if (($nick isvoice $chan) && (%level <= 3)) { return $true } if (($nick ison $chan) && (%level <= 2)) { return $true } } alias -l check.respond { unset %respond var %respondlevel = $getset(disable,$1 $+ .respondlevel) if (%respondlevel == 2) set -u2 %respond .notice $nick else if (%respondlevel == 3) set -u2 %respond msg $iden else if (%respondlevel == 4) set -u2 %respond .msg $nick else if (%respondlevel == 5) set -u2 %respond describe $iden } ;######################################################## ;# DIALOG TOGGLES # ;######################################################## on *:dialog:trivset:sclick:158,116:{ check.color.toggle } on *:dialog:trivset:sclick:88,96,51,47,42,330,819,148,46,182:{ check.toggle.options } alias check.toggle.options { did $iif($did(88).state,-e,-b) $dname 89 did $iif($did(96).state,-e,-b) $dname 97 did $iif($did(51).state,-e,-b) $dname 144 did $iif($did(47).state,-e,-b) $dname 961,21 did $iif($did(42).state,-e,-b) $dname 215 did $iif($did(330).state,-e,-b) $dname 335 did $iif(!$did(816).state,-e,-b) $dname 700 did $iif($did(148).state,-e,-b) $dname 20 did $iif($did(46).state,-e,-b) $dname 138 did $iif($did(182).state,-e,-b) $dname 183 if (($did == 819) || (!$did)) { did $iif(!$did(819).state,-e,-b) $dname 420,411,412 did -u $dname 420 check.awards.toggle } } alias check.awards.toggle { did $iif($did(420).sel,-e,-b) $dname 137,159,166,139,142,161,140,154,160,162,163,164,81,82 } alias check.toggle.multichan { did $iif($did(108).sel,-e,-b) $dname 12,24,30,34,132,141,544,67 } alias check.color.toggle { did $iif($did(116).state,-e,-b) $dname 23,25,120,110,121,122,123,124,117,118,127,128,111,112,113,114 if (!$did(158).state) did -b $dname 25,123,124,113,114 } ;######################################################## ;# TRIVIA SETUP, alias expanded. # ;######################################################## alias save.qs { var %i = 1 tchan.noqs $$did(108).sel while (%i <= $did(34).lines) { tchan.set $did(108).sel $calc(4 + %i) $did(34,%i) inc %i } } alias status.toks { return echo.autohint.champ.exactmatch.nodecheater.showanswer.onjoin.cross.tradwin.autostart.nobonus.limitguess.rrs.sayscramble.emptyoff.noshowt.answers.nomid.scatter.showmatched.adate.nocolorshort.nocat.nosaycurrent } alias chan.add { tchan.set $calc($setini(chan,0) + 1) 1 $1- } alias chan.set { var %chan.num = $tfindchan($1) if (%chan.num) { tchan.set %chan.num $2 $3- } } alias chan.del { var %i = $$1, %j = $setini(chan,0) while (%i < %j) { setset chan %i $getset(chan,$calc(%i + 1)) inc %i } setset chan %j } alias tchan.noqs { setset chan $1 $gettok($getset(chan, $1),1-4,59) } alias tchan.set { if ($3- != $null) { var %nl = $getset(chan,$1) if (!%nl) { %nl = $1 $+ ;*;*; $+ $scoresfil $+ ; $+ questions.txt } if ($2 > $numtok(%nl,59)) %nl = %nl $+ $str(;0,$calc($2 - $numtok(%nl,59))) %nl = $puttok(%nl,$3-,$2,59) setset chan $1 %nl } } alias tfindchan { var %i = 1 while ($tchan(%i)) { if (((!$1) || ($tchan(%i) == $1)) && ((!$2) || ($tchan(%i,3) iswm $2)) && ((!$3) || ($tchan(%i,2) iswm $3))) { return %i } inc %i } } alias multichan.load { if (!$did(108).sel) { return } did -r $dname 34 did -ra $dname 30 $tchan($did(108).sel) did -ra $dname 67 $ifd($tchan($did(108).sel,2),*) did -ra $dname 544 $ifd($tchan($did(108).sel,3),*) did -ra $dname 132 $tchan($did(108).sel,4) var %i = 5 while ($tchan($did(108).sel, %i)) { did -a $dname 34 $tchan($did(108).sel,%i) inc %i } check.toggle.multichan } alias awards.load { var %i = 1 did -r $dname 420 while ($aw(%i)) { did -a $dname 420 $aw(%i) inc %i } did -r $dname 137,159,166 %i = 1 while ($gettok($award.on.tok, %i, $asc(.))) { did -a $dname 137 $gettok($award.on.tok, %i, $asc(.)) inc %i } %i = 1 while ($gettok($award.val.tok, %i, $asc(.))) { did -a $dname 159 $gettok($award.val.tok, %i, $asc(.)) inc %i } %i = 1 while ($gettok($award.do.tok, %i, $asc(.))) { did -a $dname 166 $gettok($award.do.tok, %i, $asc(.)) inc %i } } alias -l record.type { return $gettok(hof.streak.time.wpm.champ.web.roundscores.records, $ifd($1, 8), $asc(.)) } alias -l trivset.teams { did $iif($1, -e, -b) $dname 308,309,303,304,382,383,323,324 } alias triviafriend.del { var %i = $$1, %j = $setini(friend,0) while (%i < %j) { setset friend %i $getset(friend,$calc(%i + 1)) inc %i } setset friend %j } alias triviafriend.add { var %i = 1 while ($getset(friend, %i)) { inc %i } setset friend %i $1- } alias triviafriend.clear { setset friend } alias trivia.load.friends { did -r $dname 610 var %i = 1 while ($getset(friend, %i)) { did -a $dname 610 $getset(friend, %i) inc %i } } ;######################################################## ;# TRIVIA RANKS DIALOG. # ;######################################################## dialog trivrank { title "Trivia Ranks" size -1 -1 180 104 option dbu list 1, 2 12 146 50, size text "Rank Name", 11, 4 66 31 8 edit "", 2, 46 64 74 10, autohs text "Points Required", 10, 4 76 39 8 edit "", 3, 46 76 36 10, read autohs button "Add", 4, 150 12 21 8 button "Del", 5, 150 24 21 8 button "Ok", 999, 114 78 17 8, ok check "Trivia Ranks", 6, 4 4 50 6 } ;######################################################## ;# DIALOG EVENTS. # ;######################################################## on *:dialog:trivrank:init:*:{ if ($getset(trivia,ranks) == 1) { did -c $dname 6 } check.toggle.ranks var %i = $setini(ranks,0), %j = 1 while (%j <= %i) { did -a $dname 1 $setini(ranks,%j) : $getset(ranks, $setini(ranks,%j)) inc %j } } on *:dialog:trivrank:sclick:1:{ did -ra $dname 3 $setini(ranks, $did(1).sel) did -ra $dname 2 $getset(ranks, $setini(ranks, $did(1).sel)) } on *:dialog:trivrank:edit:2:{ if (!$did(1).sel) return setset ranks $$did(3) $$did(2) var %p = $did(1).sel did -o $dname 1 %p $did(3) : $did(2) did -c $dname 1 %p } on *:dialog:trivrank:sclick:4:{ var %r = $$?="What is the minimum amount points for this rank?" if ((%r !isnum) || ($getset(ranks,%r))) return var %n = $$?="What is this rank called?" setset ranks %r %n did -a $dname 1 %r : %n } on *:dialog:trivrank:sclick:5:{ var %p = $$did(1).sel setset ranks $$setini(ranks, %p) did -d $dname 1 %p did -r $dname 2,3 } on *:dialog:trivrank:sclick:6:{ setset trivia ranks $did(6).state check.toggle.ranks } alias check.toggle.ranks { did $iif($did(6).state,-e,-b) $dname 1,2,3,4,5,10,11 } ;######################################################## ;# TRIVIA BUILD DIALOG. # ;######################################################## dialog trivbuild { title "Build Html" size -1 -1 200 232 option dbu check Run FTP Batch, 1, 8 52 50 10 edit "", 2, 10 124 86 88, autohs autovs button Ok, 99, 172 220 23 10, ok radio Write All Scores, 3, 80 12 50 10 radio Write Top, 4, 132 12 34 10 edit 25, 5, 168 12 20 10 box Generate Scores File, 57, 76 4 118 35 text Password, 54, 104 172 25 8 box Ftp Batch Creator, 55, 100 124 84 88 text Username, 53, 104 160 25 8 text Ftp Site, 51, 104 136 25 8 edit "", 6, 136 136 46 10, autohs text Port, 52, 104 148 25 8 edit "", 7, 136 148 46 10, autohs edit "", 8, 136 160 46 10, autohs edit "", 9, 136 172 46 10,i autohs edit "triv.htm", 11, 136 196 46 10, autohs text Filename, 56, 104 196 23 6 text Every, 58, 8 16 17 6 edit "", 13, 28 16 22 10, autohs text Points, 14, 52 16 17 6 button "Cancel", 12, 144 220 23 10, cancel text "Directory", 50, 104 184 25 8 edit "", 16, 136 184 46 10 check "Announce Update", 17, 8 68 54 10 edit "", 18, 92 48 98 10, autohs text "URL", 20, 80 48 10 7 text "Batch File", 21, 12 116 29 8 check "Generate Scores File", 15, 8 36 62 10 box "On Trigger", 10, 4 4 70 102 box "Announce Update", 19, 76 40 118 22 check "Copy File", 22, 8 84 58 10 box "Copy File", 23, 76 64 118 42 edit "", 24, 100 72 90 10, autohs button "File", 25, 80 72 17 8 button "Dir", 26, 80 92 17 8 edit "", 27, 100 92 90 10, autohs text "TO", 28, 124 84 9 7 box "Run FTP Batch", 29, 4 108 190 110 edit "", 30, 116 24 74 10 text "Generate File", 31, 80 24 33 8 } ;######################################################## ;# TRIVIA BUILD EVENTS. # ;######################################################## on *:dialog:trivbuild:sclick:1,17,22,15,4,3:{ trivbuild.toggle.check } on *:dialog:trivbuild:edit:13:{ trivbuild.toggle.check } on *:dialog:trivbuild:edit:6,7,8,9,16,11:{ build.generate } on *:dialog:trivbuild:sclick:25:{ did -ra $dname 24 $$sfile($mircdir) } on *:dialog:trivbuild:sclick:26:{ did -ra $dname 27 $$sdir($mircdir) } alias trivbuild.toggle.check { did -b $dname 1,17,15,22,4,3,5,30,18,24,27,6,7,8,9,16,2,11 if (!$did(13)) { return } did -e $dname 1,17,22,15 if ($did(1).state) { did -e $dname 2,6,7,8,9,16,11 build.generate } if ($did(17).state) did -e $dname 17,18 if ($did(22).state) did -e $dname 24,27 if ($did(15).state) did -e $dname 3,4,30 if ($did(4).state) did -e $dname 5 } on *:dialog:trivbuild:init:*:{ if ($getset(build,auto)) { did -c $dname 1 } if ($getset(build,web)) { did -c $dname 17 } if ($getset(build,copy)) { did -c $dname 22 } if ($getset(build,generate)) { did -c $dname 15 } did -c $dname $iif($getset(build,top),4,3) did -ra $dname 5 $getset(build,top) did -ra $dname 13 $getset(build,instabuild) did -ra $dname 18 $getset(build,web) did -ra $dname 30 $getset(build,genname) did -ra $dname 24 $getset(build,from) did -ra $dname 27 $getset(build,to) if ($getset(build,host)) { did -ra $dname 6 $getset(build,host) } if ($getset(build,port)) { did -ra $dname 7 $getset(build,port) } if ($getset(build,user)) { did -ra $dname 8 $getset(build,user) } if ($getset(build,pass)) { did -ra $dname 9 $decode($getset(build,pass),m) } if ($getset(build,dir)) { did -ra $dname 16 $getset(build,dir) } if ($getset(build,file)) { did -ra $dname 11 $getset(build,file) } build.generate trivbuild.toggle.check } on *:dialog:trivbuild:sclick:99:{ setset build instabuild $did(13) setset build auto $did(1).state setset build generate $did(15).state setset build genname $did(30) setset build copy $did(22).state setset build web $iif($did(17).state, $did(18)) setset build from $did(24) setset build to $did(27) setset build host $did(6) setset build port $did(7) setset build user $did(8) setset build pass $encode($did(9),m) setset build dir $did(16) setset build file $did(11) setset build top $iif($did(4).state,$did(5)) setset build html $did(11) build.generate if ($did(2)) { filter -ifc $dname 2 $+(",$triv(dir),\,ftpbatch.txt,") * } } alias build.generate { did -r $dname 2 did -i $dname 2 $did(2).lines open did -i $dname 2 $did(2).lines $did(6) $did(7) did -i $dname 2 $did(2).lines $did(8) did -i $dname 2 $did(2).lines $did(9) if ($did(16)) { did -i $dname 2 $did(2).lines cd $did(16) } did -i $dname 2 $did(2).lines put $shortfn($mircdir $+ $did(11)) did -i $dname 2 $did(2).lines bye } ;######################################################## ;# TRIVIA THEMES DIALOG. # ;######################################################## dialog triviatheme { title "Trivia Themes" size -1 -1 508 340 option pixels list 1, 22 24 376 88, sort size button Add, 2, 410 28 50 20 button Remove, 3, 410 62 50 20 text Name:, 30, 242 142 60 16 text Points per Question:, 33, 238 224 100 16 text Hint-Point Decrease:, 34, 238 250 100 16 edit , 11, 318 142 152 20, autohs edit , 12, 318 168 156 20, autohs edit , 13, 350 194 40 20, autohs edit , 14, 350 224 40 20, autohs edit , 15, 350 250 40 20, autohs check Team Game, 16, 402 254 72 20, push check Limit Guesses, 17, 402 224 72 20, push check Roundscores, 18, 402 196 72 20, push box Lag, 35, 8 124 220 208 text Before Start, 26, 18 150 96 20 text Between Questions (Answered), 37, 18 180 96 28 text Given to Answer, 38, 18 214 96 20 text Before Auto-Hint, 39, 18 244 88 20 text Between Question (Timed Out), 40, 18 274 88 28 edit , 19, 140 150 80 20 edit , 20, 140 180 80 20 edit , 21, 140 210 80 20 edit , 22, 140 240 80 20 edit , 23, 140 274 80 20 edit , 24, 140 304 80 20 button OK, 999, 430 310 40 20, ok text "Before hint allowed", 5, 16 308 102 16 box "Themes", 6, 8 8 480 116 box "Theme Features", 7, 232 124 256 160 button "Question File", 8, 240 168 67 17 text "Number of Questions", 4, 240 196 102 16 } ;######################################################## ;# TRIVIA THEMES EVENTS. # ;######################################################## on *:dialog:triviatheme:init:*:{ var %i = 1 while ($getset(triviamode $+ %i, name)) { did -a triviatheme 1 $+($getset(triviamode $+ %i, name),;,$getset(triviamode $+ %i, file),;,$getset(triviamode $+ %i, max),;,$getset(triviamode $+ %i, PPQ),;,$getset(triviamode $+ %i, DPH),;,$getset(triviamode $+ %i, team),;,$getset(triviamode $+ %i, guess),;,$getset(triviamode $+ %i, rrs),;,$getset(triviamode $+ %i, lagstart),;,$getset(triviamode $+ %i, laganswered),;,$getset(triviamode $+ %i, lagtimedout),;,$getset(triviamode $+ %i, laghint),;,$getset(triviamode $+ %i, lagtimed),;,$getset(triviamode $+ %i, laghintallow)) inc %i } } on *:dialog:triviatheme:sclick:1:{ did -ra triviatheme 11 $gettok($did(1).seltext, 1, $asc(;)) did -ra triviatheme 12 $gettok($did(1).seltext, 2, $asc(;)) did -ra triviatheme 13 $gettok($did(1).seltext, 3, $asc(;)) did -ra triviatheme 14 $gettok($did(1).seltext, 4, $asc(;)) did -ra triviatheme 15 $gettok($did(1).seltext, 5, $asc(;)) did -u triviatheme 16,17,18 if ($gettok($did(1).seltext, 6, $asc(;))) { did -c triviatheme 16 } if ($gettok($did(1).seltext, 7, $asc(;))) { did -c triviatheme 17 } if ($gettok($did(1).seltext, 8, $asc(;))) { did -c triviatheme 18 } did -ra triviatheme 19 $ifd($gettok($did(1).seltext, 9, $asc(;)),$slag(start)) did -ra triviatheme 20 $ifd($gettok($did(1).seltext, 10, $asc(;)),$slag(answered)) did -ra triviatheme 21 $ifd($gettok($did(1).seltext, 11, $asc(;)),$slag(timedout)) did -ra triviatheme 22 $ifd($gettok($did(1).seltext, 12, $asc(;)),$slag(hint)) did -ra triviatheme 23 $ifd($gettok($did(1).seltext, 13, $asc(;)),$slag(timed)) did -ra triviatheme 24 $ifd($gettok($did(1).seltext, 14, $asc(;)),$slag(hintallow)) } on *:dialog:triviatheme:sclick:2:{ did -a triviatheme 1 $+(Themename,;,questions.txt,;,10,;,1,;,0,;,0,;,0,;,0,;,$slag(start),;,$slag(answered),;,$slag(timedout),;,$slag(hint),;,$slag(timed),;,$slag(hintallow)) triviatheme.save } on *:dialog:triviatheme:sclick:3:{ did -d triviatheme 1 $did(1).sel triviatheme.save } on *:dialog:triviatheme:sclick:8:{ did -ra $dname 12 $nopath($$sfile(" $+ $mircdir $+ *.txt $+ ",Choose a question file.)) triviatheme.update } on *:dialog:triviatheme:edit:11,12,13,14,15,19,20,21,22,23,24:{ triviatheme.update } on *:dialog:triviatheme:sclick:16,17,18:{ triviatheme.update } on *:dialog:triviatheme:sclick:999:{ triviatheme.save } alias triviatheme.update { if ($did(1).sel) { did -oc triviatheme 1 $did(1).sel $+($did(11),;,$did(12),;,$did(13),;,$did(14),;,$did(15),;,$did(16).state,;,$did(17).state,;,$did(18).state,;,$did(19),;,$did(20),;,$did(21),;,$did(22),;,$did(23),;,$did(14)) } } alias triviatheme.save { var %i = 1 while ($getset(triviamode $+ %i,name)) { setset triviamode $+ %i inc %i } %i = 1 while ($did(1,%i).text) { setset triviamode $+ %i name $gettok($did(1, %i).text,1,59) setset triviamode $+ %i file $gettok($did(1, %i).text,2,59) setset triviamode $+ %i max $gettok($did(1, %i).text,3,59) setset triviamode $+ %i ppq $gettok($did(1, %i).text,4,59) setset triviamode $+ %i dph $gettok($did(1, %i).text,5,59) setset triviamode $+ %i team $gettok($did(1, %i).text,6,59) setset triviamode $+ %i guess $gettok($did(1, %i).text,7,59) setset triviamode $+ %i rrs $gettok($did(1, %i).text,8,59) setset triviamode $+ %i lagstart $gettok($did(1, %i).text,9,59) setset triviamode $+ %i laganswered $gettok($did(1, %i).text,10,59) setset triviamode $+ %i lagtimedout $gettok($did(1, %i).text,11,59) setset triviamode $+ %i laghint $gettok($did(1, %i).text,12,59) setset triviamode $+ %i lagtimed $gettok($did(1, %i).text,13,59) setset triviamode $+ %i laghintallow $gettok($did(1, %i).text,14,59) inc %i } } ;######################################################## ;# TRIVIA SCORES DIALOG. # ;######################################################## dialog triviascores { title "Trivia Scores" size -1 -1 452 288 option pixels list 1, 5 20 100 200, size vsbar list 2, 115 20 75 200, size vsbar list 3, 200 20 75 200, size vsbar list 4, 285 20 75 200, size vsbar list 5, 370 20 75 200, size vsbar button Delete, 10, 5 225 75 20 button Reset Score, 11, 115 225 75 20 button Reset Streak, 12, 200 225 75 20 button Reset Time, 13, 285 225 75 20 button Reset WPM, 14, 370 225 75 20 button Name, 20, 5 5 50 15 button Score, 21, 115 5 50 15 button Streak, 22, 200 5 50 15 button Time, 23, 285 5 50 15 button WPM, 24, 370 5 50 15 button Ok, 100, 398 258 45 20, ok } ;######################################################## ;# TRIVIA SCORES EVENTS. # ;######################################################## on 1:dialog:triviascores:init:*: { sortscores score } alias -l sortscores { sort $1 loaddata.triviascores } alias -l loaddata.triviascores { did -r $dname 1,2,3,4,5 var %i = 1 while ($hof(%i,1) != $null) { did -a $dname 1 $hof(%i,1) did -a $dname 2 $hof(%i,2) did -a $dname 3 $hof(%i,4) did -a $dname 4 $hof(%i,3) did -a $dname 5 $hof(%i,5) inc %i } } on 1:dialog:triviascores:sclick:1,2,3,4,5:{ did -c $dname 1,2,3,4,5 $did($did).sel } on 1:dialog:triviascores:sclick:20,21,22,23,24: { sortscores $gettok(name.score.streak.time.wpm, $calc($did - 19), $asc(.)) } on 1:dialog:triviascores:sclick:10: { deleteplayer $did(1).seltext if ($did(1).sel) { did -d triviascores 1,2,3,4,5 $did(1).sel } } on 1:dialog:triviascores:sclick:11,12,13,14: { setvar $did(1).seltext $gettok(score.streak.time.wpm, $calc($did - 10), 46) $iif($did == 13, 9999, 0) if ($did(1).sel) { did -o triviascores $calc($did - 9) $did(1).sel 0 } }
  25. type /trivia to configure, !trivia to play !answer to answer and !quit to quit! fun trivia game! if Colors are blocked wont work properally!! on *:text:!trivia*:#: { if (%trv == off) { notice $nick Trivia is currently down. we are sorry. but a new feature is coming! ( $+ %trvf $+ ) } if (%trv == on) { inc %trivia 1 msg # $read(trivia.txt,%trivia) set %temp # } } on *:text:!trivia*:?: { if ($4 == %pass) && ($2 == off) { set %trv off | msg $nick trivia OFF ( $+ $3 $+ ) | set %trvf $3- } if ($4 == %pass) && ($2 == on) { set %trv on | msg $nick trivia ON } if ($2 == setpass) { set %pass $3- } } alias trivias { if ($read(trivia.txt,%trivia) != $null) { msg %temp $read(trivia.txt,%trivia) } if ($read(trivia.txt,%trivia) == $null) { msg %temp ****End of Questions/answers**** | set %trivia 0 } } on *:text:!answer*:#: { if (%trv == off) { notice $nick trivia is down ( $+ %trfv $+ ) } if (%trv == on) { if ($2- != $read(answers.txt,%trivia)) { msg # incorrect, correct answer was $read(answers.txt,%trivia) $+ , you answered $2- | inc %trivia 1 | //msg # 2Next Question in 3 seconds } if ($2- == $read(answers.txt,%trivia)) { msg # 9,8Correct $nick | inc %trivia 1 | //msg # 2Next Question in 3 seconds } timertriv 1 3 //trivias } } on *:text:!quit*:#: { set %trivia 0 | msg # $nick quit } dialog t { size -1 -1 300 300 title Weasel's trivia script tab description , 1, 0 0 300 300 tab questions , 2, 0 0 300 300 text type !trivia|!quit|!answer to play , 3, 75 100 200 200, tab 1 button press here to edit questions and answers, 4, 100 125 200 50, tab 2 } on 1:dialog:t:init:*: { if (%uses != 1) { set %uses 1 | run notepad trivia.txt | run notepad answers.txt | write -l1 trivia.txt Enter Questions here | write -l1 answers.txt Enter answer to corrosponding line in trivia.txt } } alias trivia { dialog -m t t } on 1:dialog:t:sclick:4: { run notepad trivia.txt | run notepad answers.txt }
×
×
  • Create New...