mIRC Homepage
Posted By: D_T Responding to a word, but with conditions - 17/08/15 01:52 PM
Okay, i got a simple bot set up for entertainment value. It mostly greets and responds to a few random words. An example is this:

Code:
on *:text:CLONE!:#:{
  describe $chan gets the shotgun ready.
}


Currently, if anyone says "CLONE!" anywhere in a sentence, the bot responds. Now, what i want to do is add something that makes it so the script does not activate, or responds with something else, if a another specific word is in the sentence. Example: someone says "I'M A CLONE!" and I want the word "I'M' to be the phrase that triggers either a non-response or a secondary response.

I'm sure an If or Else If belongs in there somewhere, but not sure how to specify where the script should find the secondary word(s).
Posted By: Wims Re: Responding to a word, but with conditions - 17/08/15 03:29 PM
That code will only trigger if the full sentence is "CLONE!", not if it appears anywhere..
Your description of what you want to do is unclear.

You can use "if ($1 == I'm) to check if the first word is "I'm" (case insensitive, it would also work for I'M or i'M)

Code:
but not sure how to specify where the script should find the secondary word(s)
it depends on HOW you want to find that, you need to be more specific
Posted By: D_T Re: Responding to a word, but with conditions - 17/08/15 03:52 PM
okay, here's the code i really wanted to edit (censored)

Code:
on *:TEXT:*b**ch*:#: { msg $chan Give that b**ch a cannon! B**ches love cannons! }


this activates if the word is used anywhere in a sentence.

What I want to do is change it so if someone's name is used, the bot either doesn't respond or say something like "No cannon for [name]." or whatever. But it wouldn't necessarily be the first word in the sentence. Could be the first, 3rd, 10th, last or anywhere.
Posted By: sparta Re: Responding to a word, but with conditions - 17/08/15 04:04 PM
Dont know if this is what you looking for, but i give it a try.
Code:
on *:TEXT:*:#: {
 if ( b**ch isin $1- ) { msg $chan Give that b**ch a cannon! B**ches love cannons! }
}

Posted By: Wims Re: Responding to a word, but with conditions - 17/08/15 04:36 PM
This is quite not what he is looking for, did you even read what he said?
Posted By: D_T Re: Responding to a word, but with conditions - 17/08/15 04:47 PM
Originally Posted By: sparta
Dont know if this is what you looking for, but i give it a try.
Code:
on *:TEXT:*:#: {
 if ( b**ch isin $1- ) { msg $chan Give that b**ch a cannon! B**ches love cannons! }
}



that does the same thing my current script does as it sits. i tried adding an elseif line, but it doesn't seem to work, i think i've got the syntax wrong.

Code:
on *:TEXT:*:#: {
 if ( b**ch isin $1- ) { msg $chan Give that b**ch a cannon! B**ches love cannons! }
 elseif (Aneko isin $1- ) { msg $chan No cannon for her. }
}


b**ch activates the script, Aneko activates on it's own line, but not when the word b**ch is present. then the response to b**ch over rides it.

So right now, the sentence

"She is a b**ch"

results in the bot replying:

"Give that b**ch a cannon! B**ches love cannons! "

The sentence

"Aneko is a b**ch"

Gives the same result. What i'm looking to do is make it so the sentence

"Aneko is a b**ch"

Results in the bot replying with

"No cannon for her."
ehm sorry i deleted my 1st post i missread what you wanted it to do.
Try this:
Code:
on *:TEXT:*:#: {
if (*b---* iswm $1-) {
if (*Aneko* iswm $1-) {
msg $chan No Cannon For Her
}
elseif (*Aneko* !iswm $1-) {
msg $chan Give that b--- a cannon
}
}
}

smile
change ---- with the "bad" word :P
Posted By: D_T Re: Responding to a word, but with conditions - 17/08/15 06:11 PM
awesome, that worked. Thanks alot laugh
Your welcome smile Have Fun!!!
© mIRC Discussion Forums