botlending forum  

Go Back   botlending forum > Eggdrop & TCL > Tcl scripting

Tcl scripting Tcl scripting related questions

Reply
 
LinkBack Thread Tools Display Modes
Old 01-11-2004, 14:22   #1 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37
lsn will become famous soon enough
Exclamation probleme cu disable ...

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 .... ???
lsn is offline   Reply With Quote
Old 30-11-2004, 18:26   #2 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 832
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

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.
UniversaliA is offline   Reply With Quote
Old 01-12-2004, 17:10   #3 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37
lsn will become famous soon enough
Default

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}} 
}
primesc
Code:
[15:52] can't read "com(changeflagsall,state)": no such element in array
si la procedura de salvare m-am blocat complet

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}
cred ca am scris doar prostii mai sus, dar nu prea am inteles chestiile cu array

Last edited by lsn; 01-12-2004 at 21:27.
lsn is offline   Reply With Quote
Old 15-12-2004, 04:51   #4 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 832
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

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
Deci tie iti ramanea doar in procesul routine:addchan:save sa adaugi doar 2 randuri, (+ sa declari comm ca globala), el trebuie sa arate cam asa

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}
La global am adaugat com, +randurile adaugate sunt
Code:
puts $file "\n#Disabled commands\n" 
puts $file	[list array set com [array get com *,state]]
Deci aceasta va fi disable global, pentru disable local, treb putin sa lucrezi la comenzile enble disable si procesul routine:pub:parser.

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.
UniversaliA is offline   Reply With Quote
Old 16-12-2004, 11:09   #5 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37
lsn will become famous soon enough
Default

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
la procesul

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 }}
ce trebuie aici modificat ?

daca scot
Code:
if {![info exists com($comm,state)]} { set com($comm,state) 1 }
nu mai functioneaza deloc
lsn is offline   Reply With Quote
Old 16-12-2004, 14:29   #6 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 832
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

sterge
Code:
catch {unset com}
UniversaliA is offline   Reply With Quote
Old 16-12-2004, 18:22   #7 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37
lsn will become famous soon enough
Default

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 ?
lsn is offline   Reply With Quote
Old 18-12-2004, 01:24   #8 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 832
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

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.
UniversaliA is offline   Reply With Quote
Old 21-12-2004, 17:57   #9 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37
lsn will become famous soon enough
Default

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 ?
lsn is offline   Reply With Quote
Old 22-12-2004, 03:12   #10 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 832
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

Atributul status 0 special pentru aceasta e destinat.
UniversaliA is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT +3. The time now is 12:39.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.