mIRC Home    About    Download    Register    News    Help

Print Thread
#273106 22/01/25 12:14 AM
Joined: Nov 2017
Posts: 21
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2017
Posts: 21
I wish to use the /LIST command in a script and capture the channels list for my own purposes. Easy enough to do in script. The issue I have is that the "Channels List" window is still created and I also get a beep even though I have captured numerics 321, 322 and 323 and issued a halt.

Can anyone give me a hint. (I've probably missed something obvious.)

Sample code:

Code
; start of list channels
raw 321:*: {
  halt
}

; channel name 
raw 322:*: {
  echo -a $2
  halt
}

; end of list channels
raw 323:*: {
  halt
}

goblin58 #273111 23/01/25 05:56 AM
Joined: Dec 2002
Posts: 255
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 255
I'm not sure if it's possible to use a raw event (321) to halt or haltdef (prevent default) or even use the ^ event prefix with a raw... Even doing a /raw list to avoid the in-built /list alias brings up the window...

What you can do however, is use a parseline event to re-write the incoming line effectively fooling mIRC into not seeing the server-sent raw event in the first place. I would however advise making some kind of state check like: a variable, remote #group, etc... to enable/disable this functionality if you do wish for the /list command to still be able to pop up.

This will break mIRC's "/list" command so instead of using "/list" instead send it as a "/raw list". It WILL work the first time (with the in-built /list), however since we removed these events mIRC never recognizes the list was successful, and subsequent requests for "/list" will result in an info line in your status:
* /list: listing in progress...

Keep in mind this will also prevent a RAW 321:*: (also 322 and 323) from ever triggering (we effectively expunged this from the inbound queue by replacing it with $null) so you may need to do something else if you're relying on this event to start working with the list data.

Here is a small example script to mimic the functionality making use of the custom signal event and also preventing the channel list window, and echoing into the status window instead using a custom alias named "MyCustomList", also taking advantage of groups to enable/disable this functionality allowing mIRC's regular "/list" to still function.

Code
;== Generic alias name to activate the group event enabling parseline to replace raw 321-323 and trigger a signal.
alias MyCustomList {
  .enable #CustomRaw
  .raw list
}

#CustomRaw off
on *:PARSELINE:in:*: {
  ;== Make a variable of the incoming RAW IRC Event line.
  var %pl = $parseline

  ;== UTF-Decode line if applicable
  if ($parseutf) { %pl = $utfdecode(%pl) }

  ;== Test if the line starts with ":<server> 321"
  if ($regex(%pl,$+(/^:,$server,\s32[1-3]/))) {

    ;== Replace the line mIRC's about to process with a blank one
    .parseline -itu0 $null

    ;== Create a signal event called CustomRaw with the data from the event
    .signal CustomRaw $gettok(%pl,2-,32)

    ;== Return to allow mIRC to process this new line
    return 
  }
}
#CustomRaw end

on *:SIGNAL:CustomRaw: {
  if ($1 = 321) {
    echo -s *** Listing Channels
  }
  elseif ($1 = 322) {
    echo -s $3-
  }
  elseif ($1 = 323) {
    echo -s *** End of /List

    ;== Disable customraw group so that /list will work.
    .disable #CustomRaw
  }
}

Command:
/MyCustomList

Output:
Code
*** Listing Channels
#Talon 1 :[+nt]
*** End of /List

goblin58 #273112 23/01/25 05:55 PM
Joined: Aug 2023
Posts: 8
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Joined: Aug 2023
Posts: 8
Originally Posted by goblin58
Code
; start of list channels
raw 321:*: {
  halt
}

; channel name 
raw 322:*: {
  echo -a $2
  halt
}

; end of list channels
raw 323:*: {
  halt
}

when you're working wih events, you can use ^ to deal with what is returned before mIRC handles it

raw ^321:*: and - before the end of your commands - use haltdef to halt what mIRC is going to do, as the use of ^ is pre-emptive
i think


incorrigo syx
- text based virtual world -
Talon #273114 23/01/25 09:31 PM
Joined: Nov 2017
Posts: 21
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2017
Posts: 21
Thanks so much Talon. That code suits my purposes perfectly. I was not aware of $parseline.


Link Copied to Clipboard