You have way too many arguments for the join process, hence the error. Give this a try:
Code: Select all
set mychan "#chann1"
bind join v|v * greet:awards
proc greet:awards {nick uhost hand chan} {
global mychan
# skip if it's bot that is joining
if {[isbotnick $nick]} return
# skip if it's not the channel you defined above
if {![string equal -nocase $chan $mychan]} return
# set system time
set systemTime [clock seconds]
# set current day
set today [clock format $systemTime -format %e]
# set month
set month [clock format $systemTime -format %m]
# set year
set year [clock format $systemTime -format "%Y"]
# compute the number of days in the current month
set days [clock format [clock scan "$month/1/$year + 1 month - 1 day"] -format %d]
# set the number of days remaining in the month starting with today
set rest [expr $days - $today]
# output the result
puthelp "PRIVMSG $chan :$nick rest $rest days for de awards"
}
Since your system language is in Spanish and having the months names in English it would fail, so did a little workaround this and should work on all systems no matter the language it has set.
Edit: Here is a little tip. Instead of having:
Code: Select all
if {$month == "January"} {set mo 31}
if {$month == "February"} {set mo 29}
if {$month == "March"} {set mo 31}
if {$month == "April"} {set mo 30}
if {$month == "May"} {set mo 31}
if {$month == "June"} {set mo 30}
if {$month == "July"} {set mo 31}
if {$month == "August"} {set mo 31}
if {$month == "September"} {set mo 30}
if {$month == "October"} {set mo 31}
if {$month == "November"} {set mo 30}
if {$month == "December"} {set mo 31}
that is a mistake because all if statements are checked you have 3 options:
Option #1 would be to use
if ... elseif
Code: Select all
if {$month == "January"} {
set mo 31
} elseif {$month == "February"} {
set mo 29
} elseif { ... }
and so on. In this case the first if statement that is true will stop the remaining ones. Still not a very good choice because if $month is equal with December then it will still check all statements until reaches last.
Moving on to option #2:
switch
Code: Select all
switch -- $month {
"January" {
set mo 31
}
"February" {
set mo 29
}
... and so on...
default {
set mo 0
}
}
Switch is a better option than a bunch of
if or
if ... elseif since it will
jump at the exactly
match, or to default (if you added it) in case there's no match inside the switch.
But we can do better and here we got option #3 the
string map.. the champion!
Code: Select all
set days [string map [list "January" 31 "February" 29 "March" 31 "April" 30 "May" 31 "June" 30 "July" 31 "August" 31 "September" 30 "October" 31 "November" 30 "December" 31] $month]
and that's all in a single line.
Depending on the $month name it will return the element behind it from the list. For example For "February" it will return 29, for "October" it will return 31 and so on.
Edit: Fixed typo.
Edit #2: There's no 'text' argument inside the bind join.. how did I miss that?
Once the game is over, the king and the pawn go back in the same box.