# Debugging
function send(msg) {
- #print " > " msg > "/dev/stderr"
+ print " > " msg > "/dev/stderr"
print msg
- #system("sleep 1")
+ system("sleep 1")
fflush()
}
// {
#print "" > "/dev/stderr"
- #print " < " $0 > "/dev/stderr"
+ print " < " $0 > "/dev/stderr"
}
function debug(msg) {
function join(chan) {
send("JOIN " chan)
+ send("TOPIC " chan)
}
function part(chan) {
send("PART " chan)
}
+function topic(chan, msg) {
+ send("TOPIC " chan " :" msg)
+}
+
# Reloading
BEGIN {
if (CHILD == "") {
CMD == "PING" {
send("PING " MSG)
}
+
+CMD == "332" ||
+CMD == "TOPIC" {
+ topics[DST] = MSG
+}
plain[FROM] = 0
}
+# SFV Lug
+(systime()-lastpoll > 60*60*24 && CMD == "PING") ||
+(/^\.poll/ && DST == "#sfvlug" && CMD == "PRIVMSG") {
+ chan = "#sfvlug"
+ if (!topics[chan])
+ next
+ lastpoll = systime()
+ cmd = "curl -s http://sfvlug.org/"
+ day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)"
+ web = "next meeting.*" day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)"
+ irc = day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)"
+ while (cmd | getline line) {
+ if (match(line, web, arr)) {
+ new = arr[1] " " arr[2] " " arr[3]
+ sub(irc, new, topics[chan])
+ topic(topics[chan])
+ next
+ }
+ }
+}
+
+
# Fortune
TO == NICK && /^/ { extra = "" }
TO == NICK && /^.fortune.*-o/ { extra = "-o" }
-# Todo:
-# - highest bidder leads
-# - show card after play
-
# Functions
function sp_init(cards, tmp0, tmp1)
{
bids = sp_bids[i] + sp_bids[i+2]
tricks = sp_tricks[i] + sp_tricks[i+2]
bags = tricks - bids
- if (sp_bags(i) + bags > 10) {
+ if (sp_bags(i) + bags >= 10) {
say(sp_team(i) " bag out")
sp_scores[i] -= 100
}
sp_order[3] " took " int(sp_tricks[3]) "/" int(sp_bids[3]))
}
+(TO == NICK || DST == sp_channel) &&
/^\.(score|status)$/ {
if (sp_state == "new") {
say("There is no game in progress")
-:andy753421!~a@c.d PRIVMSG #rhnoise :spades
-:andy753421!~a@c.d PRIVMSG #rhnoise :unicode :)
-:andy753421!~a@c.d PRIVMSG #rhnoise :spades
-:andy753421!~a@c.d PRIVMSG #rhnoise :unicode :(
-:andy753421!~a@c.d PRIVMSG #rhnoise :spades
+:andy753421!~a@c.d TOPIC #sfvlug :San Fernando Valley Linux Users Group | Meeting: Sat January 21, 6:00pm Denny's Van Nuys | Website: www.sfvlug.org & Wiki: http://tinyurl.com/tabrr & Meetup: http://meetup.com/sfvlug | Knowledge is power. http://tinyurl.com/2xr7sd
+:andy753421!~a@c.d PRIVMSG #sfvlug :.poll