Fortune

By SoxFarxAway777 on Aug 23, 2008

This is just a snippet to predict your future. Enjoy. :)

on *:TEXT:-Fortune*:#: {
  var %fortune $rand(1,10)
  if (%fortune == 1) { msg $chan $2- will live a wonderful life, full of happiness, and love. }
  if (%fortune == 2) { msg $chan $2- will become a hermit and live sad and lonely for the rest of their life. }
  if (%fortune == 3) { msg $chan $2- will start a company, and live a prosperous life. }
  if (%fortune == 4) { msg $chan $2- will die at a young age. }
  if (%fortune == 5) { msg $chan $2- will become a famous actor/actress/musician and spend the rest of their life in the spotlight. }
  if (%fortune == 6) { msg $chan $2- will disappear without a trace, and never be heard from again. }
  if (%fortune == 7) { msg $chan $2- will die, but become reanimated as a Zombie, and forever roam the earth in search of purpose... And brains, of course. }
  if (%fortune == 8) { msg $chan $2- will live a normal life, with a normal home, a normal job, and a normal future. }
  if (%fortune == 9) { msg $chan $2- will be eaten alive by bears. }
  if (%fortune == 10) { msg $chan $2- does not exist, and therefore will not have a future. }
}

Comments

Sign in to comment.
Zmodem   -  Aug 24, 2008

Hey, thanks for pointing out the 'on text' vars that I forgot to get rid of lol! Now, looking back, I was able to decrease the file size by yet another 0.1k lol. Nice! :) As for $read(fortune.txt), yea, I slipped up by adding $rand(). :-)

 Respond  
guest598594   -  Aug 24, 2008

Zmodem, why set those vars in the on text? You don't even use %r. :/

And $read(fortune.txt) would work fine enough, since it already picks a random line.

 Respond  
Zmodem   -  Aug 24, 2008

azy: You are correct. That is a more sensible way of doing it. However, for simple and 'beginner-like', this can be made acceptable :)

SoxFarAway777: May I suggest a different approach? See below:

alias -l fort {
  var %r = return
  goto $rand(1,10)
  :1
  %r will live a wonderful life, full of happiness, and love.
  :2
  %r will become a hermit and live sad and lonely for the rest of their life.
  :3
  %r will start a company, and live a prosperous life.
  :4
  %r will die at a young age.
  :5
  %r will become a famous actor/actress/musician and spend the rest of their life in the spotlight.
  :6
  %r will disappear without a trace, and never be heard from again.
  :7
  %r will die, but become reanimated as a Zombie, and forever roam the earth in search of purpose... And brains, of course.
  :8
  %r will live a normal life, with a normal home, a normal job, and a normal future.
  :9
  %r will be eaten alive by bears.
  :10
  %r does not exist, and therefore will not have a future.
}
on *:TEXT:-Fortune*:#:msg $chan $2 $fort

Code's a bit quicker and cleaner and it will also save you around 0.2k in file size. However, as 'azy' suggested, use a text file. Create a text file called 'fortune.txt' and save all of the fortunes to it. Then, all you will need is this simple, one-line text-event:

ON *:TEXT:-Fortune*:#:msg $chan $2 $read(fortune.txt)
 Respond  
azy   -  Aug 23, 2008

I'm pretty new too, but couldn't you have just done...

on :TEXT:-Fortune:#: { msg $chan $read(fortune.txt) }

and put all the "outcomes" in fortunes.txt?

Nice script though, will use!

 Respond  
SoxFarxAway777   -  Aug 23, 2008

Meh. I just started scripting about a week ago, and I haven't slept in a while, so I might apply your suggestions later, although I did fix the brackets and backslashes.

Thanks for the comment, that probably saved me a lot of complications. :)

 Respond  
Kirby   -  Aug 23, 2008

You don't need the slashes (/msg $chan), and you're missing a bunch of brackets (1st and 4th "fortune".
Also, try to add some flood protection to that trigger; you wouldn't want people spamming it. :D

Put this into good use: http://www.hawkee.com/snippet/3874/

 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.