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.

omgword script does not work correct

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

omgword script does not work correct

Post by Fraud »

Hello everybody. I have a quit old omgword script which is bit buggy.
If somebody solves a word the first time, the script counts doubled.

thats what it does only the first time. Output is in german
Bot-Output - OMG-Word: Füller wurde von Rashors richtig erraten. Rashors hat 1 Punkte
Bot-Output - OMG-Word: Füller wurde von Rashors richtig erraten. Rashors hat 2 Punkte
here is the error
Tcl error [omgfertig]: invalid timerID

and thats the script

Code: Select all

#############
### Binds ###
#############

bind PUB -|- .omg omgword


set count "0"
set omgwoerter "scripts/priv/db/omg.txt"

#################
### FloodProt ###
#################

proc noflood { type channel } {
if {[string equal -nocase "check" $type]} {
if {[info exists ::noflood($channel)] && [expr [unixtime] - $::noflood($channel)] < 30} {
return 1
}
return 0
} elseif {[string equal -nocase "set" $type]} {
set ::noflood($channel) [unixtime]
}
}

#############
### Procs ###
#############

####################
### UmdrehenProc ###
####################

proc umdrehen { wort } {
set wort2 "[string toupper [lindex [split $wort ""] 0]][join [lrange [split $wort ""] 1 end] ""]"
set n $wort2
while { $wort2 == $n } {
set n ""
foreach b [split $wort2 ""] { if { [rand 2] != "1" } { set n "$n$b" } { set n "$b$n" } }
}
return $n
}

############
### Main ###
############

proc omgword { nick host hand chan args } {
global count
if {[noflood check $chan]} {
putquick "NOTICE $nick : Mit flooden kannst du nix bezwingen!"
return
}
set ::norm(wort) [lindex [set fileList [split [read [set fs [open "$::omgwoerter" r]]] \n]] [rand [llength $fileList]]][close $fs]
set count [expr $count + 1]
putquick "PRIVMSG $chan :\002OMG-Word\002: nr: \002$count\002 Okay dann fangt mal an zu raten, wir suchen: \037[umdrehen $::norm(wort)]\037, ihr habt 30s Zeit."
bind pubm - "$chan $::norm(wort)" omgfertig
set ::timer [utimer 30 [list putquick "PRIVMSG $chan :\002OMG-Word\002: nr: \002$count\002 Leider hat keiner das Wort erraten, wir haben \037$::norm(wort)\037 gesucht."]]
set ::timermoney [utimer 29 [list unbind pubm - "$chan $::norm(wort)" omgfertig]]

noflood set $chan
}

##################
### OMG-Fertig ###
##################

proc omgfertig {nick host hand chan arg} {
global counter
if {![info exists counter($nick)]} {
set counter($nick) 1
putquick "PRIVMSG $chan : \002OMG-Word\002: \037$::norm(wort)\037 wurde von \002$nick\002 richtig erraten. $nick hat $counter($nick) Punkte"
killutimer $::timer
killutimer $::timermoney
unbind pubm - "$chan $::norm(wort)" omgfertig
}
if {[info exists counter($nick)]} {
set counter($nick) [expr $counter($nick) +1]
global counter($nick)
putquick "PRIVMSG $chan : \002OMG-Word\002: \037$::norm(wort)\037 wurde von \002$nick\002 richtig erraten. $nick hat $counter($nick) Punkte"
killutimer $::timer
killutimer $::timermoney
unbind pubm - "$chan $::norm(wort)" omgfertig
}
}
[/code]

So. hopefully you can help me. thanks
Post Reply