mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Quote:
it seems like I have to leave unticked the option in mirc "rejoin channels on connect"

I believe you can have that checked now.
Quote:
5 sec delay before opening each channel

The script below will initiate a 5 second delay within every added channel.
Code:
on *:CONNECT: { .autojoin -s | var %x = $numtok(%y,44) | while (%x > 0) { .timer 1 $calc(%x * 5) join $gettok(%y,%x,44) | dec %x } }
on *:DISCONNECT: { set -e %y #chan1,#chan2,#chan3,#chan4,#chan5,#chan6,#chan7,#chan8,#chan9,#chan10 }

It may not be as sophisticated as what Horstle has made, but I think it gets the job done fairly decent.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
It all depends on the servers settings. What may work great on one server may be considered flooding on another. I find the limit on the server and create a queu. The main server I script for allows 11 or 12 commands within 600 milli-seconds. So I just set up a queu using a hash table that sends 10 or 11 commands every 700 milli-seconds.

But I have never had any trouble joining 10+ rooms at once with the:

/join #chan1,#chan2 etc.

command.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Well, if you happen to be an ircop or staff, chances are you don't have to worry about flooding the server by joining many channels at once.

Joined: Aug 2007
Posts: 19
S
sox147 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2007
Posts: 19
Originally Posted By: argv0
That would defeat the entire purpose of the script-- the fact that you're joining too many channels at once.

I feel like it's important to ask how many channels you're actually on? I'm really not sold on excess floods being an issue with vanilla mirc in the first place.


edit: I think i again misunderstood the delay action(also tested it @ a late hour while MT). I thought it adds and increases, for example 10 secs, then 20 secs, 30 secs etc between each channel connect, so by the last channel it would be an age. That's why I was asking about a constant delay "per" channel (not all at once).

I guess all these misunderstandings on my part come from not knowing how to read the script code, and therefore not being able to recognise what exactly they're meant to do. I'll have to learn it.

As for how many channels, it's approx 28 on one server, but sometimes can be a couple more.

Last edited by sox147; 06/05/09 09:37 AM.
Joined: Aug 2007
Posts: 19
S
sox147 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2007
Posts: 19
Originally Posted By: Tomao
Quote:
it seems like I have to leave unticked the option in mirc "rejoin channels on connect"

I believe you can have that checked now.
Quote:
5 sec delay before opening each channel

The script below will initiate a 5 second delay within every added channel.
Code:
on *:CONNECT: { .autojoin -s | var %x = $numtok(%y,44) | while (%x > 0) { .timer 1 $calc(%x * 5) join $gettok(%y,%x,44) | dec %x } }
on *:DISCONNECT: { set -e %y #chan1,#chan2,#chan3,#chan4,#chan5,#chan6,#chan7,#chan8,#chan9,#chan10 }

It may not be as sophisticated as what Horstle has made, but I think it gets the job done fairly decent.


Thanks Tomao. I will test all these and see what happens.

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Quote:
You might want to take a look at the code I used in this snippet as it uses the chanfolder section of mIRC.ini
Thanks smile I had a look at it.
This snippet will work for many setups, but not for all:
- it does not take the general "enable autojoin" switch into account (a minor, and easily fixed)
- it does not take "minimize on join" into account (a minor too, but see next point)
- if "minimized" is ticked and "ajoin" unticked, it will mistake "minimized" for "ajoin" due to gettok(-1)
- fails if a "folder" is used (the folder will be added as last token)
- fails if set to "all networks" or multiple nets have been specified (the infamous "net1,net2,netx"-token)

I managed to get it work for all these cases, though I'm not happy with the beast of alias I have to call...
Code:
alias ajoin {
  ; if connected and "join on connect" is enabled for the favorites
  if ($status == connected) && ($gettok($readini($mircini,options,n4),37,44)) {
    var %net = $network, %n = 1

    ; loop favorites
    while ($ini($mircini,chanfolder,%n)) {
      var %r = $readini($mircini,chanfolder,$v1)

      /*
      the alias called below is ugly. but:
      1) you don't have 0-values but instead maybe consecutive commas
      2) the quoted "tokens" allow for commas inside them, e.g. multiple networks separated by comma
      examples:
      n01=#ChannelA,,,"Network",,,"Folder"
      n02=#ChannelB,"A channel description, with commas etc",SomePassword,"NetworkA,NetworkB",,1,"Mychans"
      n03=#ChannelC,,MyPass,,1,,"misc chans"
      n04=#ChannelD
      */

      ; chan=$1 "description"=$2 pass=$3 "network"=$4 autojoin=$5 join_minimized=$6 "group"=$7
      tokenize 11 $nullstring.token(44,$!null,%r)

      ; if this fav is either set for the current net or for no specific net 
      ; and if the fav has ajoin enabled, and I'm not already at this chan: join chan
      if (($4 == $!null) || ($istok($noqt($4),%net,44))) && ($5) && ($me !ison $1) { JOIN $iif($6,-n) $1 }

      inc %n
    }
  }
}



/*
$nullstring.token(<token-char>,<value to put for null-tokens>,<string>).[N of token]

For a <string> that is originally delimited by <token-char>, but may contain "quoted" tokens which may contain
the token-char itself, it returns the Nth token, or, if no N specified, the complete string separated by $chr(11).
All "null-tokens" of the <string> are filled with <value tu put for null-tokens>.

Using $chr(11) was a completely arbitrary choice. <string> may not contain any $chr(1).

Example:
var %text = ,,,x,"a value, with commas",,Y
"$nullstring.token(44,0,%text)" returns: "00x"a value, with commas"0Y"
"$nullstring.token(44,0,%text).4" returns: "a value, with commas"
"$nullstring.token(44,0,%text).5" returns: "0" (the value put for this null-token)
"$nullstring.token(44,0,%text).0" returns: "6" (the total number of tokens)
*/

alias nullstring.token {
  ; the token-separating char as ascii and octal; the value to put for null-tokens
  var %c = $iif($1 isnum,$v1,$asc($v1)), %co = $base(%c,10,8), %null = $2

  ; escape the token-separating char in "quoted tokens" by replacing this char with the "tempchar" $chr(1)
  var %t = $regsubex($$3-,/(".+?")(?=\ $+ %co $+ )/g,$replace(\t,$chr(%c),$chr(1)) )

  ; "fill null tokens": if the token-separating char is followed by itself, put the "fill"-value after the char
  var %t = $regsubex(%t,/\ $+ %co $+ (?=\ $+ %co $+ )/g,$chr(%c) $+ %null )

  ; if property N given: return the Nth token (backreplacing the tempchar)
  if ($prop isnum) { return $replace($gettok(%t,$v1,%c),$chr(1),$chr(%c)) }

  ; if no N property given: return complete <string> with it's tokens separated by $chr(11) (e.g. for later /tokenize)
  ; "switch chars": replace original token-separating char with $chr(11), switch tempchar $chr(1) back to char $1
  return $replacexcs(%t,$chr(%c),$chr(11),$chr(1),$chr(%c))
}

In case someone likes to use the code for a delayed join of his favorites: build a string of join commands instead of issuing the JOIN command, thereafter loop this string to fire timers for it's tokens. There are several examples for this kind of looping in the scripts of previous posts.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Originally Posted By: sox147


I guess all these misunderstandings on my part come from not knowing how to read the script code, and therefore not being able to recognise what exactly they're meant to do. I'll have to learn it.


The way you recognize exactly what they do, not just meant to do, is through trial and error and the use of /echo. I don't know about the other people on this forum, but I think it is safe to say that most of us learned about scripting by doing more than asking. I ask questions here after I've exhausted all my ideas. I'm not saying don't ask questions. Im just saying you have tools available to you to show you exactly what your scripts are doing line by line.

This will make you more comfortable with how the mirc scripting language works.

I test identifiers and scripts using echo's and /debug @debug.

Joined: Aug 2007
Posts: 19
S
sox147 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2007
Posts: 19
Horstl,

Is it possible to add something to the script so that as mirc rejoins the channels, it doesn't bring each channel window to the front?

Can it rejoin "silently" similar to the default mirc method which doesn't pop up each channel's window on a reconnect?

The rest is working great, thx. smile

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Use the -n switch with /join. If you use the favorites dialog as autojoin you can set to join minimized there too.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Below's a merge of the "delayed rejoin of open channels" code and the "join favorites" code (with a fixed nulltoken-alias and fixes in the parsing of what this alias returns).
It should allow you to join both "favorites" and "open channels" with the specified delay and take all the settings of the favorites into account (e.g. passwords).
Rejoined channels won't come to the fore if "%bgjoin" is set to "$true". Channels of the favorites will come to the fore if 1) the chan isn't already open and 2) "minimize on join" wasn't ticked for this channel.
Note that one issue remains: "/server <someserver> -j #chan1,#chan2" will connect but won't join the channels specified, because "autojoin -s" will skip the channels of the -j parameter too. This could be addressed with a custom /server alias, but I rather won't fiddle about it...
Code:
on *:connect: {
  ; ######## SETUP START ########
  ; (re)join channels with a delay of (N in seconds):
  var %delay = 10

  ; rejoin open channels in background ($true/$false):
  var %bgjoin = $true
  ; ######## SETUP END #########

  autojoin -s

  var %t = $+(delayjoin.chans.,$cid)
  ; set channels to rejoin - loop open channels (if "rejoin on connect" was set in the options)
  if ($hget(delayjoin.usedcids,$cid)) && ($gettok($readini($mircini,options,n2),27,44)) {
    var %n = 1
    while ($chan(%n)) {
      hadd -m %t $v1 $iif(%bgjoin == $true,-n) $chan(%n)
      inc %n
    }
  }
  ; set channels to join - loop favorites (if "enable join on connect" was set in the favorites' general options)
  if ($gettok($readini($mircini,options,n4),37,44)) {
    var %n = 1
    while ($ini($mircini,chanfolder,%n)) {
      tokenize 11 $ini.tokens(44,$!null,$readini($mircini,chanfolder,$v1))
      if (!$hget(%t,$1)) && (($4 == $!null) || ($istok($noqt($4),$network,44))) && ($5 != $!null) && ($me !ison $1) {
        hadd -m %t $1 $iif($6,-n) $1 $iif($3 != $!null,$3)
      }
      inc %n
    }
  }
  ; delayed join of all channels set - start timers
  var %n = 1
  while ($hget(%t,%n).data) {
    $+(.timer,.delayjoin.chans.,$cid,.,%n) 1 $calc((%n -1) * %delay) JOIN $safe2u($v1)
    inc %n
  }
}

on *:disconnect: {
  hadd -m delayjoin.usedcids $cid $true
  if ($hget($+(delayjoin.chans.,$cid))) { hfree $v1 }
  $+(.timer,.delayjoin.chans.,$cid,.*) off
}

alias -l ini.tokens {
  var %c = $iif($1 isnum,$v1,$asc($v1)), %co = $base(%c,10,8), %null = $2
  var %t = $regsubex($$3-,/(?<=^|\ $+ %co $+ )(".+?")(?=\ $+ %co $+ |$)/g,$replace(\t,$chr(%c),$chr(1)))
  var %t = $regsubex(%t,/\ $+ %co $+ (?=\ $+ %co $+ )/g,$chr(%c) $+ %null )
  return $replacexcs(%t,$chr(%c),$chr(11),$chr(1),$chr(%c))
}

alias safe2u { bunset &a | bset -t &a 1 $1 | return $!regsubex(safe2u, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1)) }

Edit: forgot to account for the "rejoin on connect" setting.

Joined: Aug 2007
Posts: 19
S
sox147 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2007
Posts: 19
Thanks for your replies.

How would I add only that background command to the script in your earlier post? That's the one I'm using atm.

https://forums.mirc.com/ubbthreads.php?ub...rt=1#Post211912

I tried a dozen different things and couldn't get the windows to stay in the background on rejoin. I'm obviously stuffing it up.

I also tried your full script (although I don't use favourites)and it wouldn't rejoin at all.

* /join: insufficient parameters

TQ.

Last edited by sox147; 19/05/09 10:07 AM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
argv0 pointed at it already - you will rejoin the channels in the background if you add the "n"-switch to the join command issued by the script. In the script of the post you link to, the command in question is in the 6th line, which would become:

while $chan(%i) { $+(.timer,delayjoin,$cid,$chr(1),$v1) 1 $calc((%i -1) *10) join -n $!gettok($ctimer,2,1) | inc %i }

I was unable to reproduce your error with the latest version of the script though. Did you place the new script in a separate "remotes" file, and removed older versions of the script?

Joined: Aug 2007
Posts: 19
S
sox147 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2007
Posts: 19
Nice, thanks.

As for the other script, yes I put it in a separate file and unloaded everything else. I'm also using mirc 6.17. Maybe I'll upgrade to the latest one when I get some time.

I won't be using that script but thought I'd mention it incase someone else later on needs it.

Joined: Sep 2010
Posts: 13
E
Pikka bird
Offline
Pikka bird
E
Joined: Sep 2010
Posts: 13
How do I get the ajoin alias to work? It's not working for me.

Just figured out the problem. Had to fix the names of my servers in my server list. Changed my group irc.rizon.net to Rizon.

Last edited by ELITEeNergizer; 08/09/10 03:52 AM.
Joined: Sep 2010
Posts: 13
E
Pikka bird
Offline
Pikka bird
E
Joined: Sep 2010
Posts: 13
Okay I can't get the second script to work. Any help?

Page 2 of 2 1 2

Link Copied to Clipboard