mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 3
N
NoKtRnL Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Dec 2002
Posts: 3
I'm writing a script to make the /MAP command available to me on my Bahamut server.

I wrote the script to get the links, save the buffer of the links window to a file, run the file, then close the links window.

If this part was successful, i would then change it to saving the buffer and echoing the lines back to be the same was as it would look when doing a /MAP on another IRCd, for example, then Unreal IRCd.

Heres my script so far. This is the one i described first.

alias MAP { /links
.savebuf 1-100000 @Links $mircdir $+ \TEMP\ $+ ServLinks.TXT
.run $mircdir $+ \TEMP\ $+ ServLinks.TXT
.close @ Links
}

This is the error I get.
-
* /savebuf: invalid window (line 2, NetMap.MRC)
-

I figure that all I need is the window type. I'm going to try manipulating the raw number for it to see if it will work that way instead.

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
You can't /savebuf from the Links window, you will need to create a custom window, use raws (364 and 365) to get the text into the window, and then savebuf that from window. Also the 1-100000 isn't necessary.

Joined: Dec 2002
Posts: 3
N
NoKtRnL Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Dec 2002
Posts: 3
Yeah, I figured that out by trial and error. Thanks for confirmation though.

I got it working with raws now. While i waited for replies i went on and used raws. Ive been fine tuning it so the output is cleaner now. Heres the Output.

[Map] 1 - Haven.us.GeekIRC.net
[Map] 2 -- Stoned.se.GeekIRC.net
[Map] 2 -- Services.GeekIRC.net
[Map] 1 - Velocity.us.GeekIRC.net
[Map] 0 Visionz.us.GeekIRC.net
[Map] End Of Network Map

Heres the script itself.

raw 364:*:{ haltdef { if ($4 == 5) { echo -a  $+ %col1 $+ [ $+ %col2 $+ Map $+ %col1 $+ ] $+ %col1 $4 ----- $2 | halt }
if ($4 == 4) { echo -a  $+ %col1 $+ [ $+ %col2 $+ Map $+ %col1 $+ ] $+ %col1 $4 ---- $2 | halt }
if ($4 == 3) { echo -a  $+ %col1 $+ [ $+ %col2 $+ Map $+ %col1 $+ ] $+ %col1 $4 --- $2 | halt }
if ($4 == 2) { echo -a  $+ %col1 $+ [ $+ %col2 $+ Map $+ %col1 $+ ] $+ %col1 $4 -- $2 | halt }
if ($4 == 1) { echo -a  $+ %col1 $+ [ $+ %col2 $+ Map $+ %col1 $+ ] $+ %col1 $4 - $2 | halt }
if ($4 == 0) { echo -a  $+ %col1 $+ [ $+ %col2 $+ Map $+ %col1 $+ ] $+ %col1 $4 $2 | halt }
if else { halt }
}
}

I wanted to put them in order so i tried that long script. It didn't turn out like i expected, so im going to keep trying.

Thanks.

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
[EDITED: added the comment lines for a fuller explanation] If I understand your question correctly, perhaps the following code might help you on your way:
Code:

; The /map command replaces (temporarily) the /links command so we can reroute the data.
;
alias map {
  ;
  ;  If @Links is already open, close it
  ;
  if ($window(@Links)) window -c @Links
  ;
  ;  Create the @Links window
  ;
  window -k @Links
  ;
  ;  Title it to show the network the servers are on
  ;
  titlebar @Links on $network
  ;
  ;  Turn on the group that will catch the /links 
  ;
  .enable #MyScript.Links
  ;
  ;  Send the /links command to the server without letting mIRC process the command.
  ;
  .raw links
}
#MyScript.Links off
;
;  Numeric 364 captures the actual server data from the /links command.
  ;
raw 364:*:{
  ;
  ;  See if we're asking for a /map rather than a /links
  ;
  if ($window(@Links)) {
    ;
    ;  Since we will receive the list of links backwards, we will have to insert each line at the top of the 
    ;  window (line 1), thus: /iline @Links 1 ... the rest of this command line is just adding the formatting
    ;  to make is basically resemble a normal mIRC /LINKS display.
    ;  - colorCode $+ $calc(numberOfHops + 1) gives us the color...the + 1 is so we don't use color 0 
    ;    for the server we're connected to (0 hops)
    ;  - $str(nonBreakingSpace,numberOfHops) indents things nicely based on hopcount
    ;  - $2 is the server name ($3 is the server it's connected to - not used in this example)
    ;  - [numberOfHops hops] ($4 is numberOfHops)
    ;  - $5- is the server description.
    ;
    iline @Links 1 $+($chr(3),$calc($4 + 1),$str($chr(160),$4),$2 [,$4 hops,],$chr(15)) $5-
    ;
    ;  Now just halt the default text.
    ;
    halt
  }
}
;
;  Numeric 365 is the "End of /LINKS list." message, letting us know no more data is coming.
 ;
raw 365:*:{
  ;
  ; Make sure we're supposed to be handling this event.
  ;
  if ($window(@Links)) {
    ;
    ;  Save the custom @Links window to a file.
    ;
    .savebuf @Links $mircdirTEMP\ServLinks.TXT
    ;
    ;  Turn off the group so a normal /links will work again.
    ;
    .disable #MyScript.Links
    ;
    ;  Now just halt the default text.
    ;
    halt
  }
}
#MyScript.Links end
NOTE: This not quite the same /LINKS list that mIRC generates. The above code does not account for which server is linked to which server, it just adds lines as it gets them in. You would have to check $3 to see which server $2 is linked to and adjust where the line should be inserted (which I did not do in the interest of the example's brevity).


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Dec 2002
Posts: 3
N
NoKtRnL Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Dec 2002
Posts: 3
Oh My God.

That code makes my head spin lol.

Can you explain that to me?

Thanks


Link Copied to Clipboard