mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 16
G
GaMa Offline OP
Pikka bird
OP Offline
Pikka bird
G
Joined: Mar 2006
Posts: 16
I have been making a script to ~r (realname) ban function. Before I explain any further, here is what my code looks like:

Code:
raw 311:*:{
  if (%theop == rban) {
    set %rban_realname $6-
    echo -a ECHO: %rban_realname
  }
}


alias rban {
  set -u6 %theop rban
  whois $2
  .timer 1 3 echo -a ECHO2: %rban_realname
  if ($chr(32) isin %rban_realname) {
    .timer 1 10 set %rban_mask $replace(%rban_realname,$chr(32),$chr(95))
    .timer 1 11 mode $1 +b ~r: $+ [ %rban_mask ]
    .timer 1 12 unset %rban*
  }
  if ($chr(32) !isin %rban_realname) {
    .timer 1 10 mode $1 +b ~r: $+ [ %rban_realname ]
    .timer 1 11 unset %rban*
  }
}

menu nicklist,query {
  Real Name:rban $active $$1
}


The first echo (in the raw event) shows, while the timer echo, will not show. I have left an outrageous timer time for the banning process and still does not ban. I left in the large amount to show you.

I have found a way to work around this by using /write and $read... but would like to step away from that and just use variables.

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
When you set a timer, it evaluates identifiers and variables at that instant, not when the timer triggers.

Use $!identifier() to get them to evaluate upon timer execution.. I also think %!var works, but not 100% sure.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
not %!var, ! is a valid variable character

% $+ var or $+(%,var)


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Ah, yeah.. Cheers smile

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Bekar explainded why your code did not work; but I'd suggest the following modification of your code:
Code:
; menu
menu nicklist {
  Ban Real Name of $$1 : rban $active $$1
}

; set a var for: action, chan and nick
alias rban {
  set -eu6 %theop rban
  set -eu6 %rban_chan $1
  set -eu6 %rban_nick $2
  who $2
}

; who reply: if a var for "action rban" is set, and the nick to rban is this nick: 
raw 352:*:{
  if ((%theop == rban) && (%rban_nick == $6)) {
    ; ban his realname on the chan stored above, replacging space with underscore
    mode %rban_chan +b ~r: $+ $replace($9-,$chr(32),$chr(95))
    unset %rban*
  }
}
The method will be faster than yours:
- who is faster than whois
- the ban will be set the very moment the raw (352 who reply) had been received.

Notes:
- I think you don't need a if/else check to determine whether there are $chr(32) in the realname or not. If there are no $chr(32), the $replace will nevertheless return the (untouched) realname
- In your code (raw 311): $1 might by chance be the channel you wanted to set the ban on. I stored the name of the chan in a variable as well, to ensure that. For the same reason; I removed the "ban option" for query popups. Executed out of a query and without further input, your script cannot know on what chan the ban should be set.

Regards smile


Link Copied to Clipboard