Auto Join

By xdesoto on Jul 12, 2011

Go to a room,
type +ajoin
it works on multi-servers.

menu channel { 
  Auto Join ( $+ $iif(%aj,on,off) $+ ) 
  .on:inc %aj ON 
  .off:unset %aj OFF 
  .- 
  .Add:{ set %aj. $+ $network $addtok(%aj. [ $+ [ $network ] ],#,44) | echo -s # added to autojoin } 
  .Del:{ set %aj. $+ $network $remtok(%aj. [ $+ [ $network ] ],#,44) | echo -s # removed from autojoin } 
} 
on *:Input:#:{ 
  If ($$1 == +ajoin) { set %aj. $+ $network $addtok(%aj. [ $+ [ $network ] ],$chan,44) | echo -a $chan added to autojoin for $server } 
  If ($$1 == -ajoin) { set %aj. $+ $network $remtok(%aj. [ $+ [ $network ] ],$chan,44) | echo -a $chan removed from autojoin for $server } 
  If ($$1 == -ajoff) { unset %aj | echo -a Autojoin Off } 
  If ($$1 == +ajon) { inc %aj | echo -a Autojoin On } 
} 
on *:connect:{ 
  if (%aj) { if (%aj. [ $+ [ $network ] ]) join -n $ifmatch } 
} 

Comments

Sign in to comment.
Jethro   -  Sep 23, 2011

Yeah it was just a demonstrative example. I'm not sure how long you can go to store data in variables before each variable gets cut off...Perhaps jaytea can fill me in on this one.

 Respond  
xdesoto   -  Sep 23, 2011

oO comments on my 2 month old script loL..
uMm yeah I used jon because when I tried to use join, it failed ;(
I was tired and did that.
oO Jethro, yours is just more fancier than mine :p (and probably works a whole lot better)
I am just not good with Hash tables.

 Respond  
Jethro   -  Sep 23, 2011

Here is what I meant by what I said:

menu channel { 
  Auto Join ( $+ $iif(%aj,on,off) $+ ) 
  .on:set %aj on
  .off:unset %aj
  .- 
  .Add { hadd -m aj $network $&
      $addtok($hget(aj,$network),#,44)
  echo -s # added to autojoin } 
  .Del { hadd -m aj $network $&
      $remtok($hget(aj,$network),#,1,44) 
  echo -s # removed from autojoin } 
} 
on *:exit: hsave -o aj aj
on *:connect: if (%aj) && ($hget(aj)) join $hget(aj,$network) 
on *:start: if ($file(aj).shortfn) hmake aj 100 | hload aj $v1
on *:input:#:{ if ($regex($1,/^([+-])ajoin$|ajo(n|ff)$/iS)) {
    if ($regml(1) == ff) { unset %aj | echo -a AutoJoin Off }
    elseif ($regml(1) == n) { set %aj on | echo -a Autojoin On }
    else { var %h = $hget(aj,$network), %a = $addtok(%h,#,44)
      var %r = $remtok(%h,#,1,44) | hadd -m aj $network $&
        $iif($regml(1) == +,%a,%r) | echo -a # $iif($regml(1) != -,$&
    added to,removed from) autojoin for $server } }
}
 Respond  
Jethro   -  Sep 23, 2011

This snippet will be better off using a hash table and store all the channels in its data, with a comma separating each of them. From experience I know a global variable can get cut off if the length reaches to a certain limit. I'm not sure, but the multiple target join on each network may vary...there may be a restriction on how many channels you can join together at a time.

 Respond  
blackvenomm666   -  Sep 23, 2011

i don't think its a typo spoof he can't have +ajoin in two areas line ten is +ajoin so he used +ajon for that one

 Respond  
Spoof   -  Sep 23, 2011

You have a typo on line 13
If ($$1 == +ajon) { inc %aj | echo -a Autojoin On }
"ajon" should be changed to ajoin

 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.