Wow this looks like a fun channel game to play, i can see people just blazing away for hours on each other.
I have left it using global variables , although you should really look into using a hash table, dont let the fact its a hash table concern you, in a simple way there just like a set of variables held in a special box (the hashtable), you would replace set % $+ $nick $+ _ammo 6 with hadd -m shotgame $nick $+ _ammo 6 and accesing would change from % [ $+ [ $nick ] $+ ] _ammo into $hget(shotgame,$nick $+ _ammo) but that might be for a latter version.


OK things i did, and i hope u dont mind some of the small additions, just saw something that might be a little nicer, adjust as you like its your script.


(1*) changed the ON *:TEXT:!trigger:# to being ON *:TEXT:!trigger:#channelname, you need to change this to the channel your running it on, so the bot if in another channel wont take instructions from there, alos with this, I replaced all the MSG #TEST with MSG $CHAN whcih is the channel that the bot responds to.

(2*) each event now checks for if the player is in the game, and gives a relevent responce if needed and halts. This is the first IF line with the ; lines around it.

(3) I added a -u10000000 to all the sets, this means there global but not saved if mirc exits, If u do want them saved, so the game continues when u return with players intacked then just remove the -u10000000, 5 in !join and 1 in !respawn

(4) added some checks if !shoot $2 had no $2, shoots thin air or if $2 isnt playing etc

(5*) added a reviving player detection this gives a !respaned player 5 seconds of invincibility, see * added the reviving detector * and * added the reviving detector flag (5 seconds duration) *

(6) added a shoot in different places remark

(7) added a shoting with no bullets joke, click, click, click, reload moron

(8) added ability to !stats anynick (as long as there in the game)

(9*) on a !suicide correctly UNSET the variables

(10) added an alias for you to nukem all

(N*) I beleive the ones with * above are the critical ones, the others i added (hope u dont mind again) as i beleive it would make the game better.


Code:
;GAME EXPERIMENTAL
on *:text:!join:#channelname: {
  ;
  if ($var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick has attempted to join the fray when hes already in it, everyone shoot him quick! | halt }
  ;
  set -u10000000 % $+ $nick $+ _Ammo 6
  set -u10000000 % $+ $nick $+ _Health 120
  set -u10000000 % $+ $nick $+ _Exp 0
  set -u10000000 % $+ $nick $+ _Kills 0
  set -u10000000 % $+ $nick $+ _Deaths 0
  msg $chan $nick has joined the fray!
}
;
on *:text:!shoot*:#channelname: { 
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  if ( % [ $+ [ $nick ] $+ ] _Health <= 1)  {
    msg $chan $nick, you're DEAD.
  }
  elseif ( % [ $+ [ $nick ] $+ ] _Ammo > 0) {
    dec % $+ $nick $+ _Ammo 1
    if ($2 == $null) {
      msg $chan $nick shoots into thin air, wow good move there!
    }
    elseif (!$var(% [ $+ [ $2 ] $+ ] _Ammo,0)) {
      msg $chan $nick shoots $2 to bad hes not in the game!
    }
    ;
    ;^ **** added some checks for $2 being nothing or a non playing name ****
    ;
    elseif ( % [ $+ [ $2 ] $+ ] _Health <= 1) {
      msg $chan $nick shot $$2 $+ 's dead corpse.
    }
    else {
      if ( % [ $+ [ $nick ] $+ ] _reviving ) {
        msg $chan $nick shot at $2 but $2 being fully healthy and alert dodged the bullet.
      }
      ;
      ;^ ***** added the reviving detector *****
      ;
      else {

        msg $chan $nick shot $2 in the $gettok( face! / body! / leg! / hand (ouch!) / foot?!? LoL! / back! (you swine!) / Balls (now that gotta hurt),$rand(1,7),47)
        ;
        ;^ ***** added a multiple shot spots sepreate each with a / and make $rand(1,N) N being how many you have. *****
        ;
        dec % $+ $2 $+ _Health $rand(10,30) 
        if ( % [ $+ [ $2 ] $+ ] _Health <= 1) {
          msg $chan $nick KILLED $2 $+ !
          dec % $+ $$2 $+ _Exp 1
          inc % $+ $nick $+ _Exp 3 
        }
      }
    }
  }
  elseif ( % [ $+ [ $nick ] $+ ] _Ammo <= 0) {
    msg $chan $nick click 
    dec % $+ $nick $+ _Ammo 1
    if ( % [ $+ [ $nick ] $+ ] _Ammo < -2) {
      msg $chan $nick $+ , reload, moron!
    }
    ;
    ;^ ***** added a little hummor when there outta ammo *****
    ;
  }
}
;
on *:text:!respawn:#channelname: {
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  if ( % [ $+ [ $nick ] $+ ] _Health >= 1) {
    msg $chan wait until you're dead! 
  }
  else {
    set -u10000000 % $+ $nick $+ _Health 120
    msg $chan $nick is back in the game!
    set -u5 % $+ $nick $+ _reviving $true
    ;
    ;^ ***** added the reviving detector flag (5 seconds duration) *****
    ;
  }
}
;
on *:text:!reload:#channelname: {
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  % $+ $nick $+ _ammo = 6
  msg $chan $nick's ready to go!
}
;
on *:text:!stats:#channelname: {
  ;
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  if (!$2) { tokenize 32 !stats $nick }
  if (!$var(% [ $+ [ $2 ] $+ ] _Ammo,0)) {
    msg $chan $nick $2 isnt in the game.
  }
  else {  
    msg $chan stats for $2 : Kills: $eval(% $+ $2 $+ _Kills,2), Deaths: $eval(% $+ $2 $+ _Deaths,2), and experience: $eval(% $+ $2 $+ _Exp,2)
  }
  ;
  ;^ ***** added ability to !stats anynick *****
  ;
}
;
on *:text:!suicide:#channelname: {
  if (!$var(% [ $+ [ $nick ] $+ ] _Ammo,0)) { msg $chan $nick join the game first! | halt }
  ;
  unset % $+ $nick $+ _Ammo
  unset % $+ $nick $+ _Health
  unset % $+ $nick $+ _Exp
  unset % $+ $nick $+ _Kills
  unset % $+ $nick $+ _Deaths
  msg $chan $nick is officially DEAD.
}
;
on *:text:!commands:#channelname: {
  msg $chan command list: "!join" sets you up.
  msg $chan "!shoot *target*" uses one of your bullets to shoot the target, duh.
  msg $chan "!reload" reloads your weapon; "!respawn" revives you.
  msg $chan "!stats" shows your statistics, and "!suicide" removes you from the game.
}
;
alias nukem {
  ;
  ;^ ***** added an alias you can use to erase all players *****
  ;
  unset %*_Ammo
  unset %*_Health
  unset %*_Exp
  unset %*_Kills
  unset %*_Deaths
  say A small nuke was just deployed, resulting in the vaperization of all players, Long Live $me!
}


[edit]
Please note while I wrote that up in the script editor I didnt debug it in play, (ie didnt go in and play the game using nicks)

Last edited by DaveC; 27/01/05 06:07 AM.