mIRC Home    About    Download    Register    News    Help

Print Thread
#225894 12/09/10 07:10 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
hi all,

In the script i use is an "on input" event to display and send what i write.
to send and display what i write i use
Code:
.msg $1- | echo -i26 14 $+ $timestamp $+  $str( ,$calc(15 - $len($nick($chan,$me).pnick))) $+( ,$me,) $+ : $2-

I changed the display of the "on text, action, nick, topic, etc" events the same way with /echo to show the same as the "on input".

Now comes my problem.
The /msg to a nick sends a message to the nick without openening a query window.
The /msg to a channel sends a message to a channel.
When i use these commands the output is default with mircs output.
Code:
 -> *nickname or channelname* how are you doing?

What i want is the output to be the way i have the other things displayed aswell like this.
Code:
 Send: -> *nickname or channelname* how are you doing?

So i tryed to make an msg alias but that results into not sending and only displaying what i write to sending once and displaying twice what i write.

I tryed this:
Code:
msg { echo -i27 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-

What results in only displaying what i write and not sending.
Code:
msg { .msg $1- | echo -i27 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-

What results in sending what i write but also displaying what i write twice.
What i want is to send what i write and display the echo but doesn't mess up up the on input event.
What raises questionmarks here is the fact that when there is no msg alias the output of the /msg command is default like:
Code:
 -> *nickname or channelname* how are you doing?

But after creating an msg alias i get 2 lines in my screen.
First line is the display of the msg alias.
Second line is the display of the "on input" event.
How to stop the "on input" display on the /msg command but leave it intact when i normaly type.

i hope you understand my problem because i find it hard to explain and i hope someone has the answer to my prolem.

greetz,



RiMaJoy #225896 12/09/10 07:33 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm going to try to explain this in a list format.
1) You have an alias called msg
2) mIRC has a built in command called msg
3) Your alias has the command of the same name inside it.
4) mIRC will, by default, use the alias rather than the command when the matching name is called.
5) Thus, when mIRC sees the .msg in your msg alias, it tries to call the alias again.
6) To get around this, you can specify the ! in front of the command. This tells mIRC to use the command rather than the alias.
7) Thus I'm recommending your alias become
Code:
msg { .!msg $1- | echo -i27 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-

8) An alternative method is to use the /raw privmsg command. I'm not familiar with this, thus I won't give you an example, but I have seen it used.

This is the best I can come up with based upon my understanding from your post. Hope it helps.

RusselB #225898 12/09/10 08:26 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
Thanks.
it did it for the /msg nickname command.
but on the /msg channelname command it does send the line to the channel but.... when i'm on that channel i don't see the echo in there.
I only see the echo in the active window.
How do i echo it to the active window and to the window it is send to if i'm there?

RiMaJoy #225962 14/09/10 10:55 AM
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: RiMaJoy
Thanks.
it did it for the /msg nickname command.
but on the /msg channelname command it does send the line to the channel but.... when i'm on that channel i don't see the echo in there.
I only see the echo in the active window.
How do i echo it to the active window and to the window it is send to if i'm there?


I hope you don't mind me turning it multiline, since it'll get messy otherwise.

Code:
msg {
  ;Display the line in the active window.
  echo -ai27 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-

  ;Check if you are on $1. Since you can only be on channels, this automatically checks if it's a channel.
  if $me ison $1 && $1 != $active {
    echo -i27 $1 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-
  }

  ;Check if there is already an open query window with the target. If so, also display it in the query window.
  elseif $query($1) && $1 != $active {
    echo -i27 $1 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-
  }

  ;Send the actual message.
  .!msg $1-
}


I added a little bit of code that IF you have a query window open, the message will also be displayed in that query window. It will not create the query window if it doesn't exist. If you don't want that, you can simply cut that ELSEIF block out of the code.

The "$1 != $active" makes sure that you are not displaying it twice in the same window.

Note that both IF's result in the same action, which allows you to write the code like this as well:


Code:
msg {
  echo -ai27 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-
  if ($me ison $1 || $query($1)) && $1 != $active {
    echo -i27 $1 14 $+ $timestamp  $str( ,$calc(9 - $len(Send))) Send $+ : $1-
  }
  .!msg $1-
}


Learning something new every day.

Link Copied to Clipboard