#PBC Official Forum  #PBC Official Forum
Noi Iti Protejam Chanu De LAMERI
#PBC Official Forum
FAQFAQ  CautareCautare  InregistrareInregistrare  ProfilProfil  MembriMembri  GrupuriGrupuri  Mesaje privateMesaje private  AutentificareAutentificare 

calculator.tcl

 
Raspunde la subiect    Pagina de start a forumului #PBC Official Forum -> TCL Scripts
Subiectul anterior :: Subiectul urmator  
Autor Mesaj
TrAsNeT
Junior 2
Junior 2
TrAsNeT

Data inscrierii: 12/Mai/2008
Mesaje: 44
Localitate: Sighet

MesajTrimis: 14/05/2008 00:19    Titlul subiectului: calculator.tcl Raspunde cu citat (quote)

set calcversion v1.0
set calcauthor TrAsNeT

proc con:calc {equation} {
set equation $equation
if {![catch {set rep [expr $equation]} error]} {return "Rezultatul: $equation = [split $rep]"} {return "Error: see .calc help"}
}
proc doit {nick uhost hand chan num} {
set doit [lindex $num 0]
set conv [lrange $num 1 end]
regsub {:} $chan { } chanarg
set chantype [lindex $chanarg 0]
set channame [lindex $chanarg 1]
set help 0
if {($doit == "calc") && ($conv == "") || ($conv == "help")} {
set help 1
set rep {
"Calc help: Putem face operatii de matematica foarte repede:"
" Adunare: .calc 1 + 1"
" Scadere: .calc 2 - 1"
" Inmultire: .calc 2 * 2"
" Impartire: .calc 4 / 2"
"Spatiile NU conteaza, operatiile se pot face si cu Spatiu si fara Spatiu: .calc 1+1 este tot aceeasi cu .calc 1 + 1"
"Acest script a fost facut de:"
"TrAsNeT @ #TeamHelp @ UnderNet"
}
} else {
if {($conv == "") || ($conv == "help")} {
set help 1
set rep {
"Cum se foloseste: PUB, MSG or DCC: .calc,"
"Examplu: Adunare 1 + 10"
" : .calc 1 + 10"
" Rezulta: 1 + 10 = 11"
}
}
}
if {($help != 1) && ($conv != "" || $conv != "help")} {
### This is the main call where all the convert proc's are done Smile
# uncomment the line below for debug purposes, if needed.
if {$doit == "calc"} {putcmdlog "Calc Debug: nick '$nick' uhost '$uhost' hand '$hand' chan '$chan' num '$num'"}
set rep [con:$doit $conv]
}

if {($chantype == "pub")} {
if {$help == 1} {
foreach line $rep {puthelp "PRIVMSG $nick :$line"}
return
} else {
puthelp "PRIVMSG $channame :[join $rep]"
return
}
}
if {$chantype == "privmsg"} {
if {$help == 1} {
foreach line $rep {puthelp "PRIVMSG $nick :$line"}
return
} else {
puthelp "PRIVMSG $nick :[join $rep]"
return
}
}
if {$chantype == "dcc"} {
set idx $channame
if {$help == 1} {
foreach line $rep {putdcc $idx "$line"}
return
} else {
putdcc $idx "[join $rep]"
return
}
}
}
proc con:calc:pub {nick uhost hand chan num} {doit $nick $uhost $hand pub:$chan "calc [split $num]"}
proc con:calc:msg {nick uhost hand num} {doit $nick $uhost $hand privmsg "calc [split $num]"}
proc con:calc:dcc {hand idx num} {doit "" "" $hand dcc:$idx "calc [split $num]"}

bind pub - .calc con:calc:pub
bind msg - .calc con:calc:msg
bind dcc - calc con:calc:dcc

putlog "Calculator TCL Version $calcversion Made By $calcauthor !"
Sus
Vezi profilul utilizatorului Trimite mesaj privat
Afiseaza mesajele pentru a le previzualiza:   
Raspunde la subiect    Pagina de start a forumului #PBC Official Forum -> TCL Scripts Ora este GMT + 2 ore
Pagina 1 din 1

 
Mergi direct la:  
Nu puteti crea un subiect nou in acest forum
Nu puteti raspunde in subiectele acestui forum
Nu puteti modifica mesajele proprii din acest forum
Nu puteti sterge mesajele proprii din acest forum
Nu puteti vota in chestionarele din acest forum
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro