Cup Bot in progress.

By Yoinx on Jan 13, 2005

This is a cupbot Im working on. Its not finished however, I'm going to post it and just keep updating it. Put it in a bot and for the commands type !help and I apologize to anyone who feels this is sloppy coding. I would appreciate any suggestions on what else a cup bot is supposed to do. The prize doesnt really do anything yet, as I have no idea what it should do. Also, someone had requested a cupbot that allows you to add clans. I will not implement that since then it would need a whole seperate set of coding to keep track of clans, and another section to just get the max allowed people out of the clan to add to the team.

on *:Text:*:#channel: {
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;; I will not be including error messages as I'm just simply to lazy to care that much. ;;;;;
  ;;;;; For help type !help. This is made to run on a bot. Not your client.                  ;;;;;
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;starts cup;
  if ( $1 == !startcup ) && ( $2 != $null ) && ( $3 != $null ) && ( %cup.running == $null ) {
    .set %cup.running 1
    .set %cup.teams $3
    .set %cup.players $gettok($2,1,111)
    msg $chan New Cup has been started! $+($(%cup.players,2),on,$(%cup.players,2)) Teams: $(%cup.teams,2) 
  }
  ;stops cup, cleans up vars/files;
  if ( $1 == !stopcup ) && ( %cup.running != $null ) {
    .unset %cup.*
    .remove teams.ini
    .remove rounds.ini
    .remove rounds.txt
    msg $chan Cup has Been Stopped.
  }
  ;sets map and says which map is set.;
  if ( $1 == !map ) {
    if ( $2 != $null ) && ( $nick isop $chan ) && ( %cup.running != $null ) { 
      .set %cup.map $2
    }
    elseif ( $2 == $null ) && ( %cup.map != $null ) {
      msg $chan Current map is $(%cup.map,2)
    }
  }
  ;sets prize and says which prize is set.;
  if ( $1 == !prize ) {
    if ( $2 != !null ) && ( %cup.running != $null ) && ( $nick isop $chan ) {
      .set %cup.prize $2
    }
    elseif ( %cup.prize != $null ) {
      msg $chan Prize for current cup is $(%cup.prize,2)
    }
  }
  ;adds players and builds rounds/ladder once all player slots are filled.;
  if ( $1 == !add ) && ( $2 isnum $+(1-,$(%cup.teams,2)) ) && ( %cup.running != $null ) {
    if ( $istok($(%cup.players.list,2),$nick,44) ) { halt }
    if ( $numtok($readini(teams.ini,$2,players),44) < $(%cup.players,2) ) {
      .writeini teams.ini $2 players $addtok($readini(teams.ini,$2,players),$nick,44)
      .set %cup.players.list $addtok($(%cup.players.list,2),$nick,44)
      msg $chan $nick added to team $2
    }
    inc %cup.current
    if ( $(%cup.current,2) == $calc($(%cup.players,2) * $(%cup.teams,2)) ) {
      msg $chan All the teams are filled and the game is ready to begin. Use !rounds to get players for each competition.
      .set %cup.totalmet 1 
      .makeround
    }
  }
  ;lists teams;
  if ( $1 == !team ) && ( $2 isnum $+(1-,$(%cup.teams,2)) ) && ( %cup.running != $null ) && ( $ini(teams.ini,0) != $null ) {
    msg $chan $readini(teams.ini, $2, players)
  }
  ;lists matches for current tier;
  if ( $1 == !rounds ) && ( %cup.totalmet != $null ) {
    .play $chan rounds.txt
  }
  ;sets a winner for the specified round.;
  if ( $1 == !lost ) && ( %cup.totalmet != $null ) && ( $2 isnum $+(1-,$ini(rounds.ini,0)) )  && ( $3 isnum ) {
    remini teams.ini $3
    inc %cup.rounds
    if ( $ini(rounds.ini,0) > 1 ) {
      if ( $(%cup.rounds,2) == $ini(rounds.ini,0) ) {
        .inc %cup.tier
        msg $chan Tier has been completed. Building Matchups for the next tier. Current Tier: $(%cup.tier,2)
        .remove rounds.ini
        .remove rounds.txt
        makeround
        .unset %cup.rounds
      }
    }
    else {
      msg $chan Cup is completed $readini(teams.ini,$ini(teams.ini,1),players) have one the cup.
    }
  }
  ;lists commands;
  if ( $1 == !help ) {
    notice $nick the commands are: * !startcup $+($chr(35),on,$chr(35)) rounds * !stopcup * !prize (prize) * !map (map) * !add $+(Team,$chr(35)) * !teams * !rounds * !lost team *  
  }
}
;alias used to build the rounds for each tier based on the teams in teams.ini.;
alias makeround {
  var %x 1
  var %z 1
  .write rounds.txt Rounds Are as Follows
  while ( %z <= $calc( $ini(teams.ini,0) / 2 ) ) {
    .write rounds.txt Round $+($(%z,2),:) Team $ini(teams.ini,%x) vs Team $ini(teams.ini,$calc( %x +1 ))
    .writeini rounds.ini %z $ini(teams.ini,%x) $readini(teams.ini,$ini(teams.ini,%x),players)
    inc %x
    .writeini rounds.ini %z $ini(teams.ini,%x) $readini(teams.ini,$ini(teams.ini,%x),players)
    inc %x
    inc %z
  }
  .write rounds.txt Rounds will be updated once the current Tier is completely won.
}

Comments

Sign in to comment.
spermis   -  Feb 11, 2007

Can you make that you dont have to add team but you type !add and it adds yourself? Like 1x1 support.. and also for Melee or CSDM.. that when adds like 4 or 8 peoples you have to play CSDM (deathmatch) - everybody plays together - Free FOr all, its like Counter - Terrorists can kill Counter -Terrorirs and Terrorists, and Terrorists can kill Terrorists and Counter - Terrorists.. and then when mach is done you type !losers nick and nick (2 peoples go out)

 Respond  
Yoinx   -  Jan 21, 2006

lol, Its something that was requested on the forum. So I scripted this one, and xdaemon scripted his. He still develops his, I\'d personnally use that one.

A cup bot is basically just used to generate ladders for game competitions.

 Respond  
noMen   -  Jan 21, 2006

Can you explain in a few sentences what a Cup bot is? This is new to me ...

 Respond  
Yoinx   -  Feb 22, 2005

you change channel in the on text, then type !help or !startcup player teams in the channel

 Respond  
Moddi   -  Feb 22, 2005

how does it work ?

 Respond  
Moddi   -  Feb 22, 2005

how does it work ?

 Respond  
Yoinx   -  Jan 18, 2005

And there are like 2 more cupbot snippets on this site.

 Respond  
Yoinx   -  Jan 18, 2005

Yeah, as it says in the description, please provide suggestions to help me make it better (I dont use these things)

 Respond  
Pikachuh   -  Jan 18, 2005

ow

 Respond  
Pikachuh   -  Jan 18, 2005

well, this is the first public cup script i see...

 Respond  
Yoinx   -  Jan 14, 2005

mo im just working on this one, as the ones I see are limited, either being like 2on2 or 3on3 etc, this one doesnt have limits, and so far is only like 1/5 of the size.

 Respond  
DarthReven   -  Jan 14, 2005

what is this cup bot scripting compition geeze

 Respond  
legan   -  Jan 14, 2005

eeeh i think that 2 Cup bots are enough :: there are now 12034 cup channel on Qnet :: not fair :P

 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.