commit 49c8600dc9d1cb4b0ca7a2d74c6a355b4acb1734 Author: Miniontoby <miniontoby@ircnow.org> Date: Sun, 21 Mar 2021 14:23:31 +0000 Initial import Diffstat:
A | README | | | 18 | ++++++++++++++++++ |
A | counton.tcl | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/README b/README @@ -0,0 +1,18 @@ +Counting On Tcl + +Fun game. + +add: +` +source scripts/CountingOn/counton.tcl +` +to your conf and .chanset #channel +countOn + + + +---- + +Copyright (C) 2021 by Miniontoby <miniontoby@ircnow.org> + + + diff --git a/counton.tcl b/counton.tcl @@ -0,0 +1,45 @@ +#.chanset #channel +countOn + +namespace eval CountOn { + bind pub "-|-" s CountOn::CountSay + bind pub "-|-" c CountOn::CountCurrent + + setudef flag countOn + variable last 0 + variable lastNick "" + variable scriptVersion 1.0 + + proc CountSay {nick host user chan text} { + variable last + variable lastNick + set now $text + if {[channel get $chan countOn]} { + if { $lastNick == $nick } { + putserv "PRIVMSG $chan :$nick: You already said a number!" + return 1 + } else { + if { [expr ($last+1)] == $now} { + putserv "PRIVMSG $chan :Ok!" + set last $now + set lastNick $nick + return 0 + } else { + putserv "PRIVMSG $chan :$nick: You failed!, start over" + set last 0 + set lastNick $nick + return 1 + } + } + } + } + proc CountCurrent {nick host user chan text} { + variable last + variable lastNick + if {[channel get $chan countOn]} { + putserv "PRIVMSG $chan :$lastNick said $last" + return 0 + } + return 1 + } + putlog "CountOn loaded!" +}