|
Joined: Jun 2006
Posts: 79
Babel fish
|
OP
Babel fish
Joined: Jun 2006
Posts: 79 |
menu * {
Protection Editor
.Ban Level $+($chr(40),%ban.level,$chr(41)):.set %ban.level $$?="limit"
.Kick Limit $+($chr(40),%kick.limit,$chr(41)):.set %kick.limit $$?="limit"
.-
.Codes $+($chr(40),%codes.limit,$chr(41)):.set %codes.limit $$?="limit"
.Caps Lock $+($chr(40),%caps.limit,$chr(41)):.set %caps.limit $$?="limit"
.Number $+($chr(40),%number.limit,$chr(41)):.set %number.limit $$?="limit"
.Symbol $+($chr(40),%symbol.limit,$chr(41)):.set %symbol.limit $$?="limit"
.Longtext $+($chr(40),%longtext.limit,$chr(41)):.set %longtext.limit $$?="limit"
.Row $+($chr(40),%row.limit,$chr(41)):.set %row.limit $$?="limit"
.Repeat $+($chr(40),%repeat.limit,$chr(41)):.set %repeat.limit $$?="limit"
.-
.Nick Lenght $+($chr(40),%nick.lenght,$chr(41)):.set %nick.lenght $$?="limit"
.Mass Join $+($chr(40),%massjoin.limit,$chr(41)):.set %massjoin.limit $$?="limit"
.Mass Join/Nick $+($chr(40),%massjoin.nick.limit,$chr(41)):.set %massjoin.nick.limit $$?="limit"
.Mass Join/Address $+($chr(40),%massjoin.address.limit,$chr(41)):.set %massjoin.address.limit $$?="limit"
.-
.Bad Nick List: {
var %a = $true, %b = 1
while (%a) {
if ($ulist(*,badnick,1) == $null) { .echo -a - Bad Nick List is empty }
.echo -a - Bad Nick: $ulist(*,badnick,%b)
.inc -u5 %b 1
if ($ulist(*,badnick,%b) == $null) { var %a = $false }
}
}
.Add:.auser badnick $$?="nickname"
.-
.Bad Ident List: {
var %a = $true, %b = 1
while (%a) {
if ($ulist(*,badident,1) == $null) { .echo -a - Bad Ident List is empty }
.echo -a - Bad Ident: $ulist(*,badident,%b)
.inc -u5 %b 1
if ($ulist(*,badident,%b) == $null) { var %a = $false }
}
}
.Add:var %a = $$?="ident" | .auser badident $+(*!*,%a,*@*)
.-
.Shit List: {
var %a = $true, %b = 1
while (%a) {
if ($ulist(*,shitlist,1) == $null) { .echo -a - Shit List is empty }
.echo -a - Shitlist: $ulist(*,shitlist,%b)
.inc -u5 %b 1
if ($ulist(*,shitlist,%b) == $null) { var %a = $false }
}
}
.Add:var %a = $$?="shit list" | .auser shitlist $+(*!*,%a,*@*)
.-
.Proxy List: {
var %a = $true, %b = 1
while (%a) {
if ($ulist(*,proxy,1) == $null) { .echo -a - Proxy List is empty }
.echo -a - Proxy: $ulist(*,proxy,%b)
.inc -u5 %b 1
if ($ulist(*,proxy,%b) == $null) { var %a = $false }
}
}
.Add:var %a = $$?="proxy list" | .auser proxy $+(*!*,%a,*@*)
}
Can anyone give me better example/idea. Or make it shorter. Thanks
|
|
|
|
Joined: Jun 2006
Posts: 79
Babel fish
|
OP
Babel fish
Joined: Jun 2006
Posts: 79 |
|
|
|
|
Joined: May 2007
Posts: 89
Babel fish
|
Babel fish
Joined: May 2007
Posts: 89 |
At first glance, you are using a similar function to list the users found in the differents list types. You could significally reduce the code size with something like this. Alias PrEdFunc {
Var %a = $true, %b = 1, %T = $1-, %T' = $remove($lower(%T),$chr(32))
Var %Nb = $ulist(*,%T',0)
If (%Nb > 0) {
If (%Nb == 1) { Echo -a - %T $+ : $ulist(*,%T',1) }
Else {
While (%b <= %Nb) {
Echo -a - %T $+ : $ulist(*,%T',%b)
Inc %b
}
}
}
Else { Echo -a - $iif(list isin %T,$remove(%T,$v1),%T) List is empty }
} The whole source becoming: Alias PrEdBr { Return $+($chr(40),$1,$chr(41)) }
Alias PrEdFunc {
Var %a = $true, %b = 1, %T = $1-, %T' = $remove($lower(%T),$chr(32))
Var %Nb = $ulist(*,%T',0)
If (%Nb > 0) {
If (%Nb == 1) { Echo -a - %T $+ : $ulist(*,%T',1) }
Else {
While (%b <= %Nb) {
Echo -a - %T $+ : $ulist(*,%T',%b)
Inc %b
}
}
}
Else { Echo -a - $iif(list isin %T,$remove(%T,$v1),%T) List is empty }
}
menu * {
Protection Editor
.Ban Level $PrEdBr(%ban.level):set %ban.level $$?="limit"
.Kick Limit $PrEdBr(%kick.limit):set %kick.limit $$?="limit"
.-
.Codes $PrEdBr(%codes.limit):set %codes.limit $$?="limit"
.Caps Lock $PrEdBr(%caps.limit):set %caps.limit $$?="limit"
.Number $PrEdBr(%number.limit):set %number.limit $$?="limit"
.Symbol $PrEdBr(%symbol.limit):set %symbol.limit $$?="limit"
.Longtext $PrEdBr(%longtext.limit):set %longtext.limit $$?="limit"
.Row $PrEdBr(%row.limit):set %row.limit $$?="limit"
.Repeat $PrEdBr(%repeat.limit):set %repeat.limit $$?="limit"
.-
.Nick Lenght $PrEdBr(%nick.lenght):set %nick.lenght $$?="limit"
.Mass Join $PrEdBr(%massjoin.limit):set %massjoin.limit $$?="limit"
.Mass Join/Nick $PrEdBr(%massjoin.nick.limit):set %massjoin.nick.limit $$?="limit"
.Mass Join/Address $PrEdBr(%massjoin.address.limit):set %massjoin.address.limit $$?="limit"
.-
.Bad Nick List:PrEdFunc Bad Nick
.Add:.auser badnick $$?="nickname"
.-
.Bad Ident List:PrEdFunc Bad Ident
.Add:var %a = $$?="ident" | .auser badident $+(*!*,%a,*@*)
.-
.Shit List:PrEdFunc Shitlist
.Add:var %a = $$?="shit list" | .auser shitlist $+(*!*,%a,*@*)
.-
.Proxy List:PrEdFunc Proxy
.Add:var %a = $$?="proxy list" | .auser proxy $+(*!*,%a,*@*)
} If I find more optimizations or another way to do it, I'll post. Cordialement
Last edited by TropNul; 02/12/07 04:48 PM.
tropnul
|
|
|
|
|