Random lines!(finally) USE ON BOT

By Mtn64 on Aug 13, 2011

This is a script made by me.
USE FOR A BOT
This took awhile, i've been studying and reading help sections, and finally remembered "variable".
$Rand was an idea by a friend, when i had tech difficulties.
So finally, i present you with THIS glorious script
Change the channels, Change # to your channel, or to $chan (means every chan)
change the text lines,
Anything!
You can find me at Purplesurge, Channel? #kirby
(yes i liek kirby)
~~Mtn64

;Made by mtn64, Fun to you!
on 1:TEXT:*!Rand*:$chan:{
  Var %random =  $rand(1,15)
  msg $chan You have entered the Random actions or lines.
  If (%random == 1.) .timer 1 2 msg $chan You have died with no funeral or apperance
  If (%random == 2.) .timer 1 2 msg $chan You have fallen off a cliff
  If (%random == 3.) .timer 1 2 msg $chan You were stabbed, injured, but lived.
  If (%random == 4.) .timer 1 2 msg $chan $nick was bullied into giving Money to $me
  If (%random == 5.) .timer 1 2 msg $chan If you have laid your hands on a knife before, you have died.
  If (%random == 6.) .timer 1 2 msg $chan  $nick was scared by clowns!
  If (%random == 7.) .timer 1 2 msg $chan $nick has failed life... Please press play
  If (%random == 8.) .timer 1 2 msg $chan  $me has fallen off a cliff, and $nick has broke $me 's fall
  If (%random == 9.) .timer 1 2 msg $chan  $nick has been lynched
  If (%random == 10.) .timer 1 2 msg $chan hold it spah! don't touch that sentry! $nick has killed $me
  If (%random == 11.) .timer 1 2 msg $chan Kirby kirby kirby's the one!
  If (%random == 12.) .timer 1 2 msg $chan  $nick has saved $me from a car accident, but $nick died after.
  If (%random == 13.) .timer 1 2 msg $chan  $nick loves being purple!
  If (%random == 14.) .timer 1 2 msg $chan  When your with me baby the skies are all blue, for all my life!
  If (%random == 15.) .timer 1 2 msg $chan i call this one, the camp fire song song.

Comments

Sign in to comment.
Dani_l11   -  Aug 15, 2011

@Jethro_, It's the little space (here on hawkee) which makes the script looks like a mess. In a mIRC editor it looks fine.

 Respond  
jaytea   -  Aug 14, 2011

anytime ;P

 Respond  
Jethro   -  Aug 13, 2011

Yes, you did. :P And as stubborn as I am, I keep on abusing it. Thanks for the slap in the face. :$

 Respond  
jaytea   -  Aug 13, 2011

This is non-regex version of using a one-line text trigger:

on *:TEXT:$($iif(!rand == $strip($1),$1)):#:{

this is not the same as blackvenom's example, since $1 returns the full line of text when used in the matchtext portion. i mentioned this before on the forums

 Respond  
Jethro   -  Aug 13, 2011

Yes, I understand.

The example demonstrated above only works for a single command.

You won't want to tokenize 32 $strip($1) and then if ($1 == venom) { just for one trigger, will you? It makes sense if you have more than one trigger to initiate.

But then again, for one command, you can just enclose it with $strip() without tokenize 32 $strip()

 Respond  
blackvenomm666   -  Aug 13, 2011

yea as i said just haven't used it. but then again for most of my on text events they are for my bot and i have a crapton of commands in it so the way i put above works great for it checking the diff if statements. instead of putting the command right into the on text event itself

 Respond  
Jethro   -  Aug 13, 2011

Just think of $iif() as if-then-else

If you already know the if-then-else, which I know you do, the $iif() should be a piece of cake.

 Respond  
blackvenomm666   -  Aug 13, 2011

that is another one as well i've never seen it done that way jeth. then again im not that good with the $iif i haven't really done much with it except for mostly with dialogs for opening.

 Respond  
Jethro   -  Aug 13, 2011

This is non-regex version of using a one-line text trigger:

on *:TEXT:$($iif(!rand == $strip($1),$1)):#:{

it strips control codes and trigger on the command !rand only.

 Respond  
blackvenomm666   -  Aug 13, 2011

@matcou

on *:TEXT:*:#:{
tokenize 32 $strip($1-)
if ($1 == !rand) {

yes it will check the if statement but for those who are not good at regex. and need it stripped but it is
not a good idea to have it in the text event such as !rand because it will trigger no matter where it is said seeing how it is wildcarded. the way i did it is a easy way to do it and it works perfectly as it is meant to not to mention it allows you to easily strip incoming text of color bold etcetc without setting it in your mirc options to strip all if you don't want it to strip all. there is nothing wrong with doing it that way. it also will allow you to easily combine several diff scripts that use the on text event for your bot so you don't have a lot of files so it can be condenced into one on text.

 Respond  
Jethro   -  Aug 13, 2011

or use Jethro's version (which a mess in my eyes)I thought it looked very clean to me. I even used the link break identifier to make it as easy on the eyes to read as possible. :/
(but I'm sure it will work)Yes, it works. I made sure of that before submitting it.

 Respond  
Dani_l11   -  Aug 13, 2011

Just put all lines in a .txt file and use $read... Less work and easier to manage, or use Jethro's version (which a mess in my eyes, but I'm sure it will work)

 Respond  
Jethro   -  Aug 13, 2011

SReject didn't put a halt or return at the end of each goto statement. This will display multiple random messages once triggered.

If you decide not to put a halt or return, you must use an alias to call from it. And yes, as Matcou said, the first message should've gone on top of the goto command.

The error check is not necessary based on the code construction.

 Respond  
Matcou   -  Aug 13, 2011

@SReject
I believe the channel message should go before the goto; as you have it now the first message will never trigger because the goto skips that line.

 Respond  
SReject   -  Aug 13, 2011
on $*:TEXT:/^[!.@]Rand/Si:#:{
  var %t = $+(.timerRandMsg:,$chan) 1 2 msg $chan

  msg $chan You have entered the Random actions or lines.

  goto $rand(1,15)
  :1 | %t You have died with no funeral or apperance | return
  :2 | %t You have fallen off a cliff | return
  :3 | %t You were stabbed, injured, but lived. | return
  :4 | %t $nick was bullied into giving Money to $me | return
  :5 | %t If you have laid your hands on a knife before, you have died. | return
  :6 | %t  $nick was scared by clowns! | return
  :7 | %t $nick has failed life... Please press play | return
  :8 | %t  $me has fallen off a cliff, and $nick has broke $me 's fall | return
  :9 | %t  $nick has been lynched | return
  :10 | %t hold it spah! don't touch that sentry! $nick has killed $me | return
  :11 | %t Kirby kirby kirby's the one! | return
  :12 | %t  $nick has saved $me from a car accident, but $nick died after. | return
  :13 | %t  $nick loves being purple! | return
  :14 | %t  When your with me baby the skies are all blue, for all my life! | return
  :15 | %t i call this one, the camp fire song song. | return
 }
}

