mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 31
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2002
Posts: 31
ON TEXT and ON ACTION can be set to trigger from windows of all types with the * setting.

if the trigger happened to be in a channel, one can use $chan to perform actions aimed at that channel. however, if the trigger happens to be from a query window or dcc chat, $chan doesn't work. i'm not even sure if there is an equivalent for them.

ideally, there should be a single identifier (say: $source) that would identify the triggering window, regardless of type, so that, for example, we could direct echos or the like back to it easily without having to write a bunch of extra code for it. there should also be a simple identifier (say: $sourcetype) that would just return whether the source was a query window, channel window or whatever.

i'm using ON TEXT and ON ACTION primarily to redo the way dialogue in channels/chats is displayed, and while i've managed to get ON TEXT to work universally, it has some odd side effects (like everything going on in query windows being echoed to both the query window and the status window for some insane reason) and i haven't managed to get the ON ACTION to work at all in chat windows.

i have got to figure that other people are using similar (though probably better developed) workarounds.

ideally, i would love to have something like "/echo 4 $source Hello!" work identcally in ON TEXT and ON ACTION triggers from any server, channel, query and/or DCC chat window.


Last edited by Nekomusume; 14/10/03 08:39 AM.
Joined: Sep 2003
Posts: 15
R
Pikka bird
Offline
Pikka bird
R
Joined: Sep 2003
Posts: 15
/help $target

Joined: Dec 2002
Posts: 31
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2002
Posts: 31
nope. $target returns your own nick when triggered from query windows. (though i have no idea as to why)

this example (a simplified version of what i use ) works fine for channels, doesn't work in query windows.

on ^*:TEXT:*:*: {
echo 14 $target $nick - $$1-
haltdef
}

in order to make $target work in a query window, i had to do this:

on ^*:TEXT:*:*: {
if ( $target == $me ) { echo 14 $nick $nick said: $$1 }
if ( $chan != $null ) { echo 14 $target $nick - $nick said: $$1 }
haltdef
}

two lines to do what should be the work of one.

i haven't experiemented with DCC chats much, so i don't know what wierdnesses may be involved there. i do know that, for some reason, i have to use ON CHAT instead of ON TEXT requiring yet MORE redundant code <grr>

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
on ^*:TEXT:*:*: {
  echo 14 $iif($target ischan,$chan,$nick) $nick said: $$1
  haltdef
}

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
Code:
on ^*:TEXT:*:*: {
  echo 14 $iif($target == $me,$nick,$target) $nick said: $$1
  haltdef
}


is better, because you now only escape if it's a query instead of escaping if it's a channel and ELSE use the query... you should use $target as the default action


If it ain't broken, don't fix it!
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
This way is no better either, since $target can be @#mirc for example. Many ircds support @#channel, +#channel or even @+#channel as targets and $target is filled with these. So why not let mirc do the job of extracting a channel name (if there is one) for you?
Code:
echo 14 $iif(#,#,$nick) ....


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
In a query/dcc chat you can use $nick


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Joined: Dec 2002
Posts: 31
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2002
Posts: 31
so, can we all agree that a single identifier that did the job regardless of the source would be a good idea?

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
dcc chat is =$nick , not $nick


If it ain't broken, don't fix it!
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
I agree. I find a little pointless to do this job myself.


* cold edits his posts 24/7

Link Copied to Clipboard