mIRC Home    About    Download    Register    News    Help

Print Thread
#174298 05/04/07 06:17 AM
Joined: Apr 2007
Posts: 8
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Apr 2007
Posts: 8
on *:text:random:#:{
set % $+ $nick 1
.msg $chan $rand(% $+ $nick $+ ,6)
}


The above code, is a small snippet from a larger Russian Roulette script I am making for my teams channel. My issue is, when I try to use the var in the random area of the scrim, it acts as though there is nothing there. I need this script to be able to set a new variable for each user that decides to play... the actual set command will set up the proper variable, just can't seem to get it to work inside of the random script. Any and all help would be much appreciated...

Joined: Mar 2007
Posts: 38
H
Ameglian cow
Offline
Ameglian cow
H
Joined: Mar 2007
Posts: 38
Originally Posted By: GodOfNades
on *:text:random:#:{
set % $+ $nick 1
.msg $chan $rand(% $+ $nick $+ ,6)
}


The above code, is a small snippet from a larger Russian Roulette script I am making for my teams channel. My issue is, when I try to use the var in the random area of the scrim, it acts as though there is nothing there. I need this script to be able to set a new variable for each user that decides to play... the actual set command will set up the proper variable, just can't seem to get it to work inside of the random script. Any and all help would be much appreciated...


2 things...
If % $+ $nick its always 1, why u set?
And to show %var u need the []

Code:
on *:text:random:#:{
  set % $+ $nick $rand(1,6)
  .msg $chan $nick $+ : % [ $+ [ $nick ] ]
}


Cya!.-


"if ($me ison $forum) { say Hello! }"
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: GodOfNades
on *:text:random:#:{
set % $+ $nick 1
.msg $chan $rand(% $+ $nick $+ ,6)
}


First, you're going to just have a lot of variables with 1s in them. I'm not sure why you'd want that. Second, if %$nick is always 1, why not just use $rand(1,6) ?


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
I'm assuming that he will be checking:
if ($rand(1,6) == 6) { ... }
if ($rand(2,6) == 6) { ... }
..
if ($rand (5,6) == 6) { ... }
since its a roulette game.


Those who can, cannot. Those who cannot, can.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
That doesn't answer my question. smile

Why have the %$nick variable in there if it's always 1? Now, you could set multiple player variables if necessary (though you'd set them with something that makes unsetting them easy-- %roulette.$nick for example). You'd set the variable to $rand(1,6) so that the variable contains the random number of 1-6. That would be the better way to handle something like that. I'm not sure if that's what the OP's trying to do, or what.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
It isn't always one (or atleast I think so). It will increment each time $rand(x,6) < 6, and the user will lose the roulette game when he/she gets a 6.


Those who can, cannot. Those who cannot, can.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
That's not what the original code has, though.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
That is true, however he does state that it will be a roulette game. (6 rounds, 5 blanks, and 1 shot -> possible 1 blank shot each round = $rand(round,6)).


Those who can, cannot. Those who cannot, can.
Joined: Apr 2007
Posts: 8
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Apr 2007
Posts: 8
What they say is true... With each shot, the variable that I am putting into the random will be changing. So say if they were to live on the first shot, the 2nd shot, instead of being 1,6 will then be basically 2,6 ... What I'm trying to do is, add functionality for multiple users to all play at once, without disturbing another players game.

For now, I just made a temp work around so that only one person can play at a time... But I would like to be able to see multiple people blow their faces at once while playing that game, so no one users can effect the random chance of another one because they both want to play....

here is a full copy of the code I am using as the work around for the time being for the single play...


Code:
on *:load:{
  /echo $chan 4Russian Roulette Script loaded. 
  /echo $chan 4Enjoy :) {
    if ($version < 6.16) { echo $chan 4This script was coded in mIRC v6.16, upgrade you may run into problems.
    }
  }
}
menu channel {
  Russian Roulette
  .Reset High Score:{
    /unset %rouletterecord
  /msg $chan 4Russian Roulette: 10The High Score has been reset. }
  .Reset Total Bans:{
    /unset %roulettebans
  /msg $chan 4Russian Roulette: 10The Total Bans has been reset. }
  .Set High Score:{
    /set %rouletterecord $$?="New High Score:"
  /msg $chan 4Russian Roulette: 10The Record has been set to:4 %rouletterecord }
  .Restart Current Game(s):{
    /unset $+(%,roulettegame.,*)
  /msg $chan 4Russian Roulette: 10The current game(s) has been restarted. }
  .-
  .Display High Scores:{
  /msg $chan 4Russian Roulette: 5Last banned:4 %roulettebannick 5Total bans:4 %roulettebans 5Record:4 %rouletterecord 5Luckiest Person:4 %luckiestperson  }
  .$iif($($+(%,roulettereward.,$chan),2),$style(1)) Roulette Reward:if ($($+(%,roulettereward.,$chan),2)) { set $+(%,roulettereward.,$chan) 0 } | else { set $+(%,roulettereward.,$chan) 1 | set $+(%,rrecord.,$chan) $$?-="Roulette Reward" | set $+(%,r_rewardmode.,$chan) $$?-="Reward for Ultimate Record: (OP, HOP, VOICE, SOP)" | /msg $chan 4Russian Roulette: 10Roulette Reward system has been Enabled! You must beat4 $($+(%,rrecord.,$chan),2) 10to get4 $($+(%,r_rewardmode.,$chan),2) } 
}

on *:text:!loadgun:#idoa: {
  if (%gameon == 1) {
    set %gameon 2
    set %player $nick
    .timergame 1 300 set %gameon 1
    .timerrussian 1 300 disable #russian
    .timershot 1 300 disable #shot
    .msg $chan Russian Roulette has now been started by $nick $+ , and will be in there control for 5 mins, or until they eat a bullet.
    .notice $nick You have loaded a single bullet into the gun. To spin the chamber, type !spin and after thats done, you can take your shot(s)!
    enable #russian  
  }
}
#russian on
on *:text:!spin:#idoa:{
  if (%player == $nick) {
    .msg $chan $nick raises the gun and spins the chamber. Where the bullet will stop nobody knows!
    set %random 1    
    .notice $nick The barrel is spun, now pull the trigger with !head
    .notice $nick You do not have to spin every time, only if you want to have the full 6 barrels open to you again.
    set %banroulette.rand $rand(%random $+ ,6)
    enable #shot
  } 
}
#russian end

#shot on
on *:text:!Head:#idoa:{   
  if (%player == $nick) {
    inc $+(%,roulettegame.,$nick) 1 {  

      if ($me !isop $chan) { msg $chan 12I'm not OP! OP me first to play! | halt }
      .msg $chan $nick raises the gun to his head and pulls the trigger.    
      set %banroulette.rand $rand(%random $+ ,6) {

        if (%random == 6) { 
          if (%banroulette.rand == 6) { set %ban 1 Min }
        }
        elseif (%random == 5) {  
          if (%banroulette.rand == 6) { set %ban 1 Min }
          elseif (%banroulette.rand == 5) { set %random 6 }
        }
        elseif (%random == 4) {  
          if (%banroulette.rand == 6) { set %ban 1 Min }
          elseif (%banroulette.rand == 4) { set %random 5 }
          elseif (%banroulette.rand == 5) { set %random 5 }
        }
        elseif (%random == 3) {  
          if (%banroulette.rand == 6) { set %ban 1 Min }
          elseif (%banroulette.rand == 3) { set %random 4 }
          elseif (%banroulette.rand == 4) { set %random 4 }
          elseif (%banroulette.rand == 5) { set %random 4 }
        }
        elseif (%random == 2) {  
          if (%banroulette.rand == 6) { set %ban 1 Min }
          elseif (%banroulette.rand == 2) { set %random 3 }
          elseif (%banroulette.rand == 3) { set %random 3 }
          elseif (%banroulette.rand == 4) { set %random 3 }
          elseif (%banroulette.rand == 5) { set %random 3 }
        }

        elseif (%random == 1) {       
          if (%banroulette.rand == 6) { set %ban 1 Min }
          elseif (%banroulette.rand == 1) { set %random 2 }
          elseif (%banroulette.rand == 2) { set %random 2 }
          elseif (%banroulette.rand == 3) { set %random 2 }
          elseif (%banroulette.rand == 4) { set %random 2 }
          elseif (%banroulette.rand == 5) { set %random 2 } 
        } 
        {

          if (%banroulette.rand == 6 && %ban == 1 Min) { $+(timer,60,$nick) 1 60 mode $chan -b $address($nick,2) } {
            if (%banroulette.rand == 6) {
            .msg $chan BOOM! Headshot! | mode $chan -e $address($nick,2) | mode $chan -e $nick | mode $chan +b $address($nick,2) | kick $chan $nick 10You are dead.4 %ban 10ban. | unset %banroulette.rand | unset %roulettebans.rand| unset $+(%,roulettegame.,$nick) | inc %roulettebans 1 | set %roulettebannick $nick | set %gameon 1 | timergame off | timerrussian off | disable #russian | disable #shot | timershot off }
            else {
              .msg $chan CLICK! See if your luck holds, I dare you. 5Tries this game:4 $($+(%,roulettegame.,$nick),2) 5Last banned:4 %roulettebannick 5Total bans:4 %roulettebans 5Record:4 %rouletterecord 5Luckiest Person:4 %luckiestperson | unset %russianroulette.rand
              if ($($+(%,roulettegame.,$nick),2) > %rouletterecord) { set %rouletterecord $($+(%,roulettegame.,$nick),2) | set %luckiestperson $nick }
              elseif (%rouletterecord == $null) { set %rouletterecord $($+(%,roulettegame.,$nick),2) | set %luckiestperson $nick } {
                if ($($+(%,roulettegame.,$nick),2) > $($+(%,rrecord.,$chan),2) && $($+(%,roulettereward.,$chan),2) == 1) { reward_nick $nick | msg $chan 4Congratulations $nick ! You have successfully beaten the ULTIMATE RECORD! }
              }
            }
          }
        }
      }
    }
  }
}
#shot end

Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
Heres what I've made so far, using hash tables.
Code:
on *:text:*:#: {
  if ($1 == !roulette) {
    if ($me !isop $chan) {
      describe $chan does not have a gun, set mode +o $me to give me a gun.
      return
    }
    hadd -mu300 roulette $nick 1
    describe $chan loads a bullet into his revolver, and spins the barrel. Type !shoot to continue.
  }
  elseif ($1 == !shoot) {
    if ($me !isop $chan) {
      describe $chan does not have a gun, set mode +o $me to give me a gun.
      return
    }
    if ($hget(roulette,$nick) == $null) {
      .notice $nick You need to load the gun first. Say !roulette in $chan $+ .
      return
    }
    var %x = $hget(roulette,$nick)
    if ($rand(%x,6) == 6) {
      ban -ku60 $chan $nick 2 BOOM!
      hdel roulette $nick
    }
    else {
      describe $chan *CLICK* $+([,%x,/6])
      hadd roulette $nick $calc(%x + 1)
    }
    if (%x == 5) {
      describe $chan $nick has won roulette!
      hdel roulette $nick
    }
  }
}

Use $hget(roulette,$nick) to get the number of tries. You should also change the messages, as they aren't that original eek


Those who can, cannot. Those who cannot, can.

Link Copied to Clipboard