All pastes #515548 Raw Edit

Mine

public text v1 · immutable
#515548 ·published 2007-05-28 07:56 UTC
rendered paste body
on *:connect:{
  set %serv $addtok(%serv,$server,64)
  set %cid $addtok(%cid,$cid,64)
}
on *:disconnect:{
  if ($istok(%serv,$server,64)) && ($istok(%cid,$cid,64)) {
    set %serv $remtok(%serv,$server,64)
    set %cid $remtok(%cid,$cid,64)
  }
}
on *:exit:{ unset %serv | unset %cid }
;startup menu
;error and info dialogs
#relay off
dialog info {
  title "Chat Relay by lidder"
  size -1 -1 100 60
  option dbu
  text "INFO:", 1, 45 2 15 10 
  text "", 2, 2 9 95 33  
  button "Close", 3, 10 45 20 10, cancel flat  
  link "rejected@austnetexposed.com", 4, 40 45 50 10
}
dialog error {
  title "Chat Relay by lidder"
  size 200 200 100 60
  option dbu
  text "ERROR:", 1, 40 6 25 10
  text "", 2, 5 15 90 25
  button "Close", 3, 10 45 20 10, cancel flat  
  link "rejected@austnetexposed.com", 4, 40 45 50 10
}
dialog men {
  title "Chat Relay by lidder"
  size -1 -1 100 110
  option dbu
  button "Set", 1, 30 95 20 10, ok flat 
  button "Cancel", 2, 50 95 20 10, cancel flat 
  text "Select the type of relay you would like to use.", 3, 5 5 80 25 
  check "Single Channel Relay", 4, 5 20 75 10 
  check "Multi Channel Relay", 5, 5 30 60 10
  link "rejected@austnetexposed.com", 7, 5 62 50 10
  text "Any bugs, comments, suggestions, send to:", 8, 5 50 90 13
  text "Visit", 10, 5 70 10 10
  text "for the best scripting resource online.", 11, 5 77 90 10
  link "rejected@austnetexposed.com", 9, 16 70 62 10
  check "Nick Relay", 12, 5 40 40 10
}
;Menu dialogs
on *:dialog:men:sclick:2:{
  .disable #relay
}
on *:dialog:men:sclick:1:{
  if ($did(4).state == 0) && ($did(5).state == 0) && ($did(12).state == 0) {
    dialog -m error error
    did -ra error 2 Error:You need to select one of the three options.
    halt  
  }
  elseif ($did(4).state == 1) {
    .enable #srel
    dialog -m nrelay nrelay
  }
  elseif ($did(5).state == 1) {
    .enable #mcevent
    dialog -m mclay mclay  
  }
  elseif ($did(12).state == 1) {    
    .enable #nnsr
    dialog -m nicklay nicklay
  }
}
on *:dialog:men:sclick:*:{
  if ($did == 4) {
    did -e men 5,12
    if ($did(4).state == 1) {
      did -b men 5,12
    }
  }    
  if ($did == 5) {
    did -e men 4,12
    if ($did(5).state == 1) {
      did -b men 4,12
    }
  }      
  if ($did == 12) {
    did -e men 5,4
    if ($did(12).state == 1) {
      did -b men 5,4
    }
  }
} 
#relay end
#srel off
;nrelay dialog
dialog nrelay {
  title "Chat Relay by lidder"
  size -1 -1 120 130
  option dbu
  button "Set", 6, 55 110 20 10, ok flat 
  button "Cancel", 7, 78 110 20 10, cancel flat 
  text "To Room:", 1, 5 51 40 10
  text "From Room:", 2, 5 67 30 20
  check "Multiple-Server", 3, 5 110 50 10
  combo 4, 45 50 70 50, size drop 
  combo 5, 45 66 70 50, size drop   
  text "To Network:", 8, 5 19 70 10
  text "From Network:", 9, 5 35 45 10
  combo 10, 45 18 70 50, size drop
  combo 11, 45 34 70 50, size drop
  button "Info", 24, 5 90 15 10
  box "Single Channel Relay", 12, 2 2 116 126
}
;channel relay dialogs
on *:dialog:nrelay:sclick:7:{
  .disable #srel #relay
  unset %tc1
  unset %fc1  
  unset %channelto.cid
  unset %channelfrom.cid
}
on *:dialog:nrelay:init:0:{
  chantok
}
on *:dialog:nrelay:sclick:6:{
  if ($did(4) == $null) || ($did(5) == $null) || ($did(10) == $null) || ($did(11) == $null) {
    dialog -m error error
    did -ra error 2 Error:You need to fill in all the fields.
    halt 
  } 
  elseif (%tc1 != %fc1) && ($did(3).state == 0) {
    dialog -m error error
    did -ra error 2 Error:You have it set for multiple server. You need to select the "Multiple-Server" box.
    halt 
  }
  else {
    unset %fc1
    unset %tc1
    set %channel.to $did(4)
    set %channel.from $did(5)
    set %multi.serv $did(3).state  
  }
} 
on *:dialog:nrelay:sclick:10:{
  set %tc1 $findtok(%serv,$did(10),1,64) 
  set %channelto.cid $gettok(%cid,%tc1,64)
  did -r nrelay 4  
  scid %channelto.cid chansto
  if (%fc1 == %tc1) {
    did -b nrelay 3 
  }
  else {
    did -e nrelay 3
  }
}
on *:dialog:nrelay:sclick:11:{
  set %fc1 $findtok(%serv,$did(11),1,64)
  set %channelfrom.cid $gettok(%cid,%fc1,64)
  did -r nrelay 5  
  scid %channelfrom.cid chansfrom
  if (%fc1 == %tc1) {
    did -b nrelay 3 
  }
  else {
    did -e nrelay 3
  }
}
on *:dialog:nrelay:sclick:24:{
  dialog -m info info
  did -ra info 2 The chan relay is a function to relay everything that is happening in a certain channel to another room on the same or different server.
}
;Channel Relay Commands
on *:TEXT:*:%channel.from:{
  if (%multi.serv == 0) { msg %channel.to 0 $1- }
  elseif (%multi.serv == 1) && (%channelfrom.cid) { scid %channelto.cid msg %channel.to 0 $1- }
}  
#srel end
#nnsr off
dialog nicklay {
  title "Chat Relay by lidder"
  size -1 -1 120 130
  option dbu
  button "Set", 6, 55 110 20 10, ok flat 
  button "Cancel", 7, 78 110 20 10, cancel flat  
  text "From Network:", 14, 5 54 40 10
  text "To Network:", 15, 5 36 40 10
  edit "", 16, 45 19 70 10
  combo 17, 45 35 70 50, size drop
  combo 18, 45 53 70 50, size drop
  text "Nick to watch:", 19, 5 20 35 10
  text "To Channel:", 20, 5 71 30 10
  combo 21, 45 71 70 50, size drop
  button "Info", 22, 5 90 15 10
  check "Multiple-Server", 25, 5 110 50 10
  box "Single Nick Relay", 12, 2 2 116 126
}
;Nick relay dialogs
on *:dialog:nicklay:init:0:{
  nicktok
}
on *:dialog:nicklay:sclick:6:{
  if ($did(16) == $null) || ($did(17) == $null) || ($did(18) == $null) || ($did(21) == $null) {
    dialog -m error error
    did -ra error 2 Error:You need to fill in all the fields.
    halt 
  } 
  elseif (%tc2 != %fc2) && ($did(25).state == 0) {
    dialog -m error error
    did -ra error 2 Error:You have it set for multiple server. You need to select the "Multiple-Server" box.
    halt 
  }
  else {
    unset %fc2
    unset %tc2
    set %nickr on
    set %vic $did(16)
    set %channel.to $did(21)
    set %multi.serv $did(25).state  
  }
} 
;Nick relay dialogs
on *:dialog:nicklay:sclick:22:{
  dialog -m info info
  did -ra info 2 The nick relay is a function to relay what a paticular person is saying/doing in all channels on a server that you and him are both in to another room on the same or different server.
}
on *:dialog:nicklay:sclick:17:{
  set %tc2 $findtok(%serv,$did(17),1,64) 
  set %channelto.cid $gettok(%cid,%tc2,64)
  did -r nicklay 21  
  scid %channelto.cid nickto
  if (%fc2 == %tc2) {
    did -b nicklay 25 
  }
  else {
    did -e nicklay 25
  }
}
on *:dialog:nicklay:sclick:18:{
  set %fc2 $findtok(%serv,$did(18),1,64)
  set %channelfrom.cid $gettok(%cid,%fc2,64)
  if (%fc2 == %tc2) {
    did -b nicklay 25 
  }
  else {
    did -e nicklay 25
  }
}
on *:dialog:nicklay:sclick:7:{
  .disable #nnsr #relay
  unset %tc2
  unset %fc2  
  unset %channelto.cid
  unset %channelfrom.cid
}

;Nick Relay commands
on *:TEXT:*[*:#:{
  if (%nickr == on) && ($nick == %vic) && (%multi.serv == 1) && (%channelfrom.cid) { scid %channelto.cid msg %channel.to 4 $+ $chan $+  < $+ $nick $+ > $1- }
  elseif (%nickr == on) && ($nick == %vic) && (%multi.serv == 0) { msg %channel.to 4 $+ $chan $+  < $+ $nick $+ > $1- }
}  

on *:NICK:{
  if ($comchan($newnick,0) > 0) && (%nickr == on) && ($nick == %vic) && (%multi.serv == 0) { msg %channel.to 3* $nick is now known as $newnick  | set %vic $newnick }
  elseif ($comchan($newnick,0) > 0) && (%nickr == on) && ($nick == %vic) && (%multi.serv == 1) && (%channelfrom.cid) { scid %channelto.cid msg %channel.to 3* $nick is now known as $newnick  | set %vic $newnick }
}
#nnsr end
#mcevent off
dialog mclay {
  title "Chat Relay by lidder"
  size -1 -1 180 150
  option dbu
  button "Set", 1, 75 125 30 20, ok flat
  button "Cancel", 2, 110 125 30 20, cancel flat
  check "Multiple-Server", 3, 5 135 45 10
  combo 4, 10 10 70 50, size drop
  combo 7, 102 10 70 50, size drop
  combo 10, 10 68 70 50, size drop
  combo 11, 10 83 70 50, size drop
  combo 12, 10 98 70 50, size drop
  combo 13, 102 68 70 50, size drop
  combo 14, 102 83 70 50, size drop
  combo 15, 102 98 70 50, size drop
  box "To Network", 16, 2 2 83 25
  box "From Network", 17, 94 2 83 25
  box "To Channels", 18, 2 60 83 55 
  box "From Channels", 19, 94 60 83 55
  button "Info", 20, 5 120 12 10
  text "1.", 27, 5 69 5 10
  text "2.", 28, 5 84 5 10
  text "3.", 29, 5 99 5 10
  text "1.", 30, 97 69 5 10 
  text "2.", 31, 97 84 5 10 
  text "3.", 32, 97 99 5 10
}
;multiple channel dialogs
on *:dialog:mclay:sclick:2:{
  .disable #mcevent #relay
  unset %channelto.cid
  unset %channelfrom.cid
  unset %tc3
  unset %fc3
}
on *:dialog:mclay:init:0:{
  mulchan
}
on *:dialog:mclay:sclick:20:{
  dialog -m info info
  did -ra info 2 The multi channel relay is to relay what is said in up to three rooms into three other rooms on the same or different server.
}
on *:dialog:mclay:sclick:1:{
  if ($did(4) == $null) && ($did(7) == $null) && ($did(10) == $null) && ($did(11) == $null) && ($did(12) == $null) && ($did(13) == $null) && ($did(14) == $null) && ($did(15) == $null) {
    dialog -m error error
    did -ra error 2 Error:You need to fill in the required fields.
    halt 
  } 
  elseif ($did(4) == $null) || ($did(7) == $null) {
    dialog -m error error    
    did -ra error 2 Error:You need to fill in the required fields.
    halt 
  }
  elseif ($did(10) == $null) && ($did(11) == $null) && ($did(12) == $null) {
    dialog -m error error    
    did -ra error 2 Error:You need to fill in at least one To Channel.
    halt 
  }
  elseif ($did(13) == $null) && ($did(14) == $null) && ($did(15) == $null) {
    dialog -m error error    
    did -ra error 2 Error:You need to fill in at least one From Channel.
    halt 
  }
  elseif (%tc3 != %fc3) && ($did(3).state == 0) {
    dialog -m error error
    did -ra error 2 Error:You need to check the "Multiple-Server" option as you have it set for multiple server relaying.
    halt 
  }
  else {
    unset %fc3
    unset %tc3
    set %channel.to1 $did(10)
    set %channel.to2 $did(11)
    set %channel.to3 $did(12)
    set %channel.from1 $did(13)
    set %channel.from2 $did(14)
    set %channel.from3 $did(15)
    set %multi.serv $did(3).state  
  }
} 
on *:dialog:mclay:sclick:*:{
  if ($did == 4) {  
    set %tc3 $findtok(%serv,$did(4),1,64) 
    set %channelto.cid $gettok(%cid,%tc3,64)    
    did -r mclay 10,11,12  
    scid %channelto.cid mulchanto
  }
  elseif ($did == 7) {  
    set %fc3 $findtok(%serv,$did(7),1,64) 
    set %channelfrom.cid $gettok(%cid,%fc3,64)
    did -r mclay 13,14,15  
    scid %channelfrom.cid mulchanfrom
  }
}
;multiple channel events
on *:TEXT:*:%channel.from1,%channel.from2,%channel.from3:{
  if (%multi.serv == 0) && (%channel.to2 == $null) && (%channel.to3 == $null) { msg %channel.to1 4 $+ $chan $+  < $+ $nick $+ > $1- }
  elseif (%multi.serv == 0) && (%channel.to3 == $null) { msg %channel.to1 $+ , $+ %channel.to2 4 $+ $chan $+  < $+ $nick $+ > $1- }
  elseif (%multi.serv == 0) { msg %channel.to1 $+ , $+ %channel.to2 $+ , $+ %channel.to3 4 $+ $chan $+  < $+ $nick $+ > $1- }
  elseif (%multi.serv == 1) && (%channel.to2 == $null) && (%channel.to3 == $null) { scid %channelto.cid msg %channel.to1 4 $+ $chan $+  < $+ $nick $+ > $1- } 
  elseif (%multi.serv == 1) && (%channel.to3 == $null) { scid %channelto.cid msg %channel.to1 $+ , $+ %channel.to2 4 $+ $chan $+  < $+ $nick $+ > $1- }
  elseif (%multi.serv == 1) { scid %channelto.cid msg %channel.to1 $+ , $+ %channel.to2 $+ , $+ %channel.to3 4 $+ $chan $+  < $+ $nick $+ > $1- }
}
elseif (%multi.serv == 0) && (%channel.to3 == $null) { msg %channel.to1 $+ , $+ %channel.to2 4 $+ $chan $+  3* $nick ( $+ $mask($address,3) $+ ) has left $chan ( $1- ) }
elseif (%multi.serv == 0) { msg %channel.to1 $+ , $+ %channel.to2 $+ , $+ %channel.to3 4 $+ $chan $+  3* $nick ( $+ $mask($address,3) $+ ) has left $chan ( $1- ) }
elseif (%multi.serv == 1) && (%channel.to2 == $null) && (%channel.to3 == $null) { scid %channelto.cid msg %channel.to1 4 $+ $chan $+  3* $nick ( $+ $mask($address,3) $+ ) has left $chan ( $1- ) } 
elseif (%multi.serv == 1) && (%channel.to3 == $null) { scid %channelto.cid msg %channel.to1 $+ , $+ %channel.to2 4 $+ $chan $+  3* $nick ( $+ $mask($address,3) $+ ) has left $chan ( $1- ) }
elseif (%multi.serv == 1) { scid %channelto.cid msg %channel.to1 $+ , $+ %channel.to2 $+ , $+ %channel.to3 4 $+ $chan $+  3* $nick ( $+ $mask($address,3) $+ ) has left $chan ( $1- ) }

}  
on *:NICK:{ 
  if (%multi.serv == 0) && (%channel.to2 == $null) && (%channel.to3 == $null) { msg %channel.to1 4 $+ $chan $+  3* $nick is now known as $newnick  }
  elseif (%multi.serv == 0) && (%channel.to3 == $null) { msg %channel.to1 $+ , $+ %channel.to2 4 $+ $chan $+  3* $nick is now known as $newnick  }
  elseif (%multi.serv == 0) { msg %channel.to1 $+ , $+ %channel.to2 $+ , $+ %channel.to3 4 $+ $chan $+  3* $nick is now known as $newnick  }
  elseif (%multi.serv == 1) && (%channel.to2 == $null) && (%channel.to3 == $null) { scid %channelto.cid msg %channel.to1 4 $+ $chan $+  3* $nick is now known as $newnick  } 
  elseif (%multi.serv == 1) && (%channel.to3 == $null) { scid %channelto.cid msg %channel.to1 $+ , $+ %channel.to2 4 $+ $chan $+  3* $nick is now known as $newnick  }
  elseif (%multi.serv == 1) { scid %channelto.cid msg %channel.to1 $+ , $+ %channel.to2 $+ , $+ %channel.to3 4 $+ $chan $+  3* $nick is now known as $newnick  }
}  
#mcevent end
;alias's used in dialogs
alias mulchanto {
  var %c 1
  while (%c <= $chan(0)) {
    did -a mclay 10,11,12 $chan(%c)
    inc %c
  }
}
alias mulchanfrom {
  var %c 1
  while (%c <= $chan(0)) {
    did -a mclay 13,14,15 $chan(%c)
    inc %c
  }
}
alias mulchan {
  var %t 1
  while (%t <= $numtok(%serv,64)) {
    did -a mclay 4,7 $gettok(%serv,%t,64)
    inc %t    
  }
}
alias nicktok {
  var %t 1
  while (%t <= $numtok(%serv,64)) {
    did -a nicklay 17,18 $gettok(%serv,%t,64)
    inc %t    
  }
}
alias chantok {
  var %t 1
  while (%t <= $numtok(%serv,64)) {
    did -a nrelay 10,11 $gettok(%serv,%t,64)
    inc %t    
  }
}
alias nickto {
  var %c 1
  while (%c <= $chan(0)) {
    did -a nicklay 21 $chan(%c)
    inc %c
  }
}
alias chansto {
  var %c 1
  while (%c <= $chan(0)) {
    did -a nrelay 4  $chan(%c)
    inc %c
  }
}
alias chansfrom {
  var %c 1
  while (%c <= $chan(0)) {
    did -a nrelay 5 $chan(%c)
    inc %c
  }
}

menu * {
  Turn Relay $iif($group(#relay) == on,Off,On) { 
    if ($group(#relay) == on) { 
      .disable #relay #srel #mcevent #nnsr | echo -a *Relay Script Disabled | unset %channel.to | unset %channel.from | unset %multi.serv | unset %channelto.cid | unset %channelfrom.cid | unset %vic | unset %nickr | unset %channel.to1 | unset %channel.to2 | unset %channel.to3 | unset %channel.from1 | unset %channel.from2 | unset %channel.from3  
    }  
    else { .enable #relay | dialog -m men men } 
  }
}