botlending forum  

Go Back   botlending forum > Eggdrop & TCL > Tcl scripting

Tcl scripting Tcl scripting related questions

Reply
 
LinkBack Thread Tools Display Modes
Old 08-12-2005, 17:51   #11 (permalink)
Junior Member
 
ReaL|DoG's Avatar
 
Join Date: Jul 2005
Location: Italy
Age: 21
Posts: 63
Rep Power: 0
ReaL|DoG is an unknown quantity at this point
Send a message via Yahoo to ReaL|DoG
Default

la scriptu care l-a facut Freezed.. nu poate sa faca cineva (sau chiar el) o comanda ca sa opreasca procesu? si sa nu mai continue testu?...
ReaL|DoG is offline   Reply With Quote
Old 16-12-2005, 13:04   #12 (permalink)
Junior Member
 
Join Date: Dec 2005
Posts: 71
Rep Power: 0
krimson will become famous soon enough
Post alternativa la tcl script pt testeri

parerea mea e ca nu se poate scoate factorul uman din teste.. o varianta alternativa la tot ce s'a discutat in thread'ul asta ar fi un sistem de testare manual ( evaluatorul sa ii spuna botului cand sa treaca la urmatoarea intrebare ), care sa includa si un sistem de punctaje inclus.

Adica: evaluatorul da comanda specifica fiecarei intrebari, botul anunta la sfarsitul intrebarii k cel evaluat are X secunde sa raspunda; dupa ce au trecut cele X secunde, evaluatorul evalueaza ( ) raspunsul dat, si ii transmite botului cate puncte s'au obtinut pentru intrebarea respectiva.

In functie de punctele primite, botul ii spune pers. evaluate ce scor a obtinut, si daca a promovat testul sau nu.

S'ar putea implementa comenzi gen !start !stop !question <nr> !evaluate <nick> <punctaj> (aici botul ar trebui sa stie la ce intrebare s'a referit helperul, si sa nu permita afisarea unei intrebari noi pana nu se evalueaza cea precedenta, dar nici evaluarea de 2 ori la aceeasi intrebare).

Astept sugestii
krimson is offline   Reply With Quote
Old 07-09-2006, 02:53   #13 (permalink)
Junior Member
 
Join Date: Sep 2006
Age: 36
Posts: 7
Rep Power: 0
vlad2006 is an unknown quantity at this point
Default help me pliz

Deci am incercat sa fac un tcl care ca atunci cand dai !start sa zica botul un lucru din minut in minut .... da nu merge nu stiu ce are pliz ajutati-ma !!

Code:
set intrebarea1 "1. Ce face setarea .chanset +secret?"
bind pub m|- !start start
bind pub m|- !start stop
bind time -|- "* * * * *" 1
set canal "#bestttest"
# Intrebarea 1
#!1
proc 1 {min hour day month year} {
global intrebarea1 da 
if {$da == 1} {putquick "PRIVMSG $canal :$intrebarea1"} else {
putquick ""}
return "Asked Question" }

#starts the game if it isn't running.
proc start {nick host hand chan text} {
	global da
        if {$da==0} {
        set da 1
 }

}

proc stop {nick host hand chan text} {
	global da
	if {$da==1} {
        set da 0
 }
}

Last edited by lsn; 12-09-2006 at 08:25. Reason: Use [code] for script
vlad2006 is offline   Reply With Quote
Old 07-09-2006, 10:11   #14 (permalink)
Junior Member
 
Join Date: Dec 2005
Posts: 71
Rep Power: 0
krimson will become famous soon enough
Default

inainte de toate:
1. cand mai postezi cod, te rog sa o faci intre tagurile [code] si [/code]
2. threadurile cu subiect (titlu) gen 'help me pliz' sunt sterse de regula foarte repede. incearca sa pui un scurt rezumat al problemei tale pe post de titlu.