Sorry, I was preoccupied when I did the first version. it should be fixed now

 Respond  
Matcou   -  Aug 13, 2011

@blackvenom666
You left periods in the if statements.
Also, do not use on :TEXT::#:{ because it will always trigger and check the if statement, overhead which is not needed.

 Respond  
jaytea   -  Aug 13, 2011

.timer will never be overwritten unless you happen to have a timer start that is named timer1 (or whatever number the timer is)

true that, and that's why you should never give your timers numerical names unless you have a very specific reason for doing so ;)

 Respond  
Matcou   -  Aug 13, 2011

@napa182
.timer will never be overwritten unless you happen to have a timer start that is named timer1 (or whatever number the timer is)

 Respond  
Annaiidziithaa   -  Aug 13, 2011

I like both, as well as Jethro_ & blackvenomm666, very good work, congratulations!

 Respond  
blackvenomm666   -  Aug 13, 2011

keeping it at mostly how you have it

on *:TEXT:*:#:{
tokenize 32 $strip($1-)
if ($1 == !rand) {
  Var %random =  $rand(1,15)
  msg $chan You have entered the Random actions or lines.
  If (%random == 1) .timer 1 2 msg $chan You have died with no funeral or apperance
  If (%random == 2) .timer 1 2 msg $chan You have fallen off a cliff
  If (%random == 3) .timer 1 2 msg $chan You were stabbed, injured, but lived.
  If (%random == 4) .timer 1 2 msg $chan $nick was bullied into giving Money to $me
  If (%random == 5) .timer 1 2 msg $chan If you have laid your hands on a knife before, you have died.
  If (%random == 6) .timer 1 2 msg $chan  $nick was scared by clowns!
  If (%random == 7) .timer 1 2 msg $chan $nick has failed life... Please press play
  If (%random == 8) .timer 1 2 msg $chan  $me has fallen off a cliff, and $nick has broke $me 's fall
  If (%random == 9) .timer 1 2 msg $chan  $nick has been lynched
  If (%random == 10) .timer 1 2 msg $chan hold it spah! don't touch that sentry! $nick has killed $me
  If (%random == 11) .timer 1 2 msg $chan Kirby kirby kirby's the one!
  If (%random == 12) .timer 1 2 msg $chan  $nick has saved $me from a car accident, but $nick died after.
  If (%random == 13) .timer 1 2 msg $chan  $nick loves being purple!
  If (%random == 14) .timer 1 2 msg $chan  When your with me baby the skies are all blue, for all my life!
  If (%random == 15) .timer 1 2 msg $chan i call this one, the camp fire song song.
 }
}
 Respond  
