mIRC Home    About    Download    Register    News    Help

Print Thread
#231839 06/05/11 02:44 PM
Joined: Dec 2005
Posts: 15
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2005
Posts: 15
Hi, long time dindt see you folks, now im back on mirc rooms again and i wanna make some changes to my script, what i need is:

By example, if somebody write on channel some word or phrase, i instantly respond with something already programmed.

I want to have a file with a personal list of words or phrases.

By example if somebody write "Nirvana songs", i instantly respond with "SMells like teen spirit is the best" or maybe with 2 seconds of diference.

It is possible do this ? Thanks.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Yes there are a few different ways to do this. Many of us started out in the same place with text reply scripts.

/help On Text

You can either keep a list and reference it, or just hardcode the responses. I would suggest just to hard code the responses.

on *:text:*nirvana songs*:#:msg # Smells like teen spirit.

This will look for text that has "nirvana songs" in it. This could be, "I like Nirvana songs." Or "Nirvana songs suck!" You will notice the * before and after Nivana songs. This means a wildcard search. Wildcard means anything will match it which is why you can have text around the words Nirvana songs and it matches.

If you had:

on *:text:Nirvana songs:#:msg # Smells like teen spirit.

This would only reply if the person typed "Nirvana songs" since there is no wildcard before or after saying the comparison is true if there is any text before or after. Also spaces around the wildcard is important.

Nirvana * is different than Nirvana*.

Nirvana * won't be true if they type "Nirvanasucks" because there is a space after the word Nirvana in your search.

Once the comparison is deemed TRUE, then it performs the command:

/msg $chan Smells like teen spirit.
This messages the channel the text is seen in.

So that is a basic text response and where I think you should start. But things to consider about text responses is protecting yourself from flooding. What happens when someone types that word over and over very fast? Your script will try to respond to everyone of them which can cause you to flood out for trying to send out too many responses quickly. There are easy ways to handle this where you just count the number of times someone triggers your text event and say if its more than twice to halt, or something like that.

We can get to that if you like, but you should have a basic understanding of the code I showed above first. Ask questions!

Another thing to look at is being able to nest more than one text response in a single text event. Again, you should start with the basic code I showed you above, but ...

/help if then else

Code:
on *:text:*:#:{
;the wildcard for the search string means any text will be TRUE

  if ($1 = Nirvana) msg # this
  elseif ($1-2 = Nirvana Sucks) msg # this
  elseif (Nirvana* iswm $1-) msg # this
}

$1 is the first group of text before a space. $2 is the second word, etc. $1-2 means words 1 and 2. $1- means words 1 and everything that follows. $2- is the 2nd word and everything that follows.

All operators are documented in the help file, like iswm.



Joined: Dec 2005
Posts: 15
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2005
Posts: 15
Thanks for the answer, i'be tryng to do what u tell me but it doesnt work and sometimes i receive an error on Status, the error said something like that "Variable ON no recognized", so what am i doing wrong ?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It sounds like you might be missing a closing } in your script before the on text event that was shown to you. Try pasting your script here and someone can find that error for you. Please put the script inside the CODE tags. To do that, paste it here and then highlight it and click the # button above your post.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard