mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2003
Posts: 12
A
Amleto Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
Hi, I'm frequently on a minimum of two servers and sometimes I send auth info or my join channels alias to the wrong server.

Is there a way to set up aliases so that the command will go to a specific server window, even if you're not in it?

Thanks

Joined: Apr 2004
Posts: 11
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
I think you could use socket to do that! Open a socket connect to your other server!

Joined: Dec 2003
Posts: 12
A
Amleto Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
sorry, I'm a noob at scripting, and know nothing of socks. could you give an example code?

thanks

Joined: Apr 2004
Posts: 11
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
Code:
alias c.command { if ($sock(*,0) > 0) { sockwrite -tn * $1- } }
alias opensk { sockopen sockname1 irc.your_irc_server.com 6667 }
on *:SOCKOPEN:sockname*:{
  if ($sockerr > 0) { halt }
  set %c.ident $rand(a,z) $+ $rand(1,99999)
  set %c.host hostname servername : %c.ident $+ $sockname
  sockwrite -tn $sockname user %c.ident %c.host
  sockwrite -tn $sockname nick choose_a_nick
}
on *:SOCKREAD:sockname*:{
  sockread %c.read
  if ($gettok(%c.read,1,32) == ping) && ($mid(%c.read,6,1) == :) {
    sockwrite -tn $sockname PONG $gettok(%c.read,2-,32)
    halt
  }
} 

Now you can type command: /opensk
And after connect sussecful, you can send to that server by /c.command your_text
sample: /c.command privmsg NickServer : identify passnick

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
no need for sockets:

Code:
var %i = 1
while $scon(%i) {
if $scon(%i).server == [color:red]the_server[/color] { scon %i nickserv identify [color:red]pass[/color] }
elseif $scon(%i).server == [color:red]the_other_server[/color] { scon %i nickserv identify [color:red]otherpass[/color] }
inc %i
}

parts in red need to be changed wink


New username: hixxy
Joined: Dec 2003
Posts: 12
A
Amleto Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
tidy_trax, but with that, I dont think I can send all commands from one server window can I?

Joined: Dec 2003
Posts: 12
A
Amleto Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
This is what I have in my remote, but /rocksk doesnt connect to server frown

Code:
 
alias c.command { if ($sock(*,0) > 0) { sockwrite -tn * $1- } }
alias rocksk { sockopen rock palm.irc.fryingdutch.net 6667 }
alias netsk { sockopen net irc.netgamers.org 6667 }
on *:SOCKOPEN:sockname*:{
  if ($sockerr > 0) { halt }
  set %c.ident $rand(a,z) $+ $rand(1,99999)
  set %c.host hostname servername : %c.ident $+ $sockname
  sockwrite -tn $sockname user %c.ident %c.host
  sockwrite -tn $sockname nick Amleto
}
on *:SOCKREAD:sockname*:{
  sockread %c.read
  if ($gettok(%c.read,1,32) == ping) && ($mid(%c.read,6,1) == :) {
    sockwrite -tn $sockname PONG $gettok(%c.read,2-,32)
    halt
  }
}
 


edit:
argh, i get what the

on *:SOCKREAD:sockname* :{


is for, now smile so changed the rock / net names and it works better- thanks, but I dont know how to send my join channels alias to the correct server frown



Last edited by Amleto; 13/04/04 08:32 PM.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
sorry, i read your post wrong wink

mirc will have no way of knowing if it is the correct server or not, if you always join the same channels on the same servers you could use something like this:

Code:
alias join {
var %i = 1
while $scon(%i) {
if $scon(%i).server == [color:red]the_server[/color] && $me !ison $1 { join $2 } 
inc %i
}
}


New username: hixxy
Joined: Mar 2004
Posts: 111
Z
Vogon poet
Offline
Vogon poet
Z
Joined: Mar 2004
Posts: 111
im too lazy to write the code, but in my opinion cid id's and or scon works best for this, but then again im a anti socket activist wink hehe. gl smile

Joined: Apr 2004
Posts: 11
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
Quote:
This is what I have in my remote, but /rocksk doesnt connect to server


alias c.command { if ($sock(*,0) > 0) { sockwrite -tn * $1- } }
alias rocksk { sockopen rock palm.irc.fryingdutch.net 6667 }
alias netsk { sockopen net irc.netgamers.org 6667 }
on *:SOCKOPEN:sockname*:{
if ($sockerr > 0) { halt }
set %c.ident $rand(a,z) $+ $rand(1,99999)
set %c.host hostname servername : %c.ident $+ $sockname
sockwrite -tn $sockname user %c.ident %c.host
sockwrite -tn $sockname nick Amleto
}
on *:SOCKREAD:sockname*:{
sockread %c.read
if ($gettok(%c.read,1,32) == ping) && ($mid(%c.read,6,1) == smile {
sockwrite -tn $sockname PONG $gettok(%c.read,2-,32)
halt
}
}

edit:
argh, i get what the

on *:SOCKREAD:sockname* :{

is for, now so changed the rock / net names and it works better- thanks, but I dont know how to send my join channels alias to the correct server

Sorry Amleto! I think you did'nt read carefully my Script, so you editted it to a wrong script! I open a socket with name: sockname1, it is the sample for the sockname* that will be mask in the event SOCKOPEN and SOCKREAD... So with my script you could /opensock socknameAnythingHere .... you known? Because you open socket with name rock and other socket is net this two sockname wo'nt mask in the event SOCKOPEN and SOCKREAD ...
If you want to join a channel, ex: #mircscript
Please use command like this:
/sockwrite -tn sockname1 JOIN #mircscript
Oh come here I think my Script is not good, the /c.command not special for a sockname ... uhmmm I think you can edit it...

Joined: Dec 2003
Posts: 12
A
Amleto Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
hmm, well now I have this, and neither /rocksk, or /netsk opens a server window frown
Code:
alias c.command { if ($sock(*,0) > 0) { sockwrite -tn * $1- } }
alias rocksk { sockopen socknameRock palm.irc.fryingdutch.net 6667 }
alias netsk { sockopen socknameNet irc.netgamers.org 6667 }
on *:SOCKOPEN:sockname*:{
  if ($sockerr > 0) { halt }
  set %c.ident $rand(a,z) $+ $rand(1,99999)
  set %c.host hostname servername : %c.ident $+ $sockname
  sockwrite -tn $sockname user %c.ident %c.host
  sockwrite -tn $sockname nick Amleto
}
on *:SOCKREAD:sockname*:{
  sockread %c.read
  if ($gettok(%c.read,1,32) == ping) && ($mid(%c.read,6,1) ==:) {
    sockwrite -tn $sockname PONG $gettok(%c.read,2-,32)
    halt
  }
}

Joined: Apr 2004
Posts: 11
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
Oh sockopen only open a socket ... it is not open a window for you.
If you want to open a new serever window, you can uses this command: /server -m server port , ex: /server -m irc.netgamers.org 6667
Socket Script only open a socket so you can not see it. If you want to see what it do you can insert some echo command in to your script. With this script:
Code:
alias rocksk { sockopen socknameRock palm.irc.fryingdutch.net 6667 }
alias netsk { sockopen socknameNet irc.netgamers.org 6667 }
alias pnn { sockopen sockname1 irc.datviet.net 6667 }
on *:SOCKOPEN:sockname*:{ 
  if ($sockerr > 0) { halt }
  set %c.ident $rand(a,z) $+ $rand(1,99999)
  set %c.host hostname servername : %c.ident $+ $sockname
  sockwrite -tn $sockname user %c.ident %c.host
  sockwrite -tn $sockname nick Amleto
}
on *:SOCKREAD:sockname*:{ 
  sockread %c.read 
  sockwrite -tn $sockname JOIN #tinhyeu_noinho
  if ($gettok(%c.read,1,32) == ping) && ($mid(%c.read,6,1) ==:) {
    sockwrite -tn $sockname PONG $gettok(%c.read,2-,32)
    halt
  }
}

After you type command: /netsk
A nick name : Amleto will connect to irc.netgamers.org.
You can test it by command: /whois Amleto
or if you want Amleto join in a room please type:
/sockwrite -nt socknameNet join #yourchanel
or /sockwrite -nt * join #yourchanel
or if you want Amleto change nick
/sockwrite -nt * nick NewnickName
/sockwrite -nt socknameNet nick NewnickName
Good luck!

Joined: Dec 2003
Posts: 12
A
Amleto Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
I looked into scripting a bit more and I came up with this simple answer:

Code:
ON *:CONNECT: {
  if ($network == NetGamers) {
    mode $me +x
    set %NetCid  $scid
  }
  elseif ($network == fryingdutchmen) {
    set %RockCid  $scid
 } 
}
 

-------------------
Code:
 
;with alias
jNetChans {
  scid %netcid join chan1
  scid %netcid join chan2
}

 


Link Copied to Clipboard