Channel Linker

By Cados on Apr 22, 2010

Got bored and couldn't think of anything productive so made this. :D Hope you all like it.

on 1:LOAD:{
  guser owner $$?"Enter your nick."
  echo -a Thanks for loading the Channel Linker by Cados. Commands are:
  .timer 1 1 echo -a !link <channel>
  .timer 1 2 echo -a !cut
  .timer 1 3 echo -a All commands are done in a channel and the channel it was said on is linked with the other channel specified.
}
on owner:TEXT:*:#:{
  if ($1 == !link) {
    if (!$2) { .msg $chan Please specify a channel to link to. }
    elseif ($me !ison $2) { .msg $chan I am not in $2 $+ . }
    else {
      .msg $chan Establishing connection with $2 $+ ...
      .msg $chan Establishing connection with $chan $+ ...
      set %chan1 $chan
      set %chan2 $2
      .msg $chan Connection established!
      .msg $2 Connection established!
      set %connection on
    }
  }
  if ($1 == !cut) {
    if (!%conenction) { .msg $chan There is no connection set up. }
    else {
      .msg %chan1 Disconnecting....
      .msg %chan2 Disconnecting....
      unset %chan1
      unset %chan2
      unset %connection
    }
  }
}
on *:text:*:%chan1 || %chan2:if (%connection == on) msg $iif(# = %chan1,%chan2,%chan1) [ $+ $nick $+ ]: $1
}
on *:ACTION:*:#:{
  if (%connection == on) {
    if ($chan == %chan1) { .msg %chan2 * $nick $1- }
    elseif ($chan == %chan2) { .msg %chan1 * $nick $1- }
  }
}
on *:JOIN:#:{
  if (%connection == on) {
    if ($chan == %chan1) { .msg %chan2 $nick has joined %chan1 $+ . }
    elseif ($chan == %chan2) { .msg %chan1 $nick has joined %chan2 $+ 
  }
}
on *:PART:#:{
  if (%connection == on) {
    if ($chan == %chan1) { .msg %chan2 $nick has parted %chan1 $+ . }
    elseif ($chan == %chan2) { .msg %chan1 $nick has parted %chan2 $+ 
  }
}

Comments

Sign in to comment.
WorldDMT   -  Apr 25, 2010

about %chan1,%chan2 edited
but about> And shouldn't this line:
[quote]$iif(# = %chan1,%chan2,%chan1)

Be this:

$iif(# = %chan1,%chan2,$iif(%chan2,%chan1))

[/quote]

the event is only for %chan1 and %chan2 so
if # = %chan1 else # = %chan2

about > $iif((%connection = on) && (# = %chan1,%chan2,%chan1),msg [ $+ $nick $+ ]: $1-))

the syntax is $iif(C,T,F)
C = condition
T = true
F = false
so look at that condition (# = %chan1,%chan2,%chan1) that will never work

so about my last post

on *:text:*:%chan1,%chan2:{
; if the event it's on %chan1 or %chan2
  if (connection == on) {
  ; check if the #chan is %chan1 or not by $iif
   msg $iif(# = %chan1,%chan2,%chan1) [ $+ $nick $+ ]: $1-
   ; so if # = %chan1 that will be
   ; msg %chan2 [Jethro_]: $1-
   ; else that will be
   ; msg %chan1 [Jethro_]: $1-
  }
}
 Respond  
Jethro   -  Apr 24, 2010

WorldDMT, shouldn't this line:

on :text::%chan1 || %chan2: {
be this:

on *:text:*:%chan1,%chan2: {

And shouldn't this line:

$iif(# = %chan1,%chan2,%chan1)
Be this:

$iif(# = %chan1,%chan2,$iif(%chan2,%chan1))

Also, I think we could get rid of the if statement by combining them in the $iif like this:

$iif((%connection = on) && (# = %chan1,%chan2,%chan1),msg [ $+ $nick $+ ]: $1-))

Unless what you've done is another way of coding that I'm not sure of?

 Respond  
WorldDMT   -  Apr 24, 2010

add a condition if ($2 != #)
use $iif e.g:

on *:text:*:%chan1,%chan2:if (%connection == on) msg $iif(# = %chan1,%chan2,%chan1) [ $+ $nick $+ ]: $1-

on action event u have to use describe instead of msg

 Respond  
Cados   -  Apr 23, 2010

Ok, fixed. Thanks.

 Respond  
PuNkTuReD   -  Apr 23, 2010

no need for the

else { halt }

having it, could possibly cause other scripts to stop functioning.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.