Advertisement
Guest User

RandomBot

a guest
Aug 2nd, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 14.19 KB | None | 0 0
  1. ctcp *:VERSION:*: .ctcpreply $nick VERSION Hexrays/Java/AdvOR ver.3.22
  2. var %rnd_read
  3. var %Free_winner = $null
  4. on *:TEXT:*hello*RandomBot*:#: { msg $chan Hello, $nick $+ ! }
  5. on *:TEXT:*hi, RandomBot*:#: { msg $chan Hello, $nick $+ ! }
  6. on *:TEXT:*love*RandomBot*:#: { msg $chan Thank you, $nick $+ ! }
  7. on *:TEXT:*like*RandomBot*:#: { msg $chan Thank you, $nick $+ ! }
  8. on *:TEXT:*hate*RandomBot*:#: { msg $chan That is sad news, $nick $+ (( }
  9. on *:TEXT:*vs*RandomBot*:#: { msg $chan Im not fighting with people! only with bots. }
  10. on *:TEXT:*fight*RandomBot*:#: { msg $chan Im not fighting with people! only with bots. }
  11. on *:TEXT:*attack*RandomBot*:#: { msg $chan Im not fighting with people! only with bots. }
  12.  
  13. on *:TEXT:!randombot:#: { msg $chan RandomBot`s idea and execution: PyroMan }
  14.  
  15. on *:TEXT:!rand*:#: {
  16.   var %num = 0
  17.   if ($3 != $null) {
  18.     if ($3 < 0) {
  19.       msg $chan $nick $+ your number need to be positive only.
  20.       return
  21.     }
  22.     if ($2 < 0) {
  23.       msg $chan $nick $+ your number need to be positive only.
  24.       return
  25.     }
  26.     %num = $rand($2, $3)
  27.     msg $chan $nick your result is: %num
  28.     return
  29.   }
  30.   else if ($2 == $null) { msg $chan write a number. }
  31.   else if ($2 < 1) msg $chan Invalid number. Use numbers > 0 only
  32.   else if ($2 == 1) msg $chan $nick $+, , your number is: 1, obviously.
  33.   else if ($2 > 0) {
  34.     %num = $rand(1, $2)
  35.     if (%num > 0) msg $chan $nick $+, , your result is: %num
  36.     else msg $chan $nick , this is not a number even. Strings not acceptible
  37.   }
  38. }
  39. on *:TEXT:!rand*:?: {
  40.   var %num = 0
  41.   if ($3 != $null) {
  42.     if ($3 < 0) {
  43.       msg $chan $nick your number need to be positive only.
  44.       return
  45.     }
  46.     if ($2 < 0) {
  47.       msg $chan $nick your number need to be positive only.
  48.       return
  49.     }
  50.     %num = $rand($2, $3)
  51.     msg $chan $nick your number is: %num
  52.     return
  53.   }
  54.   else if ($2 == $null) { msg $chan write a number. }
  55.   else if ($2 < 1) msg $chan $nick Invalid number. Use numbers > 0 only
  56.   else if ($2 == 1) msg $chan $nick your number is: 1, obviously.
  57.   else if ($2 > 0) {
  58.     %num = $rand(1, $2)
  59.     if (%num > 0) msg $chan $nick your number is: %num
  60.     else msg $chan $nick This is not a number even. Strings not acceptible
  61.   }
  62. }
  63.  
  64. on *:TEXT:*!yesno*:#: {
  65.   var %lis = $rand(1, 10)
  66.   if (%lis == 1) msg $chan Yes.
  67.   if (%lis == 2) msg $chan Can't be.
  68.   if (%lis == 3) msg $chan Definitely!
  69.   if (%lis == 4) msg $chan Ofc no.
  70.   if (%lis == 5) msg $chan Yes, of course.
  71.   if (%lis == 6) msg $chan No.
  72.   if (%lis == 7) msg $chan Probably.
  73.   if (%lis == 8) msg $chan more No than Yes.
  74.   if (%lis == 9) msg $chan Yes, for sure.
  75.   if (%lis == 10) msg $chan Nah.
  76. }
  77. on *:TEXT:*!YN*:#: {
  78.   var %lis = $rand(1, 10)
  79.   if (%lis == 1) msg $chan Yes.
  80.   if (%lis == 2) msg $chan Can't be.
  81.   if (%lis == 3) msg $chan Definitely!
  82.   if (%lis == 4) msg $chan Ofc no.
  83.   if (%lis == 5) msg $chan Yes, of course.
  84.   if (%lis == 6) msg $chan No.
  85.   if (%lis == 7) msg $chan Probably.
  86.   if (%lis == 8) msg $chan more No than Yes.
  87.   if (%lis == 9) msg $chan Yes, for sure.
  88.   if (%lis == 10) msg $chan Nah.
  89. }
  90.  
  91. on *:TEXT:*!yesno*:?: {
  92.   var %lis = $rand(1, 10)
  93.   if (%lis == 1) msg $chan $nick Yes.
  94.   if (%lis == 2) msg $chan $nick Can't be.
  95.   if (%lis == 3) msg $chan $nick Definitely!
  96.   if (%lis == 4) msg $chan $nick Ofc no.
  97.   if (%lis == 5) msg $chan $nick Yes, of course.
  98.   if (%lis == 6) msg $chan $nick No.
  99.   if (%lis == 7) msg $chan $nick Probably.
  100.   if (%lis == 8) msg $chan $nick more No than Yes.
  101.   if (%lis == 9) msg $chan $nick Yes, for sure.
  102.   if (%lis == 10) msg $chan $nick Nah.
  103. }
  104. on *:TEXT:*!YN*:?: {
  105.   var %lis = $rand(1, 10)
  106.   if (%lis == 1) msg $chan $nick Yes.
  107.   if (%lis == 2) msg $chan $nick Can't be.
  108.   if (%lis == 3) msg $chan $nick Definitely!
  109.   if (%lis == 4) msg $chan $nick Ofc no.
  110.   if (%lis == 5) msg $chan $nick Yes, of course.
  111.   if (%lis == 6) msg $chan $nick No.
  112.   if (%lis == 7) msg $chan $nick Probably.
  113.   if (%lis == 8) msg $chan $nick more No than Yes.
  114.   if (%lis == 9) msg $chan $nick Yes, for sure.
  115.   if (%lis == 10) msg $chan $nick Nah.
  116. }
  117.  
  118. on *:TEXT:!ll*:#: {
  119.   if (mod isin $nick) { }
  120.   else {
  121.     msg $chan $nick , you are not a Mod for such request!
  122.     return
  123.   }
  124.   var %count = 0
  125.   VAR %max = 100
  126.   VAR %k = 2
  127.   VAR %i = 1
  128.   VAR %z
  129.   if ($ [ $+ [ $calc(%max + 2) ] ] != $null) {
  130.     msg $chan Sorry, %max players is maximum for now.
  131.     return
  132.   }
  133.   WHILE (%k <= %max) {
  134.     if ($ [ $+ [ %k ] ] != $null) {
  135.       INC %count
  136.       if ($chr(44) isin $ [ $+ [ %k ] ]) {
  137.         %z = $remove($ [ $+ [ %k ] ], $chr(44))
  138.         SET %players. [ $+ [ %count ] ]  %z
  139.       }
  140.       else {
  141.         SET %players. [ $+ [ %count ] ]  $ [ $+ [ %k ] ]
  142.       }
  143.     }
  144.     INC %k
  145.   }
  146.   VAR %x = $rand(1, %count)
  147.   ACTION LUCKY LOOSER results for $nick :
  148.   ACTION Lucky Looser is: %players. [ $+ [ %x ] ]
  149. }
  150.  
  151. on *:TEXT:!*:#: {
  152.   if (pair isin $1) {
  153.   }
  154.   else if (group isin $1) {
  155.   }
  156.   else {
  157.     return
  158.   }
  159.   if (mod isin $nick) { }
  160.   else {
  161.     msg $chan $nick , you are not a Mod for such request!
  162.     return
  163.   }
  164.   var %count = 0
  165.   VAR %max = 100
  166.   VAR %k = 2
  167.   VAR %i = 1
  168.   VAR %j = 0
  169.   VAR %z
  170.   if ($ [ $+ [ $calc(%max + 2) ] ] != $null) {
  171.     msg $chan Sorry, %max players is maximum for now.
  172.     return
  173.   }
  174.   WHILE (%k <= %max) {
  175.     if ($ [ $+ [ %k ] ] != $null) {
  176.       INC %count
  177.       if ($chr(44) isin $ [ $+ [ %k ] ]) {
  178.         %z = $remove($ [ $+ [ %k ] ], $chr(44))
  179.         SET %players. [ $+ [ %count ] ]  %z
  180.       }
  181.       else {
  182.         SET %players. [ $+ [ %count ] ]  $ [ $+ [ %k ] ]
  183.       }
  184.     }
  185.     INC %k
  186.   }
  187.   VAR %mr = %count
  188.   WHILE (%i <= %count) {
  189.     VAR %name = $rand(1, %mr)
  190.     SET %pair. [ $+ [ %i ] ]  %players. [ $+ [ %name ] ]
  191.     SET %players. [ $+ [ %name ] ]  worked
  192.     WHILE (%j <= %mr) {
  193.       if (%players. [ $+ [ %j ] ] == worked ) {
  194.         %y = %j
  195.         WHILE (%y <= %mr) {
  196.           SET %players. [ $+ [ %y ] ]  %players. [ $+ [ $calc(%y + 1) ] ]
  197.           if (%y == %mr) {
  198.             SET %players. [ $+ [ %y ] ] $null
  199.           }
  200.           INC %y
  201.         }
  202.       }
  203.       INC %j
  204.     }
  205.     if (%mr > 1) {
  206.       DEC %mr
  207.     }
  208.     INC %i
  209.     %j = 0
  210.     %y = 0
  211.   }
  212.   %i = 1
  213.   VAR %mes = $null
  214.   VAR %p2 = 2
  215.   VAR %p3 = 3
  216.   VAR %p4 = 4
  217.   VAR %p5 = 5
  218.   VAR %p6 = 6
  219.   VAR %p7 = 7
  220.   ;  if (%Free_winner != $null) { if (%pair. [ $+ [ %count ] ] == %Free_winner) {
  221.   ;      %p = %pair. [ $+ [ %count ] ]
  222.   ;      WHILE (%i <= $calc(%count - 1)) {
  223.   ;        if (** isin %pair. [ $+ [ %i ] ]) {
  224.   ;        }
  225.   ;        else {
  226.   ;          %pair. [ $+ [ %count ] ] =  %pair. [ $+ [ %i ] ]
  227.   ;          %pair. [ $+ [ %i ] ] = %p
  228.   ;          break
  229.   ;        }
  230.   ;        INC %i
  231.   ;      }
  232.   ;  } }
  233.   ;  %i = 1
  234.   if (** isin %pair. [ $+ [ %count ] ]) {
  235.     %p = %pair. [ $+ [ %count ] ]
  236.     WHILE (%i <= $calc(%count - 1)) {
  237.       if (** isin %pair. [ $+ [ %i ] ]) {
  238.       }
  239.       else if (%pair. [ $+ [ %i ] ] == %Free_winner) {
  240.       }
  241.       else {
  242.         %pair. [ $+ [ %count ] ] = %pair. [ $+ [ %i ] ]
  243.         %pair. [ $+ [ %i ] ] = %p
  244.         break
  245.       }
  246.       INC %i
  247.     }
  248.   }
  249.   %i = 1
  250.   if (3group isin $1) {
  251.     ACTION Triple GROUPING results for $nick :
  252.     WHILE (%i <= %count) {
  253.       if (%i != 1) {
  254.         if (%i // %p3) {
  255.           if (%i == 3) {
  256.             %mes = %mes $+ / $+ %pair. [ $+ [ %i ] ]
  257.             INC %p3 1
  258.           }
  259.           else {
  260.             if (%i == %count) {
  261.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] is alone
  262.             }
  263.             else {
  264.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  265.               INC %p3 3
  266.             }
  267.           }
  268.         }
  269.         else {
  270.           if (%i == %count) {
  271.             if (%i // $calc(%p3 - 1)) { %mes = %mes $+ / $+ %pair. [ $+ [ %i ] ] }
  272.             else {
  273.               %mes = %mes $+ / $+ %pair. [ $+ [ %i ] ] $+ / $+ (need_a_partner)
  274.             }
  275.           }
  276.           else {
  277.             %mes = %mes $+ / $+ %pair. [ $+ [ %i ] ]
  278.           }
  279.         }
  280.       }
  281.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  282.       INC %i
  283.     }
  284.   }
  285.   else if (group isin $1) {
  286.     ACTION GROUPING results for $nick :
  287.     WHILE (%i <= %count) {
  288.       if (%i != 1) {
  289.         if (%i // %p2) {
  290.           %mes = %mes $+ / $+ %pair. [ $+ [ %i ] ]
  291.           INC %p2 2
  292.         }
  293.         else {
  294.           if (%i == %count) {
  295.             %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] is alone.
  296.           }
  297.           else %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  298.         }
  299.       }
  300.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  301.       INC %i
  302.     }
  303.   }
  304.   else if (6pair isin $1) {
  305.     ACTION Sextuple PAIRINGS results for $nick :
  306.     WHILE (%i <= %count) {
  307.       if (%i != 1) {
  308.         if (%i // %p6 && %i > 5) {
  309.           if (%i == 6) {
  310.             %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  311.             INC %p6 1
  312.           }
  313.           else {
  314.             if (%i == %count) {
  315.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] gets a free round.
  316.               %Free_winner = %pair. [ $+ [ %i ] ]
  317.             }
  318.             else {
  319.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  320.               INC %p6 6
  321.             }
  322.           }
  323.         }
  324.         else {
  325.           %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  326.         }
  327.       }
  328.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  329.       INC %i
  330.     }
  331.   }
  332.   else if (5pair isin $1) {
  333.     ACTION Quintuple PAIRINGS results for $nick :
  334.     WHILE (%i <= %count) {
  335.       if (%i != 1) {
  336.         if (%i // %p5 && %i > 4) {
  337.           if (%i == 5) {
  338.             %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  339.             INC %p5 1
  340.           }
  341.           else {
  342.             if (%i == %count) {
  343.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] gets a free round.
  344.               %Free_winner = %pair. [ $+ [ %i ] ]
  345.             }
  346.             else {
  347.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  348.               INC %p5 5
  349.             }
  350.           }
  351.         }
  352.         else {
  353.           %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  354.         }
  355.       }
  356.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  357.       INC %i
  358.     }
  359.   }
  360.   else if (4pair isin $1) {
  361.     ACTION Quadruple PAIRINGS results for $nick :
  362.     WHILE (%i <= %count) {
  363.       if (%i != 1) {
  364.         if (%i // %p4 && %i > 3) {
  365.           if (%i == 4) {
  366.             %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  367.             INC %p4 1
  368.           }
  369.           else {
  370.             if (%i == %count) {
  371.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] gets a free round.
  372.               %Free_winner = %pair. [ $+ [ %i ] ]
  373.             }
  374.             else {
  375.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  376.               INC %p4 4
  377.             }
  378.           }
  379.         }
  380.         else {
  381.           %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  382.         }
  383.       }
  384.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  385.       INC %i
  386.     }
  387.   }
  388.   else if (3pair isin $1) {
  389.     ACTION Triple PAIRINGS results for $nick :
  390.     WHILE (%i <= %count) {
  391.       if (%i != 1) {
  392.         if (%i // %p3) {
  393.           if (%i == 3) {
  394.             %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  395.             INC %p3 1
  396.           }
  397.           else {
  398.             if (%i == %count) {
  399.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] gets a free round.
  400.               %Free_winner = %pair. [ $+ [ %i ] ]
  401.             }
  402.             else {
  403.               %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  404.               INC %p3 3
  405.             }
  406.           }
  407.         }
  408.         else {
  409.           %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  410.         }
  411.       }
  412.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  413.       INC %i
  414.     }
  415.   }
  416.   else if (pair isin $1) {
  417.     ACTION PAIRINGS results for $nick :
  418.     WHILE (%i <= %count) {
  419.       if (%i != 1) {
  420.         if (%i // %p2) {
  421.           %mes = %mes $+ $chr(32) $+ vs $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  422.           INC %p2 2
  423.         }
  424.         else {
  425.           if (%i == %count) {
  426.             %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ] gets a free round.
  427.             %Free_winner = %pair. [ $+ [ %i ] ]
  428.           }
  429.           else %mes = %mes $+ $chr(32) $+ , $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  430.         }
  431.       }
  432.       else %mes = %mes $+ $chr(32) $+ %pair. [ $+ [ %i ] ]
  433.       INC %i
  434.     }
  435.   }
  436.   ACTION %mes
  437. }
  438.  
  439. on *:TEXT:*:?: {
  440.   if (! isin $1) {
  441.     if (help isin $1) { }
  442.     else {
  443.       return
  444.     }
  445.   }
  446.   msg $chan $nick Available commands:
  447.   msg $chan $nick !random [number] - gives you a random number in definite range. for example "!random 6" will give you random number between 1 and 6 (works here, in private message. also works on channel)
  448.   msg $chan $nick !yesno [question] - gives you an answer positive/negative on your question (works in private messages + works on channel)
  449.   msg $chan $nick !pairings [string1] [string2] [string3]... [string32]  - will give you random pairings results for tournaments. RandomBot tool will not allow same player take a free win, if that player already got one before. (works only for MOD, only on channel)
  450.   msg $chan $nick !LL [string1] [string2] [string3]... [string32] - will give you a lucky looser result for tournaments. (works only for MOD, only on channel)
  451.   msg $chan $nick !grouping [string1] [string2] [string3]... [string32] - will give you a random grouping result for tournaments. for example "!grouping a b c d" can give you result like this: " a_&_c  b_&_d " (works only for MOD, only on channel)
  452.   msg $chan $nick !3pairings [string1] [string2] [string3]... [string32] - will give you a random triple pairings result for tournaments. for example "!3pairings a b c d e f" can give you result like this: " a vs c vs d , b vs e vs f " (works only for MOD, only on channel)
  453. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement