|
Joined: Dec 2010
Posts: 26
Ameglian cow
|
OP
Ameglian cow
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. 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.
}
|
|
|
|
Joined: Feb 2004
Posts: 206
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 206 |
try $nick e.g. %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.
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!
|
|
|
|
Joined: Dec 2010
Posts: 26
Ameglian cow
|
OP
Ameglian cow
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 BANG! $nick watches $2 $+ 's brain splatter all over the wall. to use at a random nick.
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
I'm not sure if this is what you want but try : 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.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Dec 2010
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Dec 2010
Posts: 26 |
I'm sorry it doesn't work.
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
what doesn't work exactly ? how are you triggering it ? I edited the code in my previous post, you can try it again
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Dec 2010
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Dec 2010
Posts: 26 |
It doesn't react. It's just like a normal message. Even nothing at status.
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
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
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Feb 2004
Posts: 206
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 206 |
Untested: 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!
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Optional suggestion 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.
|
|
|
|
|