mIRC Home    About    Download    Register    News    Help

Print Thread
Responding to a word, but with conditions #254566 17/08/15 01:52 PM
Joined: Aug 2015
Posts: 4
D
D_T Offline OP
Self-satisified door
OP Offline
Self-satisified door
D
Joined: Aug 2015
Posts: 4
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).

Re: Responding to a word, but with conditions [Re: D_T] #254567 17/08/15 03:29 PM
Joined: Jul 2006
Posts: 3,890
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,890
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Re: Responding to a word, but with conditions [Re: Wims] #254569 17/08/15 03:52 PM
Joined: Aug 2015
Posts: 4
D
D_T Offline OP
Self-satisified door
OP Offline
Self-satisified door
D
Joined: Aug 2015
Posts: 4
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.

Re: Responding to a word, but with conditions [Re: D_T] #254570 17/08/15 04:04 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
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! }
}



if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: Responding to a word, but with conditions [Re: sparta] #254571 17/08/15 04:36 PM
Joined: Jul 2006
Posts: 3,890
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,890
This is quite not what he is looking for, did you even read what he said?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Re: Responding to a word, but with conditions [Re: sparta] #254572 17/08/15 04:47 PM
Joined: Aug 2015
Posts: 4
D
D_T Offline OP
Self-satisified door
OP Offline
Self-satisified door
D
Joined: Aug 2015
Posts: 4
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."

Re: Responding to a word, but with conditions [Re: D_T] #254575 17/08/15 06:05 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
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

Last edited by OrFeAsGr; 17/08/15 06:05 PM.
Re: Responding to a word, but with conditions [Re: OrFeAsGr] #254576 17/08/15 06:11 PM
Joined: Aug 2015
Posts: 4
D
D_T Offline OP
Self-satisified door
OP Offline
Self-satisified door
D
Joined: Aug 2015
Posts: 4
awesome, that worked. Thanks alot laugh

Re: Responding to a word, but with conditions [Re: D_T] #254577 17/08/15 06:15 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Your welcome smile Have Fun!!!