DuelBot

By wikkedfin on Feb 21, 2009

a simple kick counter BOT to act as a jury for a match duel between 2 contestant. A must for a kick-war channel.

#duelcounter off
on +1:KICK:#: {
  if ( bot isin $nick ) halt
  if ( b0t isin $nick ) halt
  if ( sevr isin $nick ) halt
  if ( serv isin $nick ) halt
  inc %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ]
  ;  /echo -s %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ]  $nick $knick $1-
  if ( %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ] == 4 ) {
    /set %overkicker $nick
    /msg $chan 4 WARNING 1 >> 0,4 $nick kicks $knick 4 times  %logo
  }
  .timer. [ $+ [ $nick [ $+ [ $knick ] ] ] ] 1 60 unset %OKP [ $+ [ $nick [ $+ [ $knick   ] ] ] ]
  if ( %OKP [ $+ [ $knick [ $+ [ $nick ] ] ] ] != $null )  {
    unset %OKP [ $+ [ $knick [ $+ [ $nick ] ] ] ]
    .timer. [ $+ [ $knick [ $+ [ $nick ] ] ] ] off
  }
  if (( $nick == %kontestan1 ) && ( $knick == %kontestan2 )) { .inc %hasil1 | if ( $nick == %overkicker ) { .dec %hasil1 2 | /msg #warfight 0,4 PENALTY IN POINT TO %kontestan1 } | .unset %overkicker | halt }
  if (( $nick == %kontestan2 ) && ( $knick == %kontestan1 )) { .inc %hasil2 | if ( $nick == %overkicker ) { .dec %hasil2 2 | /msg #warfight 0,4 PENALTY IN POINT TO %kontestan2 } | .unset %overkicker | halt }
  if (( $nick != %kontestan1 ) || ( $nick != %kontestant2 )) { 
    if (( $knick == %kontestan1 ) || ( $knick = %kontestant2 )) { 
      /msg #warfight 1,7 Interference by $nick !!!  | /ban -u120 # $nick | /kick # $nick 1,7 DO NOT INTERFERE DUEL <banned 120 seconds>  
    }
  }
}
on 1:NICK: {
  if ( $nick == %kontestan1 ) { /set %kontestan1 $newnick }
  if ( $nick == %kontestan2 ) { /set %kontestan2 $newnick }
}
on @1:deop:#:{
  if ( %OKP [ $+ [ $opnick [ $+ [ $nick ] ] ] ] != $null )  {
    .unset %OKP [ $+ [ $opnick [ $+ [ $nick ] ] ] ] 
    .timer. [ $+ [ $opnick [ $+ [ $nick ] ] ] ] off
  }
}
on @1:ban:#:{
  if ( %OKP [ $+ [ $bnick [ $+ [ $nick ] ] ] ] != $null )  {
    .unset %OKP [ $+ [ $bnick [ $+ [ $nick ] ] ] ] 
    .timer. [ $+ [ $bnick [ $+ [ $nick ] ] ] ] off
  }
}
#duelcounter end
#duel off
on 1:TEXT:@reset*:#: {
  inc %duel1 | .timertext1 1 3 .unset %duel1
  if ( %duel1 < 2 ) {
    if ( $nick == %kontestan1 ) { /msg #warfight 7,7.. $nick reset from @1 | /set %kontestan1 empty | halt }
    if ( $nick == %kontestan2 ) { /msg #warfight 7,7.. $nick reset from @2 | /set %kontestan2 empty | halt }
  }
}
on 1:TEXT:@1:#: {
  if ( Serv isin $nick ) { /msg #warfight 7 $nick $+ , BOT is not allowed to contest...  | halt }
  if ( Sevr isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  if ( bot isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  if ( b0t isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  inc %duel1 | .timertext1 1 3 .unset %duel1
  if ( %duel1 < 2 ) {
    if ( $nick == %kontestan1 ) { /msg #warfight 7,7.. $nick now become Contestant @1 | halt }
    if (%kontestan1 != empty ) { /msg #warfight 7,7.. Be patience $nick --> Contestant @1 is occupied  | halt }
    if ( $nick == %kontestan2 ) { 
      /msg #warfight 7 $nick $+ , You cannot fight with yourself, you dumb!  
      halt
    }
    %kontestan1  = $nick
    ;    /msg #warfight 7,7.. Okay $nick di cek dulu servernya .....
    ;    .raw -q whois %kontestan1
    /msg #warfight 7,7..7,1 $nick  now become Contestant 7,1 @1   
    if (( %kontestan1 == empty ) || ( %kontestan2 == empty )) { HALT }
    /duelstart
  }
}
on 1:TEXT:@2:#: {
  if ( Serv isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  if ( Sevr isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  if ( bot isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  if ( b0t isin $nick ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
  inc %duel2 | .timertext1 1 3 .unset %duel2
  if ( %duel2 < 2 ) {
    if ( $nick == %kontestan2 ) { /msg #warfight 7,7.. $nick now registered as Contestant @2  | halt }
    if (%kontestan2 != empty ) { /msg #warfight 7,7.. Be patience $nick --> Contestant @2 is occupied  | halt }
    if ( $nick == %kontestan1 ) { 
      /msg #warfight 7 $nick $+ , you cannot fight with yourself, you dumb!  
      halt
    }
    %kontestan2  = $nick
    ;    /msg #warfight 7,7.. Okay $nick di cek dulu servernya .....
    ;    .raw -q whois %kontestan2
    /msg #warfight 7,7..7,1 $nick  now registered as Contestant 7,1 @2  
    if (( %kontestan1 == empty ) || ( %kontestan2 == empty )) { HALT }
    /duelstart
  }
}
;raw 312:*: { 
;  if ( $parm3 != %duelserver ) {  /msg #warfight 7,7.. Tidak bisa $parm2 anda harus menggunakan server %duelserver , Tik: /server %duelserver1 | /msg #warfight 7,7.. Kontestan $parm2 dicoret sampai mengganti server
;    if ( $parm2 == %kontestan1 ) {  /set %kontestan1 empty }
;    if ( $parm2 == %kontestan2 ) { /set %kontestan2 empty }
;    /duelinfo
;    halt
;  }
;  /msg #warfight 7,7.. $parm2 sekarang terdaftar sebagai Kontestan   
;  if (( %kontestan1 == empty ) || ( %kontestan2 == empty )) { HALT }
;  /duelstart
;}
#duel end
;####### ALIASES ########
alias duelintro {
  if ( %kontestan2 == $null ) { %kontestan2 = empty }
  if ( %kontestan1 == $null ) { %kontestan1 = empty }
  /msg #warfight 7,7.. » DUEL ONE TO ONE «  :  3 mins Duel, who kicks more is the winner.
  /msg #warfight 7,7.. Type: 7,1 @1  to become Contestant @1
  /msg #warfight 7,7.. Type: 7,1 @2  to become Contestant @2 
}
alias duelinfo {
  if ( %kontestan2 == $null ) { %kontestan2 = empty }
  if ( %kontestan1 == $null ) { %kontestan1 = empty }
  /msg #warfight %duelon  » DUEL ONE TO ONE «  %duelon
  /msg #warfight Contestant @1 » 7,1 %kontestan1 «1,7 VERSUS »7,1 %kontestan2   «  Contestant @2
}
alias duelstart {
  if (( %kontestan1 == empty ) || ( %kontestan2 == empty ) || ( %kontestan1 == $null ) || ( %kontestan2 == $null )) { HALT }
  .timerlawan 1 5 /msg #warfight 7,1 %kontestan1 1,7 VERSUS 7,1 %kontestan2  Duel start in 10 seconds, be prepared
  .timersiap 1 10  /msg #warfight 1,7 Duel start in 5 second  ... ready? 
  .timergo 1 15 /go
  .timerenable 1 15 .enable #duelcounter
  /set %duelon  0,4 ON 
  .timerduelstop 1 180 /duelstop
  .timerduelinfo 0 30 /duelinfo
  .timerbelonduel off
  /disable #duel
}
alias duelstop {
  .disable #duelcounter
  if (%hasil1 > %hasil2) { /set %pemenang %kontestan1 | set %pemenang1 %kontestan1 }  
  if (%hasil2 > %hasil1) { /set %pemenang %kontestan2 | set %pemenang1 %kontestan2 }  
  if (%hasil2 = %hasil1) { /set %pemenang EVEN!!   }  
  .timerstopx 3 1 /msg #warfight 1,7 STOP 
  .timerstop 1 7 /msg #warfight 1,7 STOP... STOP KICKING!  
  .timerkita 1 10 /msg #warfight  1,7 Who is the winner?.......
  ./timerpemenang1 1 15 /pemenang 
  /set %kontestan1 %pemenang1
  /set %kontestan2 empty
  /enable #duel
  /set %duelon 1,9 OFF 
  /timerduelstop off
  /timerlawan off
  /timersiap off
  /timergo off
  /timerenable off
  /timerbelonduel 0 60 /duelinfo
  /timerduelinfo off
}
alias go {
  .timergo 3 2 /msg #warfight 1,7 GO !!!!  
}
alias pemenang {
  .timerpemenang2 3 2 /msg #warfight 1,7 The Winner is:  8,1 %pemenang 9,6 %hasil1 - %hasil2  |   /set %hasil1 0 |  /set %hasil2 0 
}
on +1:TEXT:!reset:#: {
  if ( $nick == %kontestan1 ) || ( $nick == %kontestan2 ) {
    inc %duelreset | .timerreset 1 60 .unset %duelreset
    if ( %duelreset > 1 ) halt
    /msg #warfight 1,7 DUEL RESET 
    /reset 
  }
}
alias reset {
  /set %kontestan1 empty
  /set %kontestan2 empty
  /disable #duelcounter
  /enable #duel
  /set %duelon 1,9 OFF 
  /timerduelstop off
  /timerlawan off
  /timersiap off
  /timergo off
  /timerenable off
  /timerbelonduel 0 60 /duelinfo
  /duelinfo
}
menu channel {
  DUEL
  .ON: {
    /duelintro | /duelinfo |;  /timerduel 0 180 /duelintro |  /timerbelonduel 0 90 /duelinfo |   .enable #duel 
    /set %duelserver wikkedserv.no-ip.org | /set %duelserver1 wikkedserv.no-ip.org 
    /msg #warfight 1,7 Duel ON 
  }
  .OFF: {
    /timerduel off
    /timerbelonduel off
    /timerduelinfo off
    .disable #duel
    /msg #warfight 0,7 Duel OFF 
  }
  Duel reset: {
    /set %kontestan1 empty
    /set %kontestan2 empty
    /disable #duelcounter
    /enable #duel
    /msg #warfight 1,7 DUEL RESET
    /set %duelon 1,9 OFF 
    /timerduelstop off
    /timerlawan off
    /timersiap off
    /timergo off
    /timerenable off
    /duelinfo
  }
}

Comments

Sign in to comment.
[i]concur   -  Mar 28, 2011

@Jaytea wow, so i totally didn't notice that it was a 2 year old post, no idea how i managed to find a post from that long ago in the first place. Thanks for pointing that out jaytea. Also, I quite agree with something you said I.E. -The "it doesn't matter how it's coded as long as it works" philosophy invariably leads to scruffy code that's difficult to maintain, read and learn from. guess I hadn't taken that into consideration when I commented. Though, I saw someone not giving constructive criticism and took personal offense to it because people have said in the past that my coding is sloppy. But, in the end, it wasn't the time or the place for it, I realize that now. Thanks for bringing me to that realization.

And @Jethro_ i have no idea what you were trying to say :S

More
 Respond  
Jethro   -  Mar 28, 2011

jaytea, the word "sloppiness" does not apply to those who easily get emotionally disturbed and wind up trolling with you. They don't take criticism that well, whether it's positive or negative. I've been there as hell, and I've had enough that BS.

More
 Respond  
jaytea   -  Mar 28, 2011

i'm not entirely against the idea of bumping old topics if the reason for doing so concerns an issue that is still important and relevant, but trying to call someone out for a comment they made over 2 years ago is really quite unnecessary.

on the topic of sloppiness: it is a valid criticism; whether or not it can be applied to this particular snippet (extra spacing can improve readability) is another matter entirely. the "it doesn't matter how it's coded as long as it works" philosophy invariably leads to scruffy code that's difficult to maintain, read and learn from. it looks as though a significant number of people visit this site to observe and discuss codes :P

More
 Respond  
[i]concur   -  Mar 27, 2011

does it work? i'm not interested in....but if it works, who cares if it's "sloppy". That's a matter of opinion anyway. But, if you MUST comment on such a matter, how about you make it less "sloppy" according to your standards, chadbdurham.

More
 Respond  
chadbdurham   -  Feb 22, 2009

This script is very sloppy. I think that the extra spaces in the script is very tacky. You might not have given as much thought in it as you should of.

More
 Respond  
dashh   -  Feb 21, 2009

nice but...

  inc %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ]
if ( %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ] == 4 ) {
    /set %overkicker $nick
    /msg $chan 4 WARNING 1 >> 0,4 $nick kicks $knick 4 times  %logo
  }
  .timer. [ $+ [ $nick [ $+ [ $knick ] ] ] ] 1 60 unset %OKP [ $+ [ $nick [ $+ [ $knick   ] ] ] ]

timer is inecesary.

set / vars ( like some inc ) have a auto unset timer

set -uN xD

  inc -u60 %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ]

;- so

if ( %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ] == 4 ) {
    /set %overkicker $nick
    /msg $chan 4 WARNING 1 >> 0,4 $nick kicks $knick 4 times  %logo
  }
inc -u60 %OKP [ $+ [ $nick [ $+ [ $knick ] ] ] ]

and this.

if ( $nick isin Serv Sevr bot b0t ) { /msg #warfight 7 $nick $+ , BOT  is not allowed to contest...  | halt }
;if u want use istok or some thing.
More
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.