Spin The Bottle

By Stewie1k94 on May 01, 2011

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. }
  }
}

Comments

Sign in to comment.
Stewie1k94   -  Oct 24, 2012

Updated. :)

 Respond  
Stewie1k94   -  May 03, 2011

ill try :P

 Respond  
Epic   -  May 02, 2011

hey you should make it do things after it lands on the random person :p

 Respond  
Stewie1k94   -  May 01, 2011

sorry i just do it just happens

 Respond  
napa182   -  May 01, 2011

toclafane1 Wrote:

i know but i just get frustrated if things dont really go to plan

well no reason to get frustrated really, just learn from it so you don't make the same mistakes over an over.
thats all....

 Respond  
Stewie1k94   -  May 01, 2011

i know but i just get frustrated if things dont really go to plan

 Respond  
Jethro   -  May 01, 2011

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.

 Respond  
napa182   -  May 01, 2011

here is ur line

set $nick($chan,$rand(1,$nick($chan,0)))

no %random in it an yes no real need to set any vars as Jethro_ stated.

the output of ur snippet is this

<~napa182> !spin
<~SlickOne> napa182 spins the bottle
<~SlickOne> the bottle is slowing down
<~SlickOne> it landed on

 Respond  
Stewie1k94   -  May 01, 2011

some ppl

 Respond  
Stewie1k94   -  May 01, 2011

i did set %random and jethro_ said i did not need it and yex i did test it

 Respond  
napa182   -  May 01, 2011

did you bother testing this before you posted it?

first you didn't even set the var %random, also be a good idea to add abit of flood control to it, as well as naming an silencing the timers. maybe add a check so it wont pick the bot.

 Respond  
Jethro   -  May 01, 2011

I really don't know why you had to set a global variable for %random when it's superfluous.

 Respond  
Stewie1k94   -  May 01, 2011

ok thanks for the tip

 Respond  
Jethro   -  May 01, 2011

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)))
  }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.