Nos commented on a Page, Help coding Random Reply mIRC  -  Apr 02, 2014
 on *:TEXT:Hello:#:{
  var %randnumber = $rand(1,3)
  if (%randnumber == 1) msg $chan Hey
  if (%randnumber == 2) msg $chan hey
  if (%randnumber == 3) msg $chan hey
} 
Exuviax  -  Apr 03, 2014

on *:TEXT:!roulette:#: {
if ($nick !isop #) {
var %randmods = $rand(1,3)
if (%randmods == 1) msg $chan Roulette click!...Empty...You live to see another day $nick
if (%randmods == 2) msg $chan BANG! ... You were shot but live. There must be secert powers in your mod armor $nick
if (%randmods == 3) msg $chan BANG! ... The bullet missed, you only have your born moderation powers to thank $nick
}
else { RETURN }
}

So I am making a Roulette system, and I want the Mods to have different replies than the non-mods. I am lost again.

EDIT:

I went back and removed the ! from Roulette and now it works, is there something about having ! that wreaks the code?

Meta  -  Apr 03, 2014

There shouldn't be. You were typing !roulette and what would happen, if anything?

Nos  -  Apr 03, 2014

If you do not want ops to use the command "!roulette"

 on *:TEXT:!roulette:#:{
  if ($nick !isop $chan) {
    var %randmods = $rand(1,3)
    if (%randmods == 1) msg $chan Roulette click!...Empty...You live to see another day $nick 
    if (%randmods == 2) msg $chan BANG! ... You were shot but live. There must be secert powers in your mod armor $nick 
    if (%randmods == 3) msg $chan BANG! ... The bullet missed, you only have your born moderation powers to thank $nick 
  }
  else {
    msg $chan sorry you can not use the command
  }
} 

:D

Exuviax  -  Apr 03, 2014

It literally just will not respond with ! in front of the code...

Nos  -  Apr 03, 2014
  • yup *
Nos  -  Apr 03, 2014

as an example
[i] <@Nos> !roulette

sorry you can not use the command * Nos sets mode: -o Nos !roulette BANG! ... The bullet missed, you only have your born moderation powers to thank Nos [/i]
Nos  -  Apr 04, 2014

let no lot line

 on *:TEXT:!roulette:#:{
  if ($nick !isop $chan) {
    var %randmods = Roulette click!...Empty...You live to see another day $nick $+ |BANG! ... You were shot but live. There must be secert powers in your mod armor $nick $+ |BANG! ... The bullet missed, you only have your born moderation powers to thank $nick 
    msg $chan $gettok(%randmods,$rand(1,3),124)
  }
} 
pony_Buzzen  -  Apr 05, 2014

on *:TEXT:Hello:#:{
.set %msg.nick $snick($active,1) | .set %msg.chan $active $chan | /set %RandomAnswer $rand(1,8)
if (%RandomAnswer == 1) { msg $active %msn.chan Hello %msg.nick :) }
if (%RandomAnswer == 2) { msg $active %msn.chan Hi There %msg.nick :p }
if (%RandomAnswer == 3) { msg $active %msn.chan Hey %msg.nick :0 HIIIIIII Ya }
if (%RandomAnswer == 4) { msg $active %msn.chan Hello %msg.nick :P how you doing }
if (%RandomAnswer == 5) { msg $active %msn.chan :) %msg.nick hi there :D }
if (%RandomAnswer == 6) { msg $active %msn.chan Hey %msg.nick Welcome back :p }
if (%RandomAnswer == 7) { msg $active %msn.chan Hey Good to see ya %msg.nick how you doing :) }
if (%RandomAnswer == 8) { msg $active %msn.chan Were ya been %msg.nick Hi there :p }
}

Nos  -  Apr 05, 2014
  • @pony_Buzzen : you should use: msg $chan *
Nos  -  Apr 05, 2014
 on *:TEXT:Hello:#:{
  .set %msg.nick $nick | .set %msg.chan $chan | .set %RandomAnswer $rand(1,8)
  if (%RandomAnswer == 1) { msg %msg.chan Hello %msg.nick :) }
  if (%RandomAnswer == 2) { msg %msg.chan Hi There %msg.nick :p }
  if (%RandomAnswer == 3) { msg %msg.chan Hey %msg.nick :0 HIIIIIII Ya }
  if (%RandomAnswer == 4) { msg %msg.chan Hello %msg.nick :P how you doing }
  if (%RandomAnswer == 5) { msg %msg.chan :) %msg.nick hi there :D }
  if (%RandomAnswer == 6) { msg %msg.chan Hey %msg.nick Welcome back :p } 
  if (%RandomAnswer == 7) { msg %msg.chan Hey Good to see ya %msg.nick how you doing :) }
  if (%RandomAnswer == 8) { msg %msg.chan Were ya been %msg.nick Hi there :p }
} 

:D

Meta  -  Apr 05, 2014

One small note first off: elseif should be used after the first if, otherwise, mIRC will check every condition, even if one has already worked.

Exuviax - Do you have any other on TEXT events above the roulette one? Particularly, any like on :TEXT:!:#: ? There's nothing about using an ! that would cause the script to not work, but having a non-specific event like that, could.

pony_Buzzen - nos is right: $active returns the name of the currently active window... Which means, for example,that if somebody triggers your script in #stuff, and #what is your currently active window, you'll msg #what with the response.

But nos. Why use variables for $nick and $chan? And why global o_O

Another possible way to go about something like this, btw, would be to just put the responses - one per line - in a plain text file, and use $read() to return a random line from that file (which it will by default)

Example: Say this is the content of a file called "goodblankresponses.txt" in your $mircdir:

Good morning!
Good afternoon!
Good evening!
Good bye.
Good going.
Good game.
Good riddance!
Good thing proicons beat me to the $!read() suggestion.

Then you could just simply create a script like:

on *:TEXT:!Good:#:msg # $read(goodblankresponses.txt)

Which when triggered, would respond with one of the lines from that file.

Nos  -  Apr 05, 2014

@Meta : I think similar to

on *:TEXT:!Good:#:{
  goto $rand(1,3)
  :1
  msg $chan blablabla
  halt
  :2
  msg $chan blablabla
  halt
  :3
  msg $chan blablabla
  halt
} 
pony_Buzzen  -  May 07, 2014

i understand that . but he reason why i use msg $active and set channel is if on more then one rooms it will msg the channel were said word was , and not the my own active channel , if im talking else were . I also use the read short commands
.set %msg.nick $snick($active,1) | .set %msg.chan $active $chan

But after looking at your coding closer , i can see what you mean , but at the same time , on buzzen mine works now and it aint broke dont fix it LOL
thank you for the reply
I will remeber your advice on my next release

Sign in to comment

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.