cateva din greselile importante din codul tau:
1. nu folosi niciodata instructiuni de trimitere goale. pur si simplu nu isi au rostul
Code:
putquick ""
2. e de preferat sa folosesti nume mai descriptive pentru denumirea proceselor (nu doar "1").
3. in acelasi proc 1, trebuia declarata si variabila $canal ca fiind globala. din cauza asta nu primeai nici un mesaj pe canal. (fie declari canal la global, fie folosesti in proc $::canal in loc de $canal)

ce as folosi eu:
Code:
set ask(chan) "#canal"
set ask(qmax) "2"
set ask(question1) "intrebarea 1"
set ask(question2) "intrebarea 2"
## adaugi intrebari dupa modelul de mai sus
## dar modifici si $ask(qmax)

bind pubm m|m "$ask(chan) !start" pub:start
bind pubm m|m "$ask(chan) !stop" pub:stop
bind time - "* * * * *" timed:ask

proc pub:start {nick uhost hand chan arg} {
global ask

  if {$ask(start)} { 
    puthelp "PRIVMSG $chan :questions already started" 
  } else {
    set ask(start) 1
    set ask(q) 1
    puthelp "PRIVMSG $chan :starting questions"
  }
}

proc pub:stop {nick uhost hand chan arg} {
global ask

  if {!$ask(start)} {
    puthelp "PRIVMSG $chan :questions not running"
  } else {
    set ask(start) 0
    puthelp "PRIVMSG $chan :stopping questions"
  }
}

