mIRC Home    About    Download    Register    News    Help

Print Thread
check user script #129836 09/09/05 07:55 PM
Joined: Apr 2005
Posts: 72
B
bodo0815 Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2005
Posts: 72
hello
i will check if users on channel1 and channel2
is user in channel1 but not in channel2 then kick+ban
i have this code:
Code:
 alias checkusers { 
  if ( $1 ischan ) && ( $2 ischan ) {  
    var %c = 1, %cusers 
    while $nick($1,%c) { 
      if ( $v1 !ison $2 ) && ( $v1 !isvoice $1 ) %cusers = $addtok(%cusers,$v1,44) 
      inc %c 
    } 
    msg # $iif( %cusers, **Not in $2 $+ : $v1, None) 
  } 
  else echo $colour(info) -a ** Syntax: /checkusers <#Channel1> <#Channel2> 
} 

...but too many users = * /set: line too long (line 5, check.mrc)

plz help me & thx bodo

Re: check user script #129837 10/09/05 02:14 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Going from your description in the post, rather than the code that you posted, this should work. Unfortunately I'm unable to test it at present
Code:
alias checkusers {
  if ($$1 ischan) && ($$2 ischan) {
    set %chan $iif($nick($$1,0) < $nick($$2,0),$$1,$$2)
    set %chan2 $iif(%chan == $$1,$$2,$$1)
    var %c = 1
    while %c <= $nick(%chan,0) {
      if ($nick(%chan,%c) !ison %chan2) && ($me isop %chan) {        .ban -k %chan $nick(%chan,%c) 3      }
      inc %c
    }
  }
  elseif ($$1 ischan) {    .msg $nick Sorry, you also need to be on $$2  }
  elseif ($$2 ischan) {    .msg $nick Sorry, you also need to be on $$1  }
  else {    .msg $nick Sorry, but you need to be on both $$1 & $$2  }
}
  

Re: check user script #129838 10/09/05 03:01 AM
Joined: Jul 2003
Posts: 655
Om3n Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
The reason for the error is because '$addtok(%cusers,$v1,44)' is first evaluating %cusers, when there are too many users the line of code and %cusers variable become very long, to the point where mirc is unable to process it efficiently (hence the undocumented limit).


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Re: check user script #129839 10/09/05 03:21 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm not too long a hash item/data can be but maybe that would help, or even an INI, I really think there's no need in creating a hash table with only one item but... *shrugs*

-Andy

Re: check user script #129840 10/09/05 07:36 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Creating a hash table for a single item would be a waste. If he needs to work with the information in a variable, one way to get around the length limitation is to use binary variables.

Unlike local & global variables, binary variables don't have a maximum length...or at least not one that I've been able to discover, and I've tested up to 100,000 characters in length.

However, I'm unsure as to why he's even working with a variable containing all of the names, as that is slightly counter to his original request, which I responded to earlier.

Re: check user script #129841 10/09/05 02:40 PM
Joined: Apr 2005
Posts: 72
B
bodo0815 Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2005
Posts: 72
thx but the script do not work confused
there are nothing...

how is the script with hashtables?

thx bodo

Re: check user script #129842 10/09/05 08:32 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Why are you wanting to store the nicks? Is it a list of the nicks that were kick/banned from one channel because they weren't in the other? A list of all the nicks that were in both, and therefor didn't need to be kicked/banned? or something else altogether?

I need to know why you're keeping a list of the nicks and what you intend to do with that list before I can go any further.

Re: check user script #129843 10/09/05 09:59 PM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Why do this only when you run a command? mIRC has events like on JOIN, on PART, on NICK and timers. Just have a script check if someone is in the correct channel when he enters the other channel. If you want a short time to comply, put the test in a 30 second timer or something before checking. Also check on part so that so one just parts the required channel after a few minutes. Probably best to give the timers a name that is related to the nickname, so you can disable the timer when nick joins channel2 and can change the timer when he changes his nick during those 30 seconds...

No need to remember to run the alias every few hours or so, just have it done automatically. This also prevents having to kick 20 people at once (flood) if it's a big channel...

Re: check user script #129844 11/09/05 11:32 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
alias checkusers { 
  if ( $1 ischan ) && ( $2 ischan ) {  
    var %c = 1, %cusers 
    while $nick($1,%c) { 
      if ( $v1 !ison $2 ) && ( $v1 !isvoice $1 ) %cusers = $addtok(%cusers,$v1,44) 
      inc %c
      if ($len(%cusers) > 400)  { msg # **Not in $2 $+ : %cusers | %cusers =  }
    } 
    if (%cusers != ) { msg # $iif( %cusers, **Not in $2 $+ : $v1, None) }
  } 
  else echo $colour(info) -a ** Syntax: /checkusers <#Channel1> <#Channel2> 
}


Try that , each time the %cusers gets over 400 characters it spools it out to the channel, i think 400 or 500 is max to channel line length

Re: check user script #129845 12/09/05 10:41 AM
Joined: Apr 2005
Posts: 72
B
bodo0815 Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2005
Posts: 72
thx DaveC

i need a space between the nicks (without commas
now: nick,nick,nick,nick...
i need: nick nick nick nick...??

thx bodo

Re: check user script #129846 12/09/05 10:48 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Well why did you use commas in the first place then?!?!?!?!?!

locate
$addtok(%cusers,$v1,44)
replace with
$addtok(%cusers,$v1,32)