raccoon commented on a Page, Chance game  -  Mar 05, 2010

This process of random selection can be better left to $read(chance.txt) which will select a random line from the file. You can put just the text portions of the /msg in this file, or an entire command or set of piped (|) commands on each line.

This also allows for easier future editing of a text file rather than modifying the contents of a script.

PS. I added the @ prefix to the TEXT event, so it only triggers if you are opped.

On @*:TEXT:!chance:#:{
  if (%FLOOD.CHANCE) return
  inc -z %FLOOD.CHANCE 5
  msg # So you want to take a chance on something? Let's do it.
  $read(chance.txt)
}

chance.txt

msg # Congrats, you won a voice! | mode # +v $nick
msg # Congrats, you won a kick! | kick # $nick Better luck next time.
msg # Congrats, you won a halfop! | mode # +h $nick
msg # Congrats, you won a ban! | mode # +b $address($nick,2)
msg # Congrats, you won a ball! | describe # gives $nick a red ball.
msg # Congrats, you won a rabid dog! | describe # gives $nick a rabid dog that mauls them to death. | kick # $nick You died.
msg # Congrats, you won an Xbox 360! | describe # gives $nick an Xbox360 with Call of Duty: Modern Warfare 2!
msg # Congrats, you won a memo! | ms send $nick Congradulations.
msg # Congrats, you won a website! | notice $nick http://wolverines.ning.com/
 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.