Reaper_20

Dice Script D-100 system

May 23rd, 2016 (edited)
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 9.37 KB | None | 0 0
  1. ::::Alias's::::
  2.  
  3. #Dices on
  4. alias roll {
  5.   var %die.amount $readini(dice.ini,dicectrl,die.amount), %die.side $readini(dice.ini,dicectrl,die.side)
  6.   if (%die == $null) { set %die 0 }
  7.   set -u20 %dice.trigger $calc(%dice.trigger + 1)
  8.   if (%dice.trigger >= 5) { unset %dice.trigger | disable #Dices | timer5 1 5 enable #Dices }
  9.   var %i = 0, %limit = $iif(%die < %die.amount,%die,%die.amount)) | :cont | while %i < %limit { inc %i | set -u2 %dice $addtok($rand(1,$iif(%side < %die.side,%side,%die.side)),%dice,32)) }
  10.   if (%die == 1) { %msg.chan %msg.user %dice.nick : You have rolled the following: $remove($calc(%dice + %stat),$chr(43)) $iif(%stat,$chr(124) Roll without stat %dice,$null)) S~:Tahoma; $+ %diecolor $+ %diestyle | goto next }
  11.   if (%die == 0) { raw -q privmsg %msg.chan %dice.nick : Please specify a number of dice(s) and dice side(s) when using the command! S~:Tahoma; $+ %diecolor $+ %diestyle | return }
  12.   %msg.chan %msg.user %dice.nick : You have rolled the following: %dice S~:Tahoma; $+ %diecolor $+ %diestyle
  13.   set -u2 %dice.count $replace($gettok(%dice,1-100,32),$chr(32),$chr(43))) $+ %stat | %msg.chan %msg.user %dice.nick : For a Total Roll of: $calc(%dice.count) $iif(%stat,$chr(124) Roll without stat $calc(%dice.count - %stat),$null)) S~:Tahoma; $+ %diecolor $+ %diestyle
  14.   :next
  15.   $iif(%msg.chan,$null,echo $gettok(%msg.user,4,32) 12 %dice.nick %dicemsgcolor You have rolled the following: %dice))
  16.   $iif(%msg.chan,$null,echo $gettok(%msg.user,4,32)                              %dicemsgcolor For a Total Roll of: $calc(%dice.count)) $iif(%stat,$chr(124) Roll without stat $calc(%dice.count - %stat),$null))
  17. }
  18. #Dices end
  19.  
  20. alias msgcolor {
  21.   var %msgclr $readini(dice.ini,dicectrl,msgclr)
  22.   if (%msgclr == black) { set %diecolor #000000; }
  23.   if (%msgclr == dark grey) { set %diecolor #333333; }
  24.   if (%msgclr == lighter grey) { set %diecolor #666666; }
  25.   if (%msgclr == light grey) { set %diecolor #999999; }
  26.   if (%msgclr == lightest grey) { set %diecolor #CCCCCC; }
  27.   if (%msgclr == Red) { set %diecolor #FF0000; }
  28.   if (%msgclr == bright green) { set %diecolor #00FF00; }
  29.   if (%msgclr == Blue) { set %diecolor #0000FF; }
  30.   if (%msgclr == bright yellow) { set %diecolor #FFFF00; }
  31.   if (%msgclr == light blue) { set %diecolor #00FFFF; }
  32.   if (%msgclr == pink) { set %diecolor #FF00FF; }
  33.   if (%msgclr == dark blue) { set %diecolor #000066; }
  34.   if (%msgclr == Brown) { set %diecolor #990000; }
  35.   if (%msgclr == Purple) { set %diecolor #9900CC; }
  36.   if (%msgclr == dark green) { set %diecolor #006633; }
  37. }
  38.  
  39. alias clr.sel {
  40.   var %msgclr $readini(dice.ini,dicectrl,msgclr)
  41.   if (%msgclr == black) { did -c DiceControls 11 1 }
  42.   if (%msgclr == dark grey) { did -c DiceControls 11 2 }
  43.   if (%msgclr == lighter grey) { did -c DiceControls 11 3 }
  44.   if (%msgclr == light grey) { did -c DiceControls 11 4 }
  45.   if (%msgclr == lightest grey) { did -c DiceControls 11 5 }
  46.   if (%msgclr == Red) { did -c DiceControls 11 6 }
  47.   if (%msgclr == bright green) { did -c DiceControls 11 7 }
  48.   if (%msgclr == Blue) { did -c DiceControls 11 8 }
  49.   if (%msgclr == bright yellow) { did -c DiceControls 11 9 }
  50.   if (%msgclr == light blue) { did -c DiceControls 11 10 }
  51.   if (%msgclr == pink) { did -c DiceControls 11 11 }
  52.   if (%msgclr == dark blue) { did -c DiceControls 11 12 }
  53.   if (%msgclr == Brown) { did -c DiceControls 11 13 }
  54.   if (%msgclr == Purple) { did -c DiceControls 11 14 }
  55.   if (%msgclr == dark green) { did -c DiceControls 11 15 }
  56. }
  57.  
  58. alias style.sel {
  59.   if (%msgstyle == Normal) { set %diestyle 1; | did -c DiceControls 12 1 }
  60.   if (%msgstyle == Bold) { set %diestyle 2; | did -c DiceControls 12 2 }
  61.   if (%msgstyle == Italic) { set %diestyle 3; | did -c DiceControls 12 3 }
  62.   if (%msgstyle == Underline) { set %diestyle 5; | did -c DiceControls 12 4 }
  63. }
  64.  
  65. alias chan.list {
  66.   if ($dialog(DiceControls)) { did -r DiceControls 19 }
  67.   var %a $readini(dice.ini,dicectrl,chan.count), %b = 0 | set -u60 %channels $readini(dice.ini,dicectrl,channels) | set -u60 %roll.channels $chr(37) $+ $chr(35) $+ $replace($readini(dice.ini,dicectrl,channels),$chr(32),$chr(44) $chr(37) $+ $chr(35)))
  68.   while (%b < %a) {
  69.     inc %b
  70.     if ($dialog(DiceControls)) { did -a DiceControls 19 $chr(37) $+ $chr(35) $+ $gettok(%channels,%b,32))) }
  71.   }
  72. }
  73.  
  74. alias oa_fnt { return $regsubex($1-,/S~:.*$/gi,$null) }
  75.  
  76. alias var_cb {
  77.   set -u5 %die.amount $readini(dice.ini,dicectrl,die.amount)) | set -u5 %die.side $readini(dice.ini,dicectrl,die.side)) | set -u5 %chan.count $readini(dice.ini,dicectrl,chan.count))
  78.   if (%die.amount == 0) { echo -a 4 Please add the number of die you want to use. | dialog -dm DiceControls DiceControls }
  79.   if (%die.side == 0) { echo -a 4 Please add the number of die sides you want to use. }
  80.   if (%chan.count == 0) { echo -a 4 Please add a channel for the script to post in the $chr(40) $+ chan control $+ $chr(41) tab. }
  81. }
  82.  
  83.  
  84. ::::Dialog's::::
  85.  
  86. dialog DiceControls {
  87.   title "Settings"
  88.   size -1 -1 142 114
  89.   option dbu
  90.   tab Dice settings, 17, 0 -2 143 105
  91.   tab Chan control, 18
  92.   text "Message options" 1, 55 12 50 10, tab 17
  93.   text "Die Amount" 3, 10 32 50 10, tab 17
  94.   text "Die Sides" 4, 102 32 38 10, tab 17
  95.   Button "chatroom" 5, 48 20 27 10, tab 17
  96.   Button "user" 6, 76 20 27 10, tab 17
  97.   Combo 9, 2 40 50 40, size drop, tab 17
  98.   Combo 10, 90 40 50 40, size drop, tab 17
  99.   Combo 11, 2 65 50 40, size drop, tab 17
  100.   Combo 12, 90 65 50 40, size drop, tab 17
  101.   text "Text Color" 13, 10 57 50 8, tab 17
  102.   text "Text Style" 14, 102 57 38 8, tab 17
  103.   Button "Clr dice amount" 15, 5 85 41 10, tab 17
  104.   Button "Clr dice Sides" 16, 92 85 41 10, tab 17
  105.   edit "" 23, 4 103 134 10, tab 17
  106.   list 19, 0 13 100 126, tab 18
  107.   button "Add channel" 20, 102 13 39 10, tab 18
  108.   button "Delete channel" 21, 102 28 39 10, tab 18
  109.   button "Get List" 22, 102 43 39 10, tab 18
  110. }
  111.  
  112. on *:dialog:DiceControls:init:0:{
  113.   var %die.amount $readini(dice.ini,dicectrl,die.amount), %die.side $readini(dice.ini,dicectrl,die.side), %msgclr $readini(dice.ini,dicectrl,msgclr)
  114.   didtok $dname 9 44 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100
  115.   didtok $dname 10 44 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100
  116.   didtok $dname 11 44 black,dark grey,lighter grey,light grey,lightest grey,Red,bright green,Blue,bright yellow,light blue,pink,dark blue,Brown,Purple,dark green
  117.   didtok $dname 12 44 Normal,Bold,Italic,Underline
  118.   $iif(%die.amount,did -c $dname 9 %die.amount,did -c $dname 9 1)) | $iif(%die.side,did -c $dname 10 %die.side,did -c $dname 10 1))
  119.   $clr.sel
  120.   $style.sel
  121. }
  122.  
  123. on *:dialog:DiceControls:sclick:*:{
  124.   if ($did == 5) { set %msg.st $true | unset %msg.user }
  125.   if ($did == 6) { set %msg.st $false | unset %msg.chan }
  126.   if ($did == 9) { writeini -n dice.ini dicectrl die.amount $did(9).seltext | /did -ra $dname 23 Die amount set and saved to $chr(40) $+ $did(9).seltext $+ $chr(41) }
  127.   if ($did == 10) { writeini -n dice.ini dicectrl die.side $did(10).seltext | /did -ra $dname 23 Die sides set and saved to $chr(40) $+ $did(10).seltext $+ $chr(41) }
  128.   if ($did == 11) { writeini -n dice.ini dicectrl msgclr $did(11).seltext | set %msgclr $did(11).seltext | $msgcolor | /did -ra $dname 23 Text message font color set and saved to $chr(40) $+ $did(11).seltext $+ $chr(41) }
  129.   if ($did == 12) { writeini -n dice.ini dicectrl msgstyle $did(12).seltext | set %msgstyle $did(12).seltext | /did -ra $dname 23 Text message font style set and saved to $chr(40) $+ $did(12).seltext $+ $chr(41) | $style.sel }
  130.   if ($did == 15) { remini -n dice.ini dicectrl die.amount }
  131.   if ($did == 16) { remini -n dice.ini dicectrl die.side }
  132.   if ($did == 18) { chan.list }
  133.   if ($did == 19) { set %chan.num $did(19).sel }
  134.   if ($did == 20) { /did -a $dname 19 $active | set %add $readini(dice.ini,dicectrl,channels) | set %channel $remove($active,$chr(37),$chr(35)) | $iif($readini(dice.ini,dicectrl,chan.count),writeini -n dice.ini dicectrl chan.count $calc($readini(dice.ini,dicectrl,chan.count) + 1),writeini -n dice.ini dicectrl chan.count 1)) | $iif(%add,writeini -n dice.ini dicectrl Channels $addtok(%add,%channel,32),writeini -n dice.ini dicectrl channels %channel)) }
  135.   if ($did == 21) { /did -d $dname 19 %chan.num | writeini -n dice.ini dicectrl chan.count $calc($readini(dice.ini,dicectrl,chan.count) - 1) | if ($readini(dice.ini,dicectrl,chan.count) == 0) { remini dice.ini dicectrl channels | goto end } | set -u60 %channels $readini(dice.ini,dicectrl,channels) | writeini -n dice.ini dicectrl channels $deltok(%channels,%chan.num,32)) | :end }
  136.   if ($did == 22) { chan.list }
  137. }
  138.  
  139. ::::Menu's::::
  140.  
  141. menu menubar {
  142.   -
  143.   Dice Options
  144.   .Dices ( $+ $group(#Dices) $+ )
  145.   ..ON:.enable #Dices
  146.   ..OFF:.disable #Dices
  147.   .Set mIRC.Message color:{ set %dicemsgcolor  $+ $$?"Input Color 1-15" }
  148.   .Dice controls:{ dialog -dm DiceControls DiceControls }
  149.   -
  150. }
  151.  
  152. on *:load:{ writeini -n dice.ini dicectrl die.amount 0 | writeini -n dice.ini dicectrl die.side 0 | writeini -n dice.ini dicectrl chan.count 0 | var_cb }
  153.  
Advertisement
Add Comment
Please, Sign In to add comment