This is a simple snippet I made a while ago - which was pretty basic. Which I've just decided to update:
I've added Flood Protection, and a check so it doesn't pick the bot and the person who triggered the command.
To use type: !spin
Suggestions, and comments are welcome. :)
alias -l spin {
if ($1 == 1) describe $2 Gives $3 a cookie!
if ($1 == 2) describe $2 Slaps $3 around abit with a large trout.
if ($1 == 3) kick $2 $3 Muhahahaha!
}
on *:TEXT:*:#damn:{
if ($1 == !spin) {
if ($($+(%,rspin,$remove($chan,$chr(35))),5) == $null) {
:spin_again
var %rspin = $nick($chan,$rand(1,$nick($chan,0)))
if ($istok($nick $me,%rspin,32)) { goto spin_again }
else {
.timer 1 1 describe # Spins the bottle.
.timer 1 3 msg # 04The bottle is slowing down.
.timer 1 5 msg # 04It lands on: %rspin $+ !
.timer 1 7 $spin($rand(1,3),$chan,%rspin)
set -u10 $+(%,rspin,$remove($chan,$chr(35))) on
}
}
else { .notice $nick This command can only be triggered once every 10 seconds. }
}
}
toclanfane1, you can bet on the suggestions napa and I have made to you are to be heeded.
You should then apply our suggestion to your code to have it improved. Currently your latest code will result in what napa has demonstrated in his quote.
Your %random variable hasn't been filled and it returns no value before it's set. You really don't need the %random variable anyway.
We wouldn't have given you a valid suggestion if we knew it was not workable or incorrect.
"some ppl" DO try to help out and encourage each other to get better in MSL scripting. You shall not take this the wrong way and get annoyed.
You don't need a %random variable. You should always consider adding a trigger flood control for a trigger based script. Also, consider adding timers for each output so they don't get spit out at once:
on *:TEXT:!spin:#: {
if (!%t) {
inc -u4 %t
.timer 1 2 msg $chan $nick spins the bottle
.timer 1 4 msg $chan the bottle is slowing down
.timer 1 6 msg $chan it landed on $nick($chan,$rand(1,$nick($chan,0)))
}
}