mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2009
Posts: 1
W
Wendya Offline OP
Mostly harmless
OP Offline
Mostly harmless
W
Joined: Apr 2009
Posts: 1
Hello to all,
I'm a beginner, so apologies in advance to all if this is a wrong section of the forum, but I didn't find "a newbie section", and I think this isn't generally covered in the help section.
I have a little problem, I'm sure that experienced users can type the code needed in their sleep smile
What I'm trying to do- I would like to make a little basic script:
when a specified user types a specified text, I would like a message to appear, visible to all users on the channel.
For example, let's say that the user name is XYZ, and that he says Hello, I would like to automatically say Hello back (channel name is #test).

Is this correct:

on 1:TEXT:Hello:#test:/notice XYZ Hello,XYZ

I have found various tutorials online, but I would appreciate more if somebody could just explain me, black and white smile

Thanks in advance!

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Your code will only respond to the word 'hello' but not as Wendya, hello or hello followed by other words. So you need to make it as such:
Code:
on *:TEXT:*Hello*:#:.notice $nick Hello

the *hello* makes it wildcard, matching anywhere in a sentence that consists of the wrod hello.
And the $nick is the person who says hello to you.

Last edited by Tomao; 05/04/09 07:23 PM.
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Your code doesn't respond to specific nickname. Also it sends a notice which is only seen by that nickname.

To further clarify Tomao, the * symbolizes wildcard search. What this means is it represents anything like a wild card can represent any card in the deck.

What you are doing is seeing if your COMPARISON is true. Your comparison here is to see if Hello is in the text and from a specified person.
Quote:

*Hello
This will match $True if there is Hello with any text in front of it.

Hello*
This will match $true if Hello is the first word in a string of text.

*Hello*

This will match $true if Hello is between strings of text.

Hello *

This will match $true if Hello is the first word and there is a space between it and the rest of the text string.

Quote:
Using pseudo-code, I will explain your desire. (Pseudo-code is helpfull to conceptualize your what you want to create. I think in pseudo code.)

First of all, you are waiting for TEXT so this is a TEXT event.
/help on text

on 1:text:#test:{

;You are looking for 2 comparisons.
the word Hello
and a specific nickname

if (Hello isin Text) and ($nick = specific nickname) msg $chan Hello $nick
}
/msg sends message
$chan is the channel name the text event occured in.
$nick is the nickname that caused the text event.

I hope that isn't too confusing. Please ask many questions.

You can either write in the nickname you want it to respond to, or you can keep nicknames in a list. mIRC comes with the ability to easily create user lists.

/help /auser
/help /ruser

Code:
menu nicklist {
Add User (respond):auser respond $$1
Remove User (respond):ruser respond $$1
}
;$$1 is the nickname in a nicklist popup.


'/auser respond $$1' adds $$1(nickname) to a user list we named "respond".

Now we can say:

Code:
on respond:text:*Hello*:#:{
  msg $chan Hello $nick
}


This will only respond to people in the 'respond' user list.

Any Questions?


Link Copied to Clipboard