proc timed:ask {min hour day month year} {
global ask

  if {![info exists ask(start)]} { set ask(start) 0 }
  if {$ask(start)} {
    if {$ask(q) < [expr $ask(qmax)+1]} {
      puthelp "PRIVMSG $ask(chan) :$ask(question$ask(q))"
      incr ask(q)
    } else {
      set ask(start) 0
  }
}
krimson is offline   Reply With Quote
Old 08-09-2006, 02:23   #15 (permalink)
Junior Member
 
Join Date: Sep 2006
Age: 36
Posts: 7
Rep Power: 0
vlad2006 is an unknown quantity at this point
Default

Astept idei ce sa mai modific la urmatorul script de teste pentru helperi ......
Acest script cand pune intrebareaza seteaza modulul +m la canal ... iar cand cel care trebuie sa raspunda scoate modulul +m !

Code:
#############
#BluMan TCL #
#Helper test#
#############

set ask(chan) "#testboot"
set ask(qmax) "10"
set ask(welcome) "Bine ai venit .... testul incepe intr-un minut!"
set ask(reguli) "Ai la dispozitie 60 sec pentru a raspunde la intrebare si 60 secunde pentru a te gandi!"
set ask(question1) "Intrebarea 1"
set ask(question2) "Intrebarea 2"
set ask(question3) "intrebarea 3"
set ask(question4) "intrebarea 4"
set ask(question5) "intrebarea 5"
set ask(question6) "intrebarea 6"
set ask(question7) "intrebarea 7"
set ask(question8) "intrebarea 8"
set ask(question9) "intrebarea 9"
set ask(question10) "intrebarea 10"
## adaugi intrebari dupa modelul de mai sus
## dar modifici si $ask(qmax)

bind pubm m|m "$ask(chan) !start" pub:start
bind pubm m|m "$ask(chan) !stop" pub:stop
bind time - "01 * * * *" timed:ask
bind time - "03 * * * *" timed:ask
bind time - "05 * * * *" timed:ask
bind time - "07 * * * *" timed:ask
bind time - "09 * * * *" timed:ask
bind time - "11 * * * *" timed:ask
bind time - "13 * * * *" timed:ask
bind time - "15 * * * *" timed:ask
bind time - "17 * * * *" timed:ask
bind time - "19 * * * *" timed:ask
bind time - "21 * * * *" timed:ask
bind time - "23 * * * *" timed:ask
bind time - "25 * * * *" timed:ask
bind time - "27 * * * *" timed:ask
bind time - "29 * * * *" timed:ask
bind time - "31 * * * *" timed:ask
bind time - "33 * * * *" timed:ask
bind time - "35 * * * *" timed:ask
bind time - "37 * * * *" timed:ask
bind time - "39 * * * *" timed:ask
bind time - "41 * * * *" timed:ask
bind time - "43 * * * *" timed:ask
bind time - "45 * * * *" timed:ask
bind time - "47 * * * *" timed:ask
bind time - "49 * * * *" timed:ask
bind time - "51 * * * *" timed:ask
bind time - "53 * * * *" timed:ask
bind time - "55 * * * *" timed:ask
bind time - "57 * * * *" timed:ask
bind time - "59 * * * *" timed:ask
bind time - "01 * * * *" timed:modem
bind time - "02 * * * *" timed:modemm
bind time - "03 * * * *" timed:modem
bind time - "04 * * * *" timed:modemm
bind time - "05 * * * *" timed:modem
bind time - "06 * * * *" timed:modemm
bind time - "07 * * * *" timed:modem
bind time - "08 * * * *" timed:modemm
bind time - "09 * * * *" timed:modem
bind time - "10 * * * *" timed:modemm
bind time - "11 * * * *" timed:modem
bind time - "12 * * * *" timed:modemm
bind time - "13 * * * *" timed:modem
bind time - "14 * * * *" timed:modemm
bind time - "15 * * * *" timed:modem
bind time - "16 * * * *" timed:modemm
bind time - "17 * * * *" timed:modem
bind time - "18 * * * *" timed:modemm
bind time - "19 * * * *" timed:modem
bind time - "20 * * * *" timed:modemm
bind time - "21 * * * *" timed:modem
bind time - "22 * * * *" timed:modemm
bind time - "23 * * * *" timed:modem
bind time - "24 * * * *" timed:modemm
bind time - "25 * * * *" timed:modem
bind time - "26 * * * *" timed:modemm
bind time - "27 * * * *" timed:modem
bind time - "28 * * * *" timed:modemm
bind time - "29 * * * *" timed:modem
bind time - "30 * * * *" timed:modemm
bind time - "31 * * * *" timed:modem
bind time - "32 * * * *" timed:modemm
bind time - "33 * * * *" timed:modem
bind time - "34 * * * *" timed:modemm
bind time - "35 * * * *" timed:modem
bind time - "36 * * * *" timed:modemm
bind time - "37 * * * *" timed:modem
bind time - "38 * * * *" timed:modemm
bind time - "39 * * * *" timed:modem
bind time - "40 * * * *" timed:modemm
bind time - "41 * * * *" timed:modem
bind time - "42 * * * *" timed:modemm
bind time - "43 * * * *" timed:modem
bind time - "44 * * * *" timed:modemm
bind time - "45 * * * *" timed:modem
bind time - "46 * * * *" timed:modemm
bind time - "47 * * * *" timed:modem
bind time - "48 * * * *" timed:modemm
bind time - "49 * * * *" timed:modem
bind time - "50 * * * *" timed:modemm
bind time - "51 * * * *" timed:modem
bind time - "52 * * * *" timed:modemm
bind time - "53 * * * *" timed:modem
bind time - "54 * * * *" timed:modemm
bind time - "55 * * * *" timed:modem
bind time - "56 * * * *" timed:modemm
bind time - "57 * * * *" timed:modem
bind time - "58 * * * *" timed:modemm
bind time - "59 * * * *" timed:modem
bind time - "60 * * * *" timed:modemm




proc pub:start {nick uhost hand chan arg} {
global ask

  if {$ask(start)} { 
    puthelp "PRIVMSG $chan :questions already started" 
  } else {
    set ask(start) 1
    set ask(q) 1
    puthelp "PRIVMSG $chan :$ask(welcome)"
    puthelp "PRIVMSG $chan :$ask(reguli)"
  }
}

proc pub:stop {nick uhost hand chan arg} {
global ask

  if {!$ask(start)} {
    puthelp "PRIVMSG $chan :questions not running"
  } else {
    set ask(start) 0
    puthelp "PRIVMSG $chan :stopping questions"
  }
}

proc timed:ask {min hour day month year} {
global ask

  if {![info exists ask(start)]} { set ask(start) 0 }
  if {$ask(start)} {
    if {$ask(q) < [expr $ask(qmax)+1]} {
      puthelp "PRIVMSG $ask(chan) :$ask(question$ask(q))"
      incr ask(q)
    } else {
      set ask(start) 0
  }
}
}

proc timed:modem {min hour day month year} {
global ask

if {$ask(start) == 1} {putquick "MODE $ask(chan) +m"} else {
puthelp ""}
 }
  

proc timed:modemm {min hour day month year} {
global ask

if {$ask(start) == 1} {putquick "MODE $ask(chan) -m"} else {
puthelp ""}

 }


return "helper tcl"
vlad2006 is offline   Reply With Quote
Old 08-09-2006, 11:40   #16 (permalink)
Junior Member
 
Join Date: Dec 2005
Posts: 71
Rep Power: 0
krimson will become famous soon enough
Default

in primul rand ai folosit mult prea multe binduri. toate cele 59 de binduri (unde e si al 60'lea?) puteau fi inlocuite simplu, cu o singura linie:
Code:
bind time - "* * * * *" timed:ask
nu ai nevoie de proc'urile modem si modemm. ai putea pur si simplu sa muti etapa asta chiar in timed:ask (nu uita sa adaugi un spatiu intre cifre si '[' la utimer)
Code:
proc timed:ask {min hour day month year} {
global ask

  if {![info exists ask(start)]} { set ask(start) 0 }
  if {$ask(start)} {
    if {$ask(q) < [expr $ask(qmax)+1]} {
      pushmode $ask(chan) +m
      flushmode $ask(chan)
      utimer 2[list puthelp "PRIVMSG $ask(chan) :$ask(question$ask(q))"]
      utimer 10[list pushmode $ask(chan) -m]
      incr ask(q)
    } else {
      set ask(start) 0
  }
}
}
in general cand aplici moduri pe canale, e mai indicat sa folosesti pushmode (sintaxa o gasesti aici)

cat despre instructiunile puthelp goale, dupa cum am spus si mai inainte, nu'si au rostul. nu e obligatoriu sa ai else dupa orice if, asa ca varianta corecta a codului tau este:
Code:
if {$ask(start) == 1} {putquick "MODE $ask(chan) -m"}
krimson is offline   Reply With Quote
Old 08-09-2006, 12:06   #17 (permalink)
TCB & Ratings projects Member, #Mythic representative
 
arcade's Avatar
 
Join Date: Jun 2004
Location: In fatza calculatorului!!
Age: 19
Posts: 221
Rep Power: 37
arcade is on a distinguished road
Send a message via Yahoo to arcade
Default

eu as sugera ceva mai interesant:
Code:
proc pub:start {nick uhost hand chan arg} {
global ask
    bind time - "* * * * *" timed:ask
    puthelp "PRIVMSG $chan :$ask(welcome)"
    puthelp "PRIVMSG $chan :$ask(reguli)"
}
Code:
proc pub:stop {nick uhost hand chan arg} {

    unbind time - "* * * * *" timed:ask
    puthelp "PRIVMSG $chan :stopping questions"

}
si

Code:
proc timed:ask {min hour day month year} {
global ask

  if {![info exists ask(start)]} { set ask(start) 0 }
  if {$ask(start)} {
    if {$ask(q) < [expr $ask(qmax)+1]} {
      pushmode $ask(chan) +m
      flushmode $ask(chan)
      utimer 2[list puthelp "PRIVMSG $ask(chan) :$ask(question$ask(q))"]
      utimer 10[list pushmode $ask(chan) -m]
      incr ask(q)
    } else {
      unbind time - "*****" timed:ask
      set ask(q) 1
  }
}
}
Deci mie in principiu nu imi place sa am un timer care sa ruleze un proces care nu se executa decat dak setam noi o variabila, asa ca mi se pare mai fiabil sa punem bindul pe time in interiorul la start, si ca sa o oprim, punem un unbind la stop, si in timed:ask, in caz ca se termina intrebarile.

Mentionez ca ati uitat sa resetati numarul de intrebari puse atunci cand se termina lista, si asta nu e bine pt ca atunci tot scriptul asta va rula o singura data, iar in rest pauza pt k nr de intrebari va ajunge la maxim si asa va ramane.

O chestie pe care nu o consider optima avand in vedere ca este un script de teste e timpul mic de raspuns (50 secunde dupa cum a facut krimson timerul de la +m), dar in fine asta nu ma priveste
__________________
Fuck oFF!
arcade is offline   Reply With Quote
Old 08-09-2006, 12:27   #18 (permalink)
Junior Member
 
Robby_14's Avatar
 
Join Date: Jul 2006
Posts: 7
Rep Power: 0
Robby_14 is an unknown quantity at this point
Smile

Am gasit cu ceva timp in urma un tcl de teste aici pe forum si mi se pare bun dupa ce am facut mici modificari. Dar el functioneaza asa !test Nickname dar ar fi perfect sa functioneze asa !test <numarul testului> <nick> . Asta nu stiu cum se face.
Codul arata cam asa:

Code:
a:command -add test       pub:test      0000 000 n

proc pub:test {hand chan args x mix} {
	global botnick
	set who1 	[lindex $args 0]
	set who2		[lindex $args 1]
	set test(chan) 	"#BSCegg-Teste"
	
	logfile pjk $test(chan) "logs/test.log" 

	if { ($who1 == "") || ($who2 == "") } {a:usage $x test ; return "FAILED: someone is missing"}

set welcome	"Salut $who1 & $who2. Eu sunt $botnick, unul dintre botii #BSCeg. Astazi veti da testul cu mine. Dar inainte sa incepem cu cateva reguli:"
set reguli {
"Pentru a fi acceptat trebuie sa nu mai fi helper la un alt canal de botlending."
"Pentru a trece testul trebuie sa sti 10 intrebari din cele 15 care ti le voi pune."
"Iti urez mult norc!"
}
set intr1  	" 1. Care este cel mai mare flag?"
set intr2  	" 2. Cum dai acces cand bagi botul pe un canal (comanda)?"
set intr3  	" 3. Cum dai sa seteze el limita?"
set intr4  	" 4. Cum faci sa blochezi topicul (comanda)?"
set intr5  	" 5. Care sunt primele 3 flaguri in ordine descrescatoare?"
set intr6  	" 6. Ce face flagul +a?"
set intr7  	" 7. Ce este greet?"
set intr8  	" 8. Cum se seteaza flood-deop?"
set intr9  	" 9. Ce face botul cand dai comanda .cycle ?"
set intr10 "10. Ce face flagul d?"
set intr11 "11. Ce comanda trebuie data ca botuil sa memoreze modurile canalului?"
set intr12 "12. Ce reprezinta flagul l?"
set intr13 "13. Cum se seteaza autovoice?"
set intr14 "14. Cum se seteaza revenge-mode ca sa fie pornit?"
set final   "15. Cum pui autoop la x si la psyBNC (comenzile) ?"

	if { $chan == $test(chan) } {

		putquick "MODE $chan +m" ; puthelp "PRIVMSG $chan :$welcome" ; foreach line $reguli { puthelp "PRIVMSG $chan :[subst -noc $line]" }
		utimer 140[list puthelp "PRIVMSG $chan :Intrebarea $intr1"]  ; utimer 145[list putquick "MODE $chan -m"] ; utimer 270[list putquick "MODE $chan +m"]
		utimer 280[list puthelp "PRIVMSG $chan :Intrebarea $intr2"]  ; utimer 285[list putquick "MODE $chan -m"] ; utimer 410[list putquick "MODE $chan +m"]
		utimer 420[list puthelp "PRIVMSG $chan :Intrebarea $intr3"]  ; utimer 425[list putquick "MODE $chan -m"] ; utimer 550[list putquick "MODE $chan +m"]
		utimer 560[list puthelp "PRIVMSG $chan :Intrebarea $intr4"]  ; utimer 565[list putquick "MODE $chan -m"] ; utimer 690[list putquick "MODE $chan +m"]
		utimer 700[list puthelp "PRIVMSG $chan :Intrebarea $intr5"]  ; utimer 705[list putquick "MODE $chan -m"] ; utimer 830[list putquick "MODE $chan +m"]
		utimer 840[list puthelp "PRIVMSG $chan :Intrebarea $intr6"]  ; utimer 845[list putquick "MODE $chan -m"] ; utimer 970[list putquick "MODE $chan +m"]
		utimer 980[list puthelp "PRIVMSG $chan :Intrebarea $intr7"]  ; utimer 985[list putquick "MODE $chan -m"] ; utimer 1110[list putquick "MODE $chan +m"]
		utimer 1120[list puthelp "PRIVMSG $chan :Intrebarea $intr8"]  ; utimer 1125[list putquick "MODE $chan -m"] ; utimer 1250[list putquick "MODE $chan +m"]
		utimer 1260[list puthelp "PRIVMSG $chan :Intrebarea $intr9"]  ; utimer 1265[list putquick "MODE $chan -m"] ; utimer 1390[list putquick "MODE $chan +m"]
		utimer 1400[list puthelp "PRIVMSG $chan :Intrebarea $intr10"] ; utimer 1405[list putquick "MODE $chan -m"] ; utimer 1530[list putquick "MODE $chan +m"]
		utimer 1540[list puthelp "PRIVMSG $chan :Intrebarea $intr11"] ; utimer 1545[list putquick "MODE $chan -m"] ; utimer 1670[list putquick "MODE $chan +m"]
		utimer 1680[list puthelp "PRIVMSG $chan :Intrebarea $intr12"] ; utimer 1685[list putquick "MODE $chan -m"] ; utimer 1810[list putquick "MODE $chan +m"]
		utimer 1820[list puthelp "PRIVMSG $chan :Intrebarea $intr13"] ; utimer 1825[list putquick "MODE $chan -m"] ; utimer 1950[list putquick "MODE $chan +m"]
		utimer 1960[list puthelp "PRIVMSG $chan :Intrebarea $intr14"] ; utimer 1965[list putquick "MODE $chan -m"] ; utimer 2090[list putquick "MODE $chan +m"]
		utimer 2100[list puthelp "PRIVMSG $chan :Intrebarea $intr15"] ; utimer 2105[list putquick "MODE $chan -m"]
		
		utimer 2245[list puthelp "PRIVMSG $chan :$final"]
		

	} else { puthelp "PRIVMSG $chan :Invalid channel to give command on." ; return "FAILED: invalid channel" }

	return "for $who1 & $who2 started."
}
Robby_14 is offline   Reply With Quote
Old 27-01-2007, 23:31   #19 (permalink)
Junior Member
 
Join Date: Aug 2006
Age: 16
Posts: 3
Rep Power: 0
MaDaLiN2 is an unknown quantity at this point
Default

robby .... am pus tcl`u tau pe bot dar cand dau !test nick .. pauza ce nu e bun ?
MaDaLiN2 is offline   Reply With Quote
Old 30-01-2007, 05:29   #20 (permalink)
Junior Member
 
strugurel's Avatar
 
Join Date: Oct 2005
Location: Sibiu
Age: 19
Posts: 6
Rep Power: 0
strugurel is an unknown quantity at this point
Send a message via Yahoo to strugurel
Default mhâm :)

Madalin, incearca sa lasi spatiu intre: utimer numar si [ si plus de asta...nu vad unde este set intr15 si ai putea sa dai !test nick1 nick2.. dupa ce rezolvi toate acestea :P Bafta
__________________
Tu incerci sa inveti ceea ce eu imi doresc sa uit...
strugurel 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


All times are GMT +3. The time now is 11:59.


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