mIRC Home    About    Download    Register    News    Help

Print Thread
#138005 23/12/05 01:07 AM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
I was tring to make a script that will msg a chan if the name contains a wild card. The problem is I cant figure out how to get it to work.
Code:
on *:text:!msg off:*: { 
  timermsg off
  msg $chan Msg off
}
on *:text:!msg on:*: { 
  $+(timer,msg) 0 30 msg 
  msg $chan Msg on
}
alias msg {
  if (*help isin $chan) msg $chan testing
}


I started to think that i would need to use variables but not sure. Thanks for any help

#138006 23/12/05 01:18 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
First thing, it's a bad idea to make an alias "msg", as that will override the default msg command, which isn't a good idea unless you absolutely know what you're doing.

Second, I can't really help you because... you don't make much sense to me.

You want to message something to a channel, but only if the channel contains an asterisk "*" in it? And when exactly do you want to message this, like in what event?

Elaborate please. Help us help you.


Gone.
#138007 23/12/05 01:25 AM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
what i mean by *help is there are different help rooms. So if any of the rooms that I am in has help in the name I want it to msg that chan. As far as when, I was hoping to use timer for that. What I came up with is to create an alias that checks to see if the room im in has help in the name, and if it does msg it. Then set the timer to /timermsg 0 30 alias. That was the best way I knew how to do it.

#138008 23/12/05 01:26 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Same comment as in your other thread: isin doesnt accept wildcards, you should use:

if (help isin $chan)

or

if (*help* iswm $chan)

Btw, $chan will evaluate to whatever channel is active when the timer triggers, which could be any chan.


Gone.
#138009 23/12/05 01:45 AM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
thanks for the wild card info, it will work when i am in that room as you said. How can I get it to check all the chans that I am on? That is my problem. I was thinking that you would use a variable but could not figure it out.

#138010 23/12/05 01:51 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If you want to check all channels that you are in on a certain network, you can loop through $comchan.

/help $comchan

I say $comchan and not $chan, as $chan doesn't make a distinction between open channels, and channel windows that you haven't rejoined after a reconnect.

I don't know if you know how to do loops in mIRC but it would be something like this:

var %i = 1
while ($comchan($me,%i)) {
echo -a Chan %i - $ifmatch
inc %i
}

or

var %i = 1, %ii = $comchan($me,0)
while (%i <= %ii) {
echo -a Chan %i - $comchan($me,%i)
inc %i
}

var %i = $comchan($me,0)
while (%i) {
echo -a $comchan($me,%i)
dec %i
}

etc. there are a couple more variations possible but you get the picture.

You could also check with $dde, but that has some drawbacks, that make it not worth using it.


Gone.
#138011 23/12/05 02:18 AM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
Thank you fiberoptics! I understand it now and got it to work. I do have one more question tho. After look at the help file I wanted to use a variable for the timer. I used
Code:
on *:text:!msgtime*:*: {
  set %msgtime $2
}
  

then this for the timer
Code:
on *:text:!msg on:*: { 
  $+(timer,helpmsg) 0 $var(%msgtime) msghelp 
  msg $chan Msg on
}
  

Ok i figured this out but it set the delay to 1 sec. Not sure what I did.

Last edited by truguce; 23/12/05 02:30 AM.

Link Copied to Clipboard