mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2011
Posts: 2
N
Bowl of petunias
OP Offline
Bowl of petunias
N
Joined: Nov 2011
Posts: 2
I am new to mirc scripting so I think this is a pretty basic question. What I am trying to do seems really simple but google doesnt seem to be able to find any examples of how to do it posted online.

What I want to do is write out the list of users (the output of the /names #mychannel command) to a file. Is this possible?

Ideally I would like to make an alias that does this. I have seen how to write to a file but the thing I cannot figure out is how to get the /NAMES #mychannel output into a variable (which I could then pass to the /write command).

Thanks,

David

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Here's a basic example. Look up "/help raw events" and feel free to ask if you don't get the principle. smile
Code:
; custom alias "/writenames #channel"
alias writenames {
  ; request names list
  names $$1
  ; global variable storing the name of the channel
  set -en %writenames $1
}

; names reply
raw 353:*: { 
  ; reply is for the channel in question
  if ($3 == %writenames) {
    ; write names to file
    write names $+ $v1 $+ .txt $4-
    ; halt default display
    haltdef
  }
}

; 'end of names' reply
raw 366:*: { 
  ; reply is for the channel in question
  if ($2 == %writenames) {
    unset %writenames
    haltdef
  }
}

Joined: Nov 2011
Posts: 2
N
Bowl of petunias
OP Offline
Bowl of petunias
N
Joined: Nov 2011
Posts: 2
Thank you so much!! You have done me a huge favor posting this script. Now I understand the model of how this works (sending the request after you have set up an event handler to catch the response and process it when it eventually comes back, asynchronously).

You are my hero smile


Link Copied to Clipboard