This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help ME Please (TCL)

Old posts that have not been replied to for several years.
Locked
d
djcoxe
Voice
Posts: 7
Joined: Fri May 06, 2005 11:05 am

Help ME Please (TCL)

Post by djcoxe »

Code: Select all

set chan "#quix"
set sillaba 0
set scarabeo 0
set uno 0
set scarabeoplus 0

bind pub - !quix start_votazione
bind pub - !votasillaba votosillaba
bind pub - !votascarabeoplus votoscarabeoplus
bind pub - !votauno votouno
bind pub - !votascarabeo votoscarabeo

proc start_votazione {nick host hand chan text} {
global sillaba scarabeo scarabeoplus uno
    set sillaba 0
    set scarabeo 0
    set uno 0
    set scarabeoplus 0
    putserv "PRIVMSG $chan :8,2Sono Partite Le Votazioni per il prossimo gioco!!"
    putserv "PRIVMSG $chan :8,2Giochi Disponibili :\002SILLABA , UNO , SCARABEO , SCARABEOPLUS"
    putserv "PRIVMSG $chan :8,2Potete Votare il Gioco con \0028,4!vota\002 8,2(Es.\002\8,4!votasillaba\0028,2 Tutto attaccato)"
    putserv "PRIVMSG $chan :8,2Avete 1 Min !! \002NO CLONI , NO FLOOD\002 Pena BAN!!"
    timer 1 fine:voto
    return 0
    }

proc votosillaba {nick host hand chan text} {
global sillaba
      incr sillaba
      putserv "NOTICE $nick :Voto Registrato"
    }

proc votouno {nick host hand chan text} {
global uno
      incr uno
      putserv "NOTICE $nick :Voto Registrato"
    }

proc votoscarabeoplus {nick host hand chan text} {
global scarabeoplus
      incr scarabeoplus
      putserv "NOTICE $nick :Voto Registrato"
    }

proc votascarabeo {nick host hand chan text} {
global scarabeo
      incr scarabeo
      putserv "NOTICE $nick :Voto Registrato"
    }

proc fine:voto {} {
global sillaba scarabeo uno scarabeoplus chan
    set chan "#quix"
    putserv "PRIVMSG $chan :Fine Votazioni!"
    if {????????} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SILLABA\002 Voti: $sillaba "
    putserv "NOTICE Quix :sillabaon 200 0000"    
    } elseif {?????????} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SCARABEO\002 Voti : $scarabeo"
    putserv "NOTICE Quix :sccon 200 0000"
    } elseif {?????????} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002UNO\002 Voti : $uno"
    } elseif {?????????} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002 SCARABEO PLUS\002 Voti : $scarabeoplus"
    putserv "NOTICE $chan :scarabeon 200 0000"
    return 0 
  }
I try to write a script for vote a various games in one chan ...
When the people vote the game ... the biggest variable win and start the game ... but i don't understand ...
the problem is in the "fine:voto" ... {?????} for define the biggest variable...
Please Help Me!! :D
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

What variable to you want to check, and compared to what ?
d
djcoxe
Voice
Posts: 7
Joined: Fri May 06, 2005 11:05 am

Post by djcoxe »

1. $sillaba compare with $uno and $scarabeo and $scarabeoplus
2. $scarabeo compare with $uno and $sillaba and $scarabeoplus
3. $scarabeoplus compare with $uno and $sillaba and $scarabeo
3. $uno compare with $sillaba and $scarabeo and $scarabeoplus

for check the biggest
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

you can do something like this:

Code: Select all

set max $sillaba
if {$uno > $max} { set max $uno}
if {$scarabeo > $max} { set max $scarabeo }
if {$scarabeoplus > $max} { set max $scarabeoplus }
Now you have $max as the biggest value. So to output you can use:

Code: Select all

if {$max == $sillaba} {
 # output something
} elseif {$max == $uno} {
 # output something else
} elseif {$max == $scarabeo} {
 # output something else and the list continues...
}
d
djcoxe
Voice
Posts: 7
Joined: Fri May 06, 2005 11:05 am

Post by djcoxe »

Code: Select all

proc fine:voto {} {
global sillaba scarabeo chan
    set chan "#quix"
    putserv "PRIVMSG $chan :Fine Votazioni!"
    set max $uno
    if {$sillaba > $max } {set max $sillaba}
    if {$scarabeo > $max} {set max $scarabeo}
    if {$scarabeoplus > $max} {set max $scarabeoplus}
    if {$max == $sillaba} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SILLABA\002 Voti: $sillaba"
    } elseif {$max == $uno} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002UNO\002 Voti: $uno"
    } elseif {$max == $scarabeoplus} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SCARABEO PLUS\002 Voti: $scarabeoplus"
    } elseif {$max == $scarabeo} {
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SCARABEO\002 Voti: $scarabeo"
    return 0
    }
I write this but the tcl not start ... read this error:

[16:12] missing close-brace
while executing
"proc fine:voto {}"
(file "scripts/voto.tcl" line 51)
invoked from within
"source scripts/voto.tcl"
(file "eggdrop.conf" line 175)
[16:12] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

It's pretty obvious, "missing close-brace"

Code: Select all

proc fine:voto {} { 
global sillaba scarabeo chan 
    set chan "#quix" 
    putserv "PRIVMSG $chan :Fine Votazioni!" 
    set max $uno 
    if {$sillaba > $max } {set max $sillaba} 
    if {$scarabeo > $max} {set max $scarabeo} 
    if {$scarabeoplus > $max} {set max $scarabeoplus} 
    if {$max == $sillaba} { 
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SILLABA\002 Voti: $sillaba" 
    } elseif {$max == $uno} { 
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002UNO\002 Voti: $uno" 
    } elseif {$max == $scarabeoplus} { 
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SCARABEO PLUS\002 Voti: $scarabeoplus" 
    } elseif {$max == $scarabeo} { 
    putserv "PRIVMSG $chan :Il Prossimo Gioco Sarà \002SCARABEO\002 Voti: $scarabeo" 
    return 0 
    }
}
Locked