This snippet comes fully configurable and easy to use. You can edit the words in the snippet itself and edit the number of counts with the %x variable. This checks to see how many times the word is said until the user is banned. The snippet also checks events such as on part and on quit to make sure that the variables for a nick is unset.
This is moderate. There are a few errors I found though.
var %x = 1
while (%x <= $lines(A.txt)) {
; This line returns if the total number of lines in a text is more than 1
.timer 1 2 msg $chan $read(A.txt,%x) | inc %x
; This line broadcasts to the channel the announcements with a timer. This is to prevent flooding. The $read(A.txt,%x) reads a specific line in the text. The %x varaible will add 1 to its current number each time. And until the events ends, it will keep on msging the channel with the %x line in the txt file.
}
Remove the ; comments if you end up using the code. I just wanted to explain what everything does. ;)
There needs to be a space between the $read and the closing bracket.
Other then that, nice idea. I recommend you add a feature to remove a specific line of text from the txt file.
You have a few errors:
The timers do not turn off when the word is said or the stopguess occurs.
If you do not have halfop or op you will receive an error.
I edited your code a bit. I fixed the timers by adding a .timersay off. Try this:
on *:TEXT:*:#:{
if ($1 = !guessword) && ($gettok(%gamestatus,1,32)) {
if ($2 = %word) {
set %win on
msg $chan $nick has won the game!
if ($nick !isvo $chan) && ($me isop $chan) { mode # +v $nick }
.timersay off
halt
}
}
if ($1 = !stopguess) && ($gettok(%gamestatus,1,32) = on) {
unset %gamestatus
msg $chan Guessing game has been stopped.
.timersay off
}
if ($1 = !startgame) && (!$gettok(%gamestatus,1,32)) {
unset %hintstatus
unset %win
set %gamestatus on
msg $chan Guessing game has started.
.timersay 1 5 msg $chan Hint: %hint1
if (%win != on) {
.timersay 1 30 msg $chan Hint: %hint2
.timersay 1 50 msg $chan Sorry, your time is up! The word was %word $+ .
}
}
if ($1 = !neword) && ($nick iswm %owner) {
msg $nick Please enter your word and hints.
}
}
on *:TEXT:*:?:{
if ($1 = new) {
if ($2 = word) set %word $3
if ($2 = hint1) set %hint1 $3
if ($2 = hint2) set %hint2 $3
}
}
Otherwise, not bad. I recommend a little more work put into this. Maybe use a text file to read different words or make it into something bigger such as a scramble game.