mIRC Home    About    Download    Register    News    Help

Print Thread
Russian Roulette #228655 05/01/11 04:37 PM
Joined: Dec 2010
Posts: 26
L
LMN Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2010
Posts: 26
I want to change the script so it isn't random deciding your destiny but random deciding who's destiny it is (so $nick1 or $nick2) but I don't know what code to use.

Php Code:
on *:TEXT:!rr*:#: {
  var %rr = $rand(1,3)
  msg $chan $2 draait het wapen en schiet!
  if (%rr == 1) .timer 1 3 msg $chan CLICK! $2 got lucky.
  if (%rr == 2) .timer 1 3 msg $chan BANG! $nick watches $2 $+ 's brain splatter all over the wall.
  if (%rr == 3) .timer 1 3 msg $chan The gun jammed, $2 got lucky.
} 


Re: Russian Roulette [Re: LMN] #228657 05/01/11 08:39 PM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
try $nick e.g.
Code:
%rr2 = $rand(1, $nick(0))
if (%rr = 1/2/3) .timer 1 3 msg $chan <...> $nick(%rr2) <...> 


There is a race condition here - if someone leaves the channel within the 3 seconds the timer is set for, the above modifications will either give the wrong name, or an error.

One way around it is to set the nick as soon as the alias is triggered.
Code:
 
var %targetnick = $nick($rand(1, $nick(0)))

and use %targetnick instead of $2

Cheers,
DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Re: Russian Roulette [Re: Darwin_Koala] #228671 06/01/11 05:10 PM
Joined: Dec 2010
Posts: 26
L
LMN Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2010
Posts: 26
But how should I make it then sorry I'm just a beginner with scripts. I'm now puzzling but It doesn't work. I just want
Code:
BANG! $nick watches $2 $+ 's brain splatter all over the wall.

to use at a random nick.

Re: Russian Roulette [Re: LMN] #228672 06/01/11 05:46 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
I'm not sure if this is what you want but try :
Code:
on *:TEXT:!rr &:#:.timer 1 3 msg $safe($chan) BANG! $nick($chan,$r(1,$nick($chan,0))) watches $safe($2) $!+ 's brain splatter all over the wall
alias safe bset -ct &a 1 $1 | return $!regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1))


Last edited by Wims; 06/01/11 06:39 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Russian Roulette [Re: Wims] #228673 06/01/11 06:33 PM
Joined: Dec 2010
Posts: 26
L
LMN Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2010
Posts: 26
I'm sorry it doesn't work.

Re: Russian Roulette [Re: LMN] #228674 06/01/11 06:44 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
what doesn't work exactly ? how are you triggering it ? I edited the code in my previous post, you can try it again


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Russian Roulette [Re: Wims] #228675 06/01/11 07:00 PM
Joined: Dec 2010
Posts: 26
L
LMN Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2010
Posts: 26
It doesn't react. It's just like a normal message. Even nothing at status.

Re: Russian Roulette [Re: LMN] #228676 06/01/11 07:26 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
It works for me, should works for you too, try putting that code in a new file and be sure that you don't have your old on text event


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Russian Roulette [Re: LMN] #228678 06/01/11 08:41 PM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
Untested:

Code:
on *:TEXT:!rr*:#: {
  var %tgtnick = $nick($rand(1,$nick(0))
  var %rr = $rand(1,3)
  msg $chan %tgtnick  draait het wapen en schiet!
  if (%rr == 1) .timer 1 3 msg $chan CLICK! %tgtnick got lucky.
  if (%rr == 2) .timer 1 3 msg $chan BANG! $nick watches %tgtnick $+ 's brain splatter all over the wall.
  if (%rr == 3) .timer 1 3 msg $chan The gun jammed, %tgtnick got lucky.
} 

Last edited by Darwin_Koala; 06/01/11 08:41 PM.

Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Re: Russian Roulette [Re: Darwin_Koala] #228680 07/01/11 12:08 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Optional suggestion
Code:
on *:text:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == !rr) {
    var %tgtnick = $nick(#,$r(1,$nick(#,0))), %shot = $r(1,3)
    msg $chan %tgtnick  draait het wapen en schiet!
    if (%shot == 2) {      %shot = BANG! $nick watches %tgtnick $+ 's brain splatter all over the wall.    }
    else %shot = $iif(%shot == 1,CLICK! %tgtnick got lucky.,The gun jammed, %tgtnick got lucky.)
    .timer 1 3 msg $chan %shot
  }
}

P.S.: Normally in Russian Roulette, a 6 shooter is used, thus the odds of getting shot are 1 in 6, not 1 in 3.

Last edited by RusselB; 07/01/11 12:12 AM.