![]() |
|
|||||||
| a&a light script a&a light script support, suggestions & discussions |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#2 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
sa revenim la alias
sa presupunem ca am in felul urmator la comanda voice facem alias v si in momentul asta am salvat aliasul de forma Code:
alias(#chan,v) voice|v Code:
if {[info exists alias($chan,$comm)]} {.....}
apoi am incercat sa adaug comanda cu Code:
command -add [lindex [split $alias($chan,$comm) |] 1] $com([lindex [split $alias($chan,$comm)] 0],$proc) ..... .......... poate imi dai alta idee ? ![]() PS: folosesc procese din a&a light in scriptul vechi de aceea apar asa setarile la mine |
|
|
|
|
|
#3 (permalink) |
|
Administrator
aka aqwzsx |
data viitoare, cand ai asa gen de intrebari, te rog mult
Code:
alias(#chan,v) voice Code:
set command check:alias $chan $command Code:
proc check:alias {chan command} {
global alias
Lucrurile sunt simple in programare si cred ca cel mai important este simplicitatea si creativitatea ;) |
|
|
|
|
|
#4 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
Code:
a:command -add alias pub:alias 1132 626 |N
proc pub:alias {hand chan args x mix} {
set comm [lindex $args 0]
set aka [lindex $args 1]
if {![string length $comm]} { usage $x alias; return "FAILED: not all paramatres specified"}
if { [regexp {^(-remove|-r)$} $comm] && $aka!=""} {if {[string equal -nocase all $aka]} {alias -clean $chan; tell $x 346 ; return "removed all"} {if {![alias -exists $chan $aka]} {tell $x 343 $aka; return "no such alias ($aka)"} {tell $x 344 $aka; alias -remove $chan $aka; return "removed $aka"}}}
if { [regexp {^(-list|-l)$} $comm]} {set list [alias -list $chan]; if {![llength $list]} {tell $x 348 $chan; return "failed empty"} {tell $x 17 $list; return $list}}
if {![a:command -exists $comm]} {tell $x 18 $comm; return "FAILED: invalid command specified ($comm)"}
if {![string length $aka]} { usage $x alias; return "FAILED: not all paramatres specified"}
if { [command -exists $aka] || [alias -exists $chan $aka]} {tell $x 283 $aka; return "failed already exists a command name/alias $aka"}
if { [alias -number $chan] >= 15} {tell $x 347; return "failed already have 15 aliases"}
alias -add $chan $comm $aka
tell $x 345 "$aka $comm"
return "$comm"
}
Code:
set say(lang.1.283) "FAILED: there is already a command with name/alias «." set say(lang.1.343) "FAILED: i have no info about %B«%B alias ..." set say(lang.1.344) "Removed %B«%B alias ..." set say(lang.1.345) "Added %r«%% as alias for command %b«%%." set say(lang.1.347) "FAILED: You can only set 15 aliases." set say(lang.1.346) "Removed all aliases." set say(lang.1.348) "FAILED: No alias defined for « channel." set say(lang.1.626) "USAGE: «alias \[-remove|-list\] <command> <alias> \[all\] «" set say(lang.1.1132) "HELP: Define any ALIAS to any BOT command (you can specify up to 15 aliases per chan)" Code:
if { [string match "#*" $option]} {set args [lrange $arg 1 end]; set chan $option} { set args $arg}
if {![a:command -exists $comm]} {return} elseif { [a:command -inactive $comm $chan]} {return}
Code:
if { [string match "#*" $option]} {set args [lrange $arg 1 end]; set chan $option} { set args $arg}
set comm [alias -check $chan $comm]
if {![a:command -exists $comm]} {return} elseif { [a:command -inactive $comm $chan]} {return}
cauti Code:
puts $file "\n#Disabled local & global commands\n" puts $file "[a:command -array]" Code:
puts $file "\n#Disabled local & global commands\n"
puts $file "[a:command -array]"
puts $file "\n#Aliases for commands\n"
puts $file "[alias -array]"
|
|
|
|
|
|
#5 (permalink) |
|
Member
Join Date: Jun 2004
Location: Canada
Age: 18
Posts: 141
Rep Power: 0 ![]() |
Am corectat. Deci o varianta fina ar fi:
Code:
a:command -add alias pub:alias 1600 1500 |N
proc pub:alias {hand chan args x mix} {
set comm [lindex $args 0]
set aka [lindex $args 1]
if {![string length $comm]} { a:usage $x alias; return "FAILED: not all paramatres specified"}
if { [regexp {^(-remove|-r)$} $comm] && $aka!=""} {if {[string equal -nocase all $aka]} {alias -clean $chan; a:tell $x 1703 ; return "removed all"} {if {![alias -exists $chan $aka]} {a:tell $x 1700 $aka; return "no such alias ($aka)"} {a:tell $x 1701 $aka; alias -remove $chan $aka; return "removed $aka"}}}
if { [regexp {^(-list|-l)$} $comm]} {set list [alias -list $chan]; if {![llength $list]} {a:tell $x 1705 $chan; return "failed empty"} {a:tell $x 17 $list; return $list}}
if {![a:command -exists $comm]} {a:tell $x 18 $comm; return "FAILED: invalid command specified ($comm)"}
if {![string length $aka]} { a:usage $x alias; return "FAILED: not all paramatres specified"}
if { [a:command -exists $aka] || [alias -exists $chan $aka]} {a:tell $x 1706 $aka; return "failed already exists a command name/alias $aka"}
if { [alias -number $chan] >= 15} {a:tell $x 1704; return "failed already have 15 aliases"}
alias -add $chan $comm $aka
a:tell $x 1702 "$aka $comm"
return "$comm"
}
in fisierul de limbaj a&a_04_a_dict_en.tcl sa adaugi
set say(lang.1.1500) "usage: «alias \[-remove|-list\] <command> <alias> \[all\] «"
set say(lang.1.1600) "help: Define any ALIAS to any BOT command (you can specify up to 15 aliases per chan)"
set say(lang.1.1700) "error: i have no info about %B«%B alias ..."
set say(lang.1.1701) "Removed %B«%B alias ..."
set say(lang.1.1702) "Added %r«%% as alias for command %b«%%."
set say(lang.1.1703) "Removed all aliases."
set say(lang.1.1704) "error: You can only set 15 aliases."
set say(lang.1.1705) "error: No alias defined for « channel."
set say(lang.1.1706) "error: there is already a command with name/alias «."
in fisierul a&a_40_a_stats.tcl
cauti
puts $file "\n#Disabled local & global commands\n"
puts $file "[a:command -array]"
si faci sa arate
puts $file "\n#Disabled local & global commands\n"
puts $file "[a:command -array]"
puts $file "\n#Aliases for commands\n"
puts $file "[alias -array]"
in fisierul a&a_01_core.tcl cauti
set option [lindex $arg 0]
set chan1st $chan
si adaugi sub ele
set comm [alias -check $chan $comm]
tot in a&a_01_core.tcl adaugi procesul de alias
proc alias {cmd {chan ""} {c ""} {a ""}} {
global alias
set chan [string tolower $chan]
set c [string tolower $c]
set a [string tolower $a]
switch -exact -- $cmd {
-exists { return [info exists alias($chan,$c)]}
-check { if { [info exists alias($chan,$c)]} {return $alias($chan,$c)} else {return $c} }
-list { set temp ""; foreach w [array names alias $chan,*] {lappend temp "$w $alias($w)," ; regsub -all -nocase -- $chan, $temp "" temp}; return [string trimright [join $temp] ,] }
-number { set number 0 ; foreach w [array names alias $chan,*] {incr number}; return $number}
-add { set alias($chan,$a) $c}
-array { return[list array set alias [array get alias]]}
-clean { catch {array unset alias $chan,* }}
-remove { catch {unset alias($chan,$c)}}
default { return 0 }
}
}
Last edited by AdrianK; 13-07-2005 at 18:39. |
|
|
|
|
|
#7 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
da ai dreptate, procesul de alias era compatibil cu scriptul vechi
nu mai merg dupa restart pentru ca dupa restart se pierd Ca sa se evite acest lucru trebuie declarat alias ca variabila global in a&a_40_a_stats.tcl mai precis la procesul channel {.... Code:
-load{ global comm; variable infofile; channel -unload; if {![catch {source $infofile}]} {return 1} {return 0}}
Code:
-load{ global comm alias; variable infofile; channel -unload; if {![catch {source $infofile}]} {return 1} {return 0}}
|
|
|
|
|
|
#8 (permalink) |
|
Junior Member
Join Date: Feb 2005
Age: 30
Posts: 3
Rep Power: 0 ![]() |
am facut exact ca voi dar uite ce face scriptul da niste errori deci merge pe canal numai ca la fiecare ora cand salveaza el da erroarea asta :
1. ERROR (Jun 27 09:00): FAILED to write info file, error: invalid command name "returnarray set alias {#master.ro,s save #nospam,r rehash}" ce si unde mai trebuie modif ca nu reusesc. |
|
|
|
|
|
#10 (permalink) |
|
Junior Member
Join Date: Feb 2005
Age: 30
Posts: 3
Rep Power: 0 ![]() |
Isn ai dreptate de la spatiu era dar de aici:
eu am scris: if {![a:command -exists $comm]} {a:tell $x 18 $comm; return "FAILED: invalid command specified ($comm)"} si trebuia : if {![a:command -exists $comm]} _________{a:tell $x 18 $comm; return "FAILED: invalid command specified ($comm)"} linia_____ reprezinta spatiu lipsa care eu nu l-am pus Mercic. |
|
|
|