mIRC Home    About    Download    Register    News    Help

Print Thread
#130909 23/09/05 04:21 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
this is a stupid question. but i press ALT-R in mIRC, and type..

on 1:TEXT:hello*:#./msg $chan Hey nice to see you again!! $chan $

in the variables.. is that the right place? but when i open another mIRC and go in room wiv a diff name, the mirc im on has the same code so it dont work and its doing my head in.

any help ?

#130910 23/09/05 04:30 PM
Joined: Mar 2005
Posts: 74
K
Babel fish
Offline
Babel fish
K
Joined: Mar 2005
Posts: 74
Code:
 

on *:text:hello :* [i]channel[/i] :{
/msg $chan Hey nice to see you again!! $chan $

}
This this should work



 

#130911 23/09/05 04:43 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
Nope still dont work :-/

#130912 23/09/05 04:46 PM
Joined: Jun 2005
Posts: 9
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2005
Posts: 9
Code:
on 1:TEXT:hello*:#:msg $chan Hey nice to see you again!! $chan $  

You forgot ":" after #

#130913 23/09/05 04:52 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
Lol, nope it still wont work :-/

do i put it in variables or user?

#130914 23/09/05 04:54 PM
Joined: Jun 2005
Posts: 9
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2005
Posts: 9
You have to past it in remote.

#130915 23/09/05 04:57 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
ok it works but it says...

<reece> Hey nice to see you again!! #reece $

cant u get rid of the #reece by removing the last $chan $

yeh i done it, thanks.

Last edited by reece1312; 23/09/05 04:59 PM.
#130916 23/09/05 05:00 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
on 1:TEXT:hello*:#:msg $chan Hey nice to see you again $nick !!


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#130917 23/09/05 05:01 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
thanks.

is there any i can do so they say hello, it says hi how are you?

they reply fine thank / im ok / im good / good / great and then i reply good good or glad to hear it?

#130918 23/09/05 05:18 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You forgot a : after the # in your original code. Also, as mentioned, you put this in Remotes, not Variables. You normally don't put anything directly into variables.

on *:text:hello*:#: { msg $chan hello, $nick $+ . }

There's an example of a hello responder.

Heh... took me so long after starting to post before I finally ended up finishing the post that it was already replied to a lot. laugh

Anyhow, for any / commands, you do an alias. Either:

In Remotes:
Code:
alias hi {
  msg $active Hello.
}


or in Aliases:
Code:
hi {
  msg $active Hello.
}


Remember that in aliases, you may or may not have a $nick or a $chan. For example, if you type the alias in a query window, there isn't a $chan. If you type it in a channel window, there isn't a $nick. That's why $active is used.

Note that you could easily make it so you can include a nick yourself:

In Remotes:
Code:
alias hi {
  if ($1 != $null) {
    msg $active Hello, $1 $+ .
  }
  else {
    msg $active Hello everyone.
  }
}


You can type /hi Riamus and it will msg the active window with Hello, Riamus. Or, you can just type /hi and it will msg the active window with Hello everyone.

Last edited by Riamus2; 23/09/05 05:29 PM.

Invision Support
#Invision on irc.irchighway.net
#130919 23/09/05 05:24 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
yup thanks i got it going now.

can u do it as i asked above? or is it not possible?

#130920 23/09/05 05:50 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Hm... I didn't read that well enough. Thought you asked about using stuff like /hi. Anyhow, regex may be the best way to do this, but I'm not that good at it and since you're learning, it's better to stick to not using regex for now...

Code:
on *:text:*:#: {
  if ($1 == hi || $1 == hello || $1 == hey) {
    msg $nick Hello, how are you?
    set -u20 $+(%,hello.,$nick) 1
  }
  elseif ($+(%,hello.,$nick) != $null) {
    var %words = fine ok okay good
    if ($istok(%words,$1,32) || ($istok(%words,$2,32) &amp;&amp; $1 == I'm) || ($istok(%words,$2,32) &amp;&amp; $1 = Im) || ($istok(%words,$3,32) &amp;&amp; $1-2 == I am)) {
      msg $chan That's good.
    }
  }
}


Basically, here's an explanation:

The first IF will happen if someone says Hi or Hey or Hello. Note that I didn't include punctuation in the check, this is just an example, anyhow. The set will set a variable with their nick in the variable name to a value (any value is fine) and it will unset it (-u) in 20 seconds.

The second IF will happen if the variable with the nick's name is set to something and the person says one of the things in the %words variable. This basically means that in that 20 seconds that the variable is set, if the person replies with one of the words, the script responds. If they take more than 20 seconds, then it won't respond. By including the nick in the variable name, it lets you identify who is talking if they said hi previously.

The while loop can be seen with /help /while.

The $istok section is a bit more advanced, but I think it's still easier to understand than trying to explain regex at your current scripting level.

/help tokens

$istok lets you find out if there is a specific token in the text. A token is something separated by a specific character. Words in a sentence are tokens that are separated by spaces.

So:

$istok(text,token to look for,character between tokens)

$chr(32) is a space and $1 is the text and since we put %c as the current word in the list of words (using $gettok), then $istok($1,%c,32) is used.

The way it is set up, it will trigger if a person wrote any of the %words as the first word of the reply, or they wrong I'm followed by any of the %words, or they wrong Im followed by any of the %words, or they wrong I am followed by any of the %words.

This isn't really a "simple" script, but when you're trying to catch multiple ways someone could respond rather than only using a specific trigger, it takes more effort.

EDIT: I pasted the last $istok and forgot to change which "word" was needed... it's fixed now.

EDIT2: Ok, I was being stupid... I've edited it so that it's better. No need for the while loop... I was doing it backwards of the easy way. laugh

By changing it so that we're looking for word $1 or $2 or $3 inside %words, it's easier. So, $istok(%words,word,32). It's the reverse of how I was doing it. I just wasn't thinking earlier. You can ignore the comments above about the loop and how I did $istok as neither are like that now.

Last edited by Riamus2; 23/09/05 06:06 PM.

Invision Support
#Invision on irc.irchighway.net
#130921 23/09/05 05:59 PM
Joined: Sep 2005
Posts: 44
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2005
Posts: 44
thanks alot mate I'll try it later as im of now.

i actualy understand that for a change, lol :-)

thanks for your help, Reece.


Link Copied to Clipboard