!chanceon
!chanceoff
!chance
i give credit to cados for giving me some of this idea from his script ' http://www.hawkee.com/snippet/7370/ '.
on *:TEXT:*:#channelnamehere:{
if ($me == botsnamehere) {
if ($nick isop $chan) {
if ($1 == !chanceon) {
set %on.off on | msg $chan Script is now on.
}
elseif ($1 == !chanceoff) {
unset %on.off | msg $chan Script is now off.
}
}
if (%on.off == on) {
if ($1 == !chance) {
set %ch $chan
set %victim $nick(%ch,$rand(1,$nick(%ch,0)))
while (%victim == $me) {
set %victim $nick(%ch,$rand(1,$nick(%ch,0)))
}
msg %ch So %victim you want to take a chance on something? Let's do it...
msg %ch Choose a box by typing !box <number> and u will get one of the following: kick, op, halfop, voice, admin, owner or a rabid dog
msg %ch [1] [2] [3] [4] [5] [6] [7] [8]
}
if ($1 == !box) {
if ($nick == %victim) {
set %box.rand $rand(1,8)
if (%box.rand == 1) { msg %ch Congrats $nick $+ , you won an op! | mode %ch +o $nick }
elseif (%box.rand == 2) { msg %ch Congrats $nick $+ , you won a kick! | kick %ch $nick Better luck next time. }
elseif (%box.rand == 3) { msg %ch Congrats $nick $+ , you won halfop! | mode %ch +h $nick }
elseif (%box.rand == 4) { msg %ch Congrats $nick $+ , you won voice! | mode %ch +v $nick }
elseif (%box.rand == 5) { msg %ch Congrats $nick $+ , you won the rabid dog! | timer 1 1 describe %ch gives $nick a rabid dog that mauls them to death. | timer 1 2 kick %ch $nick You died. }
elseif (%box.rand == 6) { msg %ch Congrats $nick $+ , you won admin! | mode %ch +a $nick }
elseif (%box.rand == 7) { msg %ch Congrats $nick $+ , you won owner! | mode %ch +q $nick }
elseif (%box.rand == 8) { msg %ch Congrats $nick $+ , you won op! | mode %ch +o $nick }
}
}
}
}
}
Yup DMT, every one of us tends to script somewhat differently from one another (that we call it styles)...but the end of purpose is the same to achieve the best, efficient way possible. =) Still, though, it's always good to learn something from you that I don't know. :-D Keep it coming; I'm waiting...lol
hi
@Jethro_: no need for all that $iif() :p
on @*:text:!xbox:#: {
var %z msg #
goto $r(1,8)
:1 | %z you won an op! | mode # +o $nick | halt
:2 | %z you won halfop! | mode # +h $nick | halt
...
@MEH:
if ($me == botsnamehere) is unless
u have to check if the bot is an OP
u can use tokenize and only one msg # Congrats ...
on @*:text:*:#channelnamehere:{
if $nick isop # {
if $istok(!chanceon.!chanceoff,$strip($1),46) {
set %on.off $iif($strip($1) == !chanceon,1,0)
msg # Script is now $iif(%on.off,on,off) $+ .
}
}
if %on.off {
if $strip($1) == !chance {
set %victim $nick(#,$r(1,$nick(#,0)))
while (%victim == $me) set %victim $nick(#,$r(1,$nick(#,0)))
msg # So %victim you want to take a chance on something? Let's do it...
msg # Choose a box by typing !box <number> and u will get one of the following: kick, op, halfop, voice, admin, owner or a rabid dog
msg # [1] [2] [3] [4] [5] [6] [7] [8]
}
if $strip($1) == !box && $nick == %victim {
tokenize 124 op|kick|halfop|voice|the rabid dog|admin|owner|op
var %t $($+($,$r(1,8)),2)
msg # Congrats $nick $+ , you won %t $+ !
if (%t == kick) kick # $nick Better luck next time.
elseif %t == the rabid dog {
timer 1 1 describe # gives $nick a rabid dog that mauls them to death.
timer 1 2 kick # $nick You died.
}
else mode # $+(+,$replace(%t,halfop,h,op,o,voice,v,admin,a,owner,q)) $nick
}
}
}
You could do something like this, as an example, for randomization:
on @*:text:!xbox:#: {
var %x $r(1,8), %y goto, %z msg #
$iif(%x = 1,%y 1,$iif(%x = 2,%y 2,$iif(%x = 3,%y 3,$iif(%x = 4,%y 4,$&
$iif(%x = 5,%y 5,$iif(%x = 6,%y 6,$iif(%x = 7,%y 7,$iif(%x = 8,%y 8))))))))
:1 | %z you won an op! | mode # +o $nick | halt
:2 | %z you won halfop! | mode # +h $nick | halt
:3 | %z you won voice! | mode # +v $nick | halt
:4 | %z you won a kick! | kick # $nick Better luck next time. | halt
:5 | %z you won admin! | mode # +a $nick | halt
:6 | %z you won owner! | mode # +q $nick | halt
:7 | %z you won op! | mode # +o $nick | halt
:8
%z you won the rabid dog!
timer 1 1 describe # gives $nick a rabid dog that mauls them to death.
timer 1 2 kick # $nick You died.
halt
}
I know, it's goto...lol
As a side note, for the rand variable, you can set it local. You don't have to set it as global, which adds an unneeded space in your variables anyway.
looks like you took some from Cados Chance game
maybe you should give some credit to them....
also why this line?
if ($me == botsnamehere) {
also why have it pick random nicks to play what happens if they don't respond?