![]() |
|
|||||||
| Tcl scripting Tcl scripting related questions |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
ce se intampla, dau disable la o comanda, imi zice ca e ok, a doua zii constat ca , comanda e iar enable , fara sa o seteze nimeni inapoi
aici e procesul Code:
proc pub:disable {hand chan args x mix} {
global com
set comm [lindex $args 0]
if {![check:leng $comm]} {usage $x disable ; return "FAILED: not all paramatres specified"}
if {![info exists com($comm,level)]} {tell $x 18 ; return "FAILED: invalid command specified ($comm)"}
if {!$com($comm,status)} {tell $x 144 ; return "FAILED: command can not be disabled ($comm)"}
if {!$com($comm,state)} {tell $x 150 $comm; return "FAILED: command disabled already ($comm)"}
set com($comm,state) 0
tell $x 143 $comm; return "$comm" }
si com s-ar putea face ca sa se dea enable, disable de catre ownerul canalului .... ??? |
|
|
|
|
|
#2 (permalink) |
|
Administrator
aka aqwzsx |
Dintii incerci si pe urma spui ce crezi. Cat la faptul ca nu se salveaza info, doar am spus sa citesti http://mini.net/tcl/1598 acolo e scris cum sa lucrezi cu arrays si cum sa salvezi arrays. De ce arrays ? ca in scriptul care ai tu, disable e stoackat in arrays, si treb sa salvezi info despre com(*,state).
Inteleg ca din punctul tau de vedere pentru mine ar fi mai usor sa dau solutia corecta deodata, dar aceasta nu e scopul meu sa fac scripte la comanda, scopul meu sa ajut (cu ceea ce cunosc) pe cei care sunt in procesul de cunoastere a limbajului sau care programeaza. Deci mai sus te-am dat un hint, cum sa faci si unde sa cauti, dai varianta ta si te corijez, dar pina cand nu propui nici o solutie, eu nu spun nimica . Sper sa ma intelegi.
|
|
|
|
|
|
#3 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
deci ce am incercat fara succes
Code:
proc routine:addcom {comm proc help usage level status} {
global com
set com($comm,level) "$level"
set com($comm,help) "$help"
set com($comm,usage) "$usage"
set com($comm,proc) "$proc"
set com($comm,status) "$status"
foreach chan [channels] {[array get $chan $com($comm,state)];if {![info exists com($comm,state)]} { set com($comm,state) 1 } {set com($comm,state) $state}}
}
Code:
[15:52] can't read "com(changeflagsall,state)": no such element in array Code:
proc pub:disable {hand chan args x mix} {
global com
set comm [lindex $args 0]
if {![check:leng $comm]} {usage $x disable ; return "FAILED: not all paramatres specified"}
if {![info exists com($comm,level)]} {tell $x 18 ; return "FAILED: invalid command specified ($comm)"}
if {!$com($comm,status)} {tell $x 144 ; return "FAILED: command can not be disabled ($comm)"}
if {!$com($comm,state)} {tell $x 150 $comm; return "FAILED: command disabled already ($comm)"}
set com($comm,state) 0
routine:addcom:save $chan $com($comm,state)
tell $x 143 $comm; return "$comm" }
set comfile "netbots/FILES/${username}.comm"
proc routine:addcom:save {com state} {
global comfile username chan
set file [open $comfile w]
catch {
puts $file "#Dynamic Com File for $username -- written [ctime [unixtime]]\n"
puts $file "routine:addcom $chan $com($comm,state) $state"}
close $file}
Last edited by lsn; 01-12-2004 at 21:27. |
|
|
|
|
|
#4 (permalink) |
|
Administrator
aka aqwzsx |
Cu salvarea la date e foarte simplu, daca citeai link meu de mai sus, acolo ai citi asa ceva.
Code:
Persistence: Databases are supposed to exist between sessions, so here's how to save a database to a file: set fp [open Library.db w] puts $fp [list array set db [array get db]] close $fp Code:
proc routine:addchan:save {} {
global infofile username chann comm
set file [open $infofile w]
catch {
puts $file "#Dynamic Info Channel File for $username -- written [ctime [unixtime]]\n"
foreach chan [string tolower [channels]] {...}
foreach chan [array names chann *,channels] {...)
puts $file "routine:addchan [split $chan] {...}
puts $file "\n#Disabled commands\n"
puts $file [list array set com [array get com *,state]]
close $file}
Code:
puts $file "\n#Disabled commands\n" puts $file [list array set com [array get com *,state]] De exemplu daca adaugi variabila $com($comm,$chan,state), ca sa salvezi comenzile dezactivate pentru fiecare canal in parte. Procesul save care eu am dat, automat o sa integreze aceasta variabila. Last edited by UniversaliA; 15-12-2004 at 19:00. |
|
|
|
|
|
#5 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
in sfarsit le scrie in fisier
acuma problema Code:
[10:08:29] <lordskynet> .disable time [10:08:31] <lyncs> lordskynet Globaly DISABLED the command time [10:09:11] > .time [10:09:13] <lyncs> SkyNet` The command time is GLOBALY DISABLED [10:09:20] <lordskynet> .save [10:09:21] <lyncs> lordskynet Saving channel, info and user files ... [10:09:24] <lordskynet> .backup [10:09:25] <lyncs> lordskynet Backing up channel, info and user files ... [10:09:27] <lordskynet> .rehash [10:09:29] <lyncs> lordskynet Rehashed... [10:09:48] > .time [10:09:49] <lyncs> SkyNet` Thu Dec 16 10:09:49 2004 Code:
##### ADDCOM ROUTINE ###################
catch {unset com}
proc routine:addcom {comm proc help usage level status} {
global com chan
set com($comm,level) "$level"
set com($comm,help) "$help"
set com($comm,usage) "$usage"
set com($comm,proc) "$proc"
set com($comm,status) "$status"
if {![info exists com($comm,state)]} { set com($comm,state) 1 }}
daca scot Code:
if {![info exists com($comm,state)]} { set com($comm,state) 1 }
|
|
|
|
|
|
#7 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
bun am facut psa functioneze pe local, dar acuma am probleme cu numele canalului , daca e cu litere mari nu il recunoaste si nu raspunde la comenzi pe canalele alea, pt ca sa fie ok unde mai trebuie sa modific ?
|
|
|
|
|
|
#8 (permalink) |
|
Administrator
aka aqwzsx |
Ar fi mai comod si mie si tie, cand dai o intrebare referitor la un proces oarecare sau script, sa dai si sursa, sa nu ghicesc. In orice caz, din cele ghicite de mine iti sugerez sa utlizezi set chan [string tolower $chan] si dupa aceea deja sa adaugi in array, si acelas lucru cand cauti informatie, inainte de a cauta, totul faci tolower si vei evita conflictele.
|
|
|
|
|
|
#9 (permalink) |
|
Member
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37 ![]() |
inca ceva, acuma ca merge la nivel local, un |N poate da disable si la o comanda de nivel global pe canalul lui. cum ar fi mai bine
sa setez la comenzile de nivel global status 0, sau sa modific in routine:pub:parser, ca, chiar daca e disabled comanda cei cu acces global sa o poata folosi ? sau imi dai alta solutie cum sa verifice botu si sa ii zica, ca nu are acces la comanda aceea si in consecinta nu ii poate da disable ? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| probleme cu eggi... cine ma ajuta si pe mn?:) | Squit | Eggdrop | 3 | 21-09-2008 03:33 |
| probleme cu botnet | tiguan | Eggdrop | 4 | 15-05-2007 15:04 |
| Probleme pe undernet | arcade | OFF TOPIC | 19 | 15-11-2005 15:14 |
| Am probleme cu alpha v0.01.00 !!! Help Need | Killeros | a&a light script | 4 | 17-06-2005 22:21 |
| Probleme de flood. | Freezed | Tcl scripting | 1 | 26-12-2004 03:17 |