|
Joined: Aug 2006
Posts: 60
Babel fish
|
OP
Babel fish
Joined: Aug 2006
Posts: 60 |
One of my channels has rules in it, so I always give one of the rules as a kick reason. There are 20. 20 rules x 3 (warn,kick,ban) = damn big nicklist popup. So I've got the rules listed in a text file, a dzrules alias for displaying a rule or giving a warning, and dzkick and dzban aliases for kicking and banning. I now want to use $submenu to make the code for my nicklist popup even shorter. Current Nicklist Popup: menu nicklist {
DuelZone Rules
.Whining
..$submenu($enforce($1,$snick,1))
.Grand Exit
..Warn : dzrules 2 $1
..Kick : dzkick $$1 2
..Ban : dzban $$1 2 ...and so on... Other bits of the script: alias enforce {
if ($1 > 3) { return }
if ($1 == 1) return { Warn : dzrules($3,$2) }
if ($1 == 2) return { Kick : dzkick($2,$3) }
if ($1 == 3) return { Ban : dzban($2,$3) }
}
alias -l DZkick {
kick # $1 $replace($+($iif($2 != 0,$+($chr(32))),$dzrules($2),) - Rules: http://www.duelzone.org/chat/Rules.doc [DuelZone],$chr(32),$chr(32))
hadd -mu600 DZKicks $+(#,.,$ial($1,1).host) $iif($2 != 0,$2)
}
alias -l DZban {
ban -ku300 # $1 2 $replace($+($iif($2 != 0,$+($chr(32))),$dzrules($2),) - Rules: http://www.duelzone.org/chat/Rules.doc [DuelZone],$chr(32),$chr(32))
if ($hfind(DZKicks,$+(#,.,$ial($1,1).host))) {
hdel DZKicks $+(#,.,$ial($1,1).host)
}
}
alias -l DZnotice {
.notice $1 $+([,#,]) $2-
echo $color(info) # * DZnotice sent
}
alias dzrules {
if ($isid) return $read($scriptdir $+ dzrules.txt,$1)
elseif ($2) say $2 - Warning: $read($scriptdir $+ dzrules.txt,$1) [DuelZone]
else say $read($scriptdir $+ dzrules.txt,$1) [DuelZone]
} When I select DuelZone Rules > Whining > Warn I get: DZRULES($3,$2) Unknown command So yeah, tricky tricky problem. Help would be greatly appreciated.
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
i get unknown identifier $snick when actvating the popups, also whining is greyed outm although grand exit performs fine....
i guess i am missing yoiur snick alias and perhaps some other parts of the script.
btk
billythekid
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
changing it to $nick it works, well i get your error....
DZRULES($3,$2) Unknown command
i'm guessing it's because of either evaluation or parameter passing....
btk
Last edited by billythekid; 28/12/06 12:17 PM.
billythekid
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
if ($1 == 1) return { Warn : $!dzrules( $3 , $2 ) } if ($1 == 2) return { Kick : $!dzkick( $2 , $3 ) } if ($1 == 3) return { Ban : $!dzban( $2 , $3 ) }
Might be sligghtly wrong but i think this is the fix.
|
|
|
|
Joined: Aug 2006
Posts: 60
Babel fish
|
OP
Babel fish
Joined: Aug 2006
Posts: 60 |
i get unknown identifier $snick when actvating the popups, also whining is greyed outm although grand exit performs fine....
i guess i am missing yoiur snick alias and perhaps some other parts of the script.
btk  maybe $snick should be $snicks ...
|
|
|
|
Joined: Aug 2006
Posts: 60
Babel fish
|
OP
Babel fish
Joined: Aug 2006
Posts: 60 |
Edited stuff: menu nicklist {
DuelZone Rules
.Whining
..$submenu($enforce($1,[b]$snicks[/b],1))
.Grand Exit
..Warn : dzrules 2 $1
..Kick : dzkick $$1 2
..Ban : dzban $$1 2 ...and so on... Other bits of the script: alias enforce {
if ($1 > 3) { return }
if ($1 == 1) return { Warn : $!dzrules( $3 , $2 ) }
if ($1 == 2) return { Kick : $!dzkick( $2 , $3 ) }
if ($1 == 3) return { Ban : $!dzban( $2 , $3 ) }
}
alias DZkick {
kick # $1 $replace($+($iif($2 != 0,$+($chr(32))),$dzrules($2),) - Rules: http://www.duelzone.org/chat/Rules.doc [DuelZone],$chr(32),$chr(32))
hadd -mu600 DZKicks $+(#,.,$ial($1,1).host) $iif($2 != 0,$2)
}
alias DZban {
ban -ku300 # $1 2 $replace($+($iif($2 != 0,$+($chr(32))),$dzrules($2),) - Rules: http://www.duelzone.org/chat/Rules.doc [DuelZone],$chr(32),$chr(32))
if ($hfind(DZKicks,$+(#,.,$ial($1,1).host))) {
hdel DZKicks $+(#,.,$ial($1,1).host)
}
}
alias DZnotice {
.notice $1 $+([,#,]) $2-
echo $color(info) # * DZnotice sent
}
alias dzrules {
if ($isid) return $read($scriptdir $+ dzrules.txt,$1)
elseif ($2) say $2 - Warning: $read($scriptdir $+ dzrules.txt,$1) [DuelZone]
else say $read($scriptdir $+ dzrules.txt,$1) [DuelZone]
} I now get: RULE Unknown commandI think we're making progress, now to fix the new problem.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
this line if ($1 == 1) return { Warn : $!dzrules( $3 , $2 ) }
creates a submenu line that reads when created with $1- = 1 snicks 1 as Warn : $dzrules( 1 , snicks )
this in turn when selected well run this line if ($isid) return $read($scriptdir $+ dzrules.txt,$1)
which well I assume returns the contents of line 1 of the file and this line begins with the word RULE etc etc etc
so you end up with a line that is like this Warn : RULE etc etc etc
thus the source of your unknown command, you are attempting to execute the text of the file as a command.
|
|
|
|
Joined: Aug 2006
Posts: 60
Babel fish
|
OP
Babel fish
Joined: Aug 2006
Posts: 60 |
Thanks! That stuff all works now.
|
|
|
|
|