Jethro   -  Aug 13, 2011
on *:text:$($iif(!rand == $strip($1),$1)):#:{
  if (!%f) { inc -u5 %f
    .msg # You have entered the Random actions or lines.
    tokenize 124 You have died with no funeral or apperance|$&
      You have fallen off a cliff|$&
      You were stabbed, injured, but lived.|$&
      $+ $nick was bullied into giving Money to $me $+ |$&
      $(,if) you have laid your hands on a knife before, you have died.|$&
      $+ $nick was scared by clowns!|$&
      $+ $nick has failed life... Please press play|$&
      $+ $me has fallen off a cliff, and $nick has broke $me 's fall|$&
      $+ $nick has been lynched|$&
      hold it spah! don't touch that sentry! $nick has killed $me $+ |$&
      Kirby kirby kirby's the one!|$&
      $+ $nick has saved $me from a car accident, but $nick died after.|$&
      $+ $nick loves being purple!|$&
      When your with me baby the skies are all blue, for all my life!|$&
      i call this one, the camp fire song song.
    .timerrand 1 2 .msg #  $($+($,$rand(1,$0)),2)
  }
}
 Respond  
Mtn64   -  Aug 13, 2011

Hmm.. tried flood control- Didnt work(am i suppose to put a on : to name?

 Respond  
Mtn64   -  Aug 13, 2011
 Edit: just realized your case 15 will message #kirby. I believe you meant to put $chan 

^^ hopefully i did the code thing right
Yes,thanks for pointing that out.
8ball thing, i know, I had no ideas what %variable and $rand was, so i decided to make one of these.
Next i shall be learning on how to point a random person out(hopefully it goes quick!) =D

 Respond  
napa182   -  Aug 13, 2011

you have on your on text event

on 1:TEXT:*!Rand*:$chan:{

few things wrong one you have it as a wildcard also you have $chan instead of #
maybe be do

on $*:TEXT:/^!Rand$/iS:#:{

then you hve the == numb. ie: 1.
you can fix that by taking out he . or by doing

Var %random = $+($r(1,15),.)

maybe add a flood pro to it as well
ie:

on $*:TEXT:/^!Rand$/iS:#:{
if (!%f) { inc -u5 %f 

you should also name your timers as someone my have a timer just called timer an it can over write it.
but yes another 8-ball variant type snippet. =/
eh whatever.....3/10

 Respond  
Matcou   -  Aug 13, 2011

I believe you are missing a closing bracket.
I also do not think the "%random == N." should have the period.
The way your on text is set up right now will trigger the script if "!rand" is anywhere in the message. If you want it to trigger on the message "!rand" only then remove the asterisks (they are wildcards)
You can optimize your code in many different ways, one being the use of text files (.txt) and the $read() function. Even if you do not use it for this specific snippet, it is good to know (/help $read).

Off topic: you mispelled appearance in your code.

Edit: just realized your case 15 will message #kirby. I believe you meant to put $chan

 Respond  
Jethro   -  Aug 13, 2011

God forbid, another 8-ball variant. lol We have lots and lots of such snippet already.

 Respond  
Mtn64   -  Aug 13, 2011

Suggestions? Welcome to my comment box! xD
Have fun with the script, or just suggest things.

 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.