Top

Calendar Barebones


mIRC Code
+ 3 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.5 (of 4 scores)
Date Added  Nov 13, 2008
Last Updated  Dec 09, 2008
Tags  asc  asctime  calendar  date  hadd  hash  hfree  hget  pic  picwin  table  time  window 

Description

I was going to make a nice little addon out of this, but I don't have the motivation. If you want to use this be my guest, as of right now, it doesn't really serve a purpose.

Have fun.

Edit: Updated Slightly, Added support for custom colors. Also added underlining for event days, todays event, ect.

Right now you must do /cal_defaults for default colors, it won't save new colors, use cal_eadd to add an event. (as a test event) /cal_eadd dec 25 2008

The hash table that controls the event is formated as followed:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cal_Event ------------------------------------------- |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| cal_event_<ctime@00:00:00>_<event name> | event note -|
| cal_event_<ctime@00:00:00>_<event name> | event note -|
| cal_event_<ctime@00:00:00>_<event name> | event note -|
| cal_event_<ctime@00:00:00>_<event name> | event note -|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


Jonsey PM me if you need any more info

Grab the Code

alias calendar {
  if ($hget(Cal_gUI)) hfree Cal_gUI
  hadd -m Cal_gUI title $asctime($ctime($+(1/,$$1,/,$$2) 00:00:00),mmmm)
  hadd Cal_gUI month $asctime($ctime($+(1/,$1,/,$2) 00:00:00),m)
  hadd Cal_gUI year $asctime($ctime($+(1/,$1,/,$2) 00:00:00),yyyy)
  hadd Cal_gUI myyyy $asctime($ctime($+(1/,$1,/,$2) 00:00:00),m yyyy)
 
  If (!$window(@Calendar)) window -k0dBpC +d @Calendar 10 10 421 392
  Else window -a @calendar
 
  drawrect -nrf @calendar $clr(main_bg) 1 0 0 421 392
  drawrect -nrf @calendar $clr(main_box) 1 1 71 419 300
 
  ; Header
  drawrect -nrf @Calendar $clr(header_1) 1 1 1 419 20
  drawrect -nrf @Calendar $clr(header_2) 1 1 21 419 20
 
  ; Header text
  drawtext -nro @Calendar $clr(header_text) Arial 22 $round($calc((419 - $width($hget(Cal_gUI,title), Arial, 22)) / 2),0) 7 $hget(Cal_gUI,title)
 
  ; Header Nav
  drawtext -nro @calendar $clr(header_nav) Arial 22 10 8 <
  drawtext -nro @calendar $clr(header_nav) Arial 22 398 8 >
 
  ; Footer Text
  drawtext -nro @calendar $clr(footer_text) Arial 12 $calc(416 - $width($hget(Cal_gUI,year),arial,12,1)) 374 $hget(Cal_gUI,year)
 
  ; Days 
  var %x = 1, %y = 20 80 140 200 260 322 380, %z = Sun Mon Tue Wed Thu Fri Sat
  while ($gettok(%y,%x,32)) { drawtext -nr @calendar $clr(day_text) Arial 12 $gettok(%y,%x,32) 48 $gettok(%z,%x,32) | inc %x }
 
 
  ;vertical lines
  var %x = 1, %y = 60 120 180 240 300 360, %clr = $clr(lines)
  while ($gettok(%y,%x,32)) { drawline -nr @calendar %clr 1 $v1 71 $v1 371 | inc %x }
 
  ; horiz lines
  var %x = 1, %y = 121 171 221 271 321
  while ($gettok(%y,%x,32)) { drawline -nr @calendar %clr 1 1 $v1 421  $v1 | inc %x }
 
 
  var %r = $cal.start($1,$2), %e = $cal.end($1,$2), %c = 1, %i = 1, %clr = $clr(date_text)
  while (%i <= %e) {
    drawtext -nro @calendar %clr Arial 12 $calc(5 + 60 * (%r - 1)) $calc(75 + 50 * (%c - 1)) %i
    hadd -m Cal_gUI $+(B_,%r,_,%c) %i
    cal_underline %r %c 1
    If (7 // %r) { inc %c | %r = 1 }
    Else { inc %r }
    inc %i
  }
  drawrect @calendar
 
}
 
 
menu @calendar {
  mouse:{
    var %x = $mouse.x, %y = $mouse.y
    If (%x isnum 1-420) && (%y isnum 72-371) {
      var %r = $ceil($calc((%x + 1) / 60)), %c = $ceil($calc((%y - 71) / 50))
      If ($hget(Cal_gUI,cur) != %r %c) {
        If ($v1) cal_underline $v1
        If ($hget(cal_gui,$+(B_,%r,_,%c))) { drawrect -rf @calendar $clr(mouse_hover) 1 $calc(-59 + 60 * %r)  $calc(65 + 50 * %c)  59 6 }
        hadd -m Cal_gUI cur %r %c 
      }
    }
    Else { 
      If ($hget(cal_gui,cur)) { cal_underline $v1 | hdel cal_gui cur }
      If (%cal.mx) {
        var %x = $calc(%cal.wx - (%cal.mx - $mouse.dx ))
        var %y = $calc(%cal.wy - (%cal.my - $mouse.dy))
        window -p @Calendar %x %y
      }
    }
  }
  sclick:{
    var %x = $mouse.x, %y = $mouse.y
    If (%x isnum 10-23) && (%y isnum 8-34) { calendar $iif($hget(Cal_gUI,month) == 1,12,$calc($v1 - 1)) $iif($hget(Cal_gUI,month) == 1,$calc($hget(Cal_gUI,year) - 1),$hget(Cal_gUI,year)) }
    ElseIf (%x isnum 398-411) && (%y isnum 8-34) { calendar $iif($hget(Cal_gUI,month) == 12,1,$calc($v1 + 1)) $iif($hget(Cal_gUI,month) == 12,$calc($hget(Cal_gUI,year) + 1),$hget(Cal_gUI,year)) }
    ElseIf (%x isnum 1-420) && (%y isnum 72-371) { }
    Else {
      set %cal.mx $mouse.dx
      set %cal.my $mouse.dy
      set %cal.wx $window(@calendar).x
      set %cal.wy $window(@calendar).y
    }
  }
  uclick:{ unset %cal.* }
  leave:{ unset %cal.* }
 
  Close:window -c @Calendar
}
 
 
alias h2r {
  if ($regex($1,/^#?([\da-f]{6})$/i)) {
    tokenize 32 $regsubex($regml(1),/(.)/g,$replace(\1,a,10,b,11,c,12,d,13,e,14,f,15) $chr(32))
    return $calc(($1 * 16 + $2) + ($3 * 16 + $4) * 256 + ($5 * 16 + $6) * 65536)
  }
}
 
 
alias cal_defaults {
  If (!$clr(event)) clr event c05b5b
  If (!$clr(event_today)) clr event_today 207b70
  If (!$clr(mouse_hover)) clr mouse_hover 5e88bc
  If (!$clr(main_bg)) clr main_bg 4c4c4c
  If (!$clr(today)) clr today 78b0a9
  If (!$clr(main_box)) clr main_box ebebeb
  If (!$clr(header_1)) clr header_1 a3cd39
  If (!$clr(header_2)) clr header_2 93ba3e
  If (!$clr(header_text)) clr header_text ffffff
  If (!$clr(header_nav)) clr header_nav ffffff
  If (!$clr(footer_text)) clr footer_text ffffff
  If (!$clr(day_text)) clr day_text ffffff
  If (!$clr(lines)) clr lines 4c4c4c
  If (!$clr(date_text)) clr date_text 4c4c4c
}
 
alias clr { 
  if ($isid) return $hget(cal_cfg,color_ $+ $1) 
  else hadd -m cal_cfg color_ $+ $1 $h2r($2)
}
 
alias cal_eadd { 
  hadd -m cal_event Event_ $+ $ctime($1- 00:00:00) $+ _testing asdasdasd
 
}
 
alias cal_underline {
  var %ctime = $ctime($hget(cal_gui,$+(B_,$1,_,$2)) $hget(cal_gui,title) $hget(cal_gui,year) 00:00:00)
  var %event = $hfind(Cal_Event,Event_ $+ %ctime $+ _*,0,w)
 
  var %today = $iif($asctime(d m yyyy) == $hget(cal_gui,$+(B_,$1,_,$2)) $hget(Cal_gUI,myyyy),1,)
  If (%event) && (%today) { var %clr = 7371552 }
  ElseIf (%event) { var %clr = $clr(event) }
  ElseIf (%today) { var %clr = $clr(today) }
  Else { var %clr = $clr(main_box) }
 
  drawrect $iif($3,-rnf,-rf) @calendar %clr 1 $calc(-59 + 60 * $1) $calc(65 + 50 * $2)  59 6
}
 
menu status,channel,query { 
  -
  Calendar:/calendar $asctime(mm yy)
  -
}
 
 
alias fade {
  var %x = $vol(master), %y = $calc(%x / 500), %z = 1
  while (%z <= 500) {  vol -v $round($calc(%x - %y * %z),0) |  inc %z }
}
 
 
alias cal.start { return $replace($asctime($ctime($+(1/,$1,/,$2) 00:00:00),ddd),sun,1,mon,2,tue,3,wed,4,thu,5,fri,6,sat,7) }
alias cal.end { return $asctime($calc($ctime($+(1/,$iif($1 == 12,1,$calc($v1 + 1)),/,$iif($1 == 12,$calc($2 + 1),$2)) 00:00:00) - 1),d) }
 

Comments

  (18)  RSS
^Neptune
Comments: 629
 
mIRC Snippet:  Calendar Barebones
Posted on Nov 13, 2008 9:57 am
Absolutely love the layout. Very clean and fresh looking. You should upload a screenshot.
^Neptune
Comments: 629
 
mIRC Snippet:  Calendar Barebones
Posted on Nov 13, 2008 12:36 pm


=D
jonesy44
Comments: 1,892
 
mIRC Snippet:  Calendar Barebones
Posted on Dec 9, 2008 1:33 pm
i can't believe this has gone so unmissed! This is incredibly good! great graphics processing for a picwin, fast and clean! I'm tempted to put some work into this & make an event calendar etc?
TheImrac
Comments: 70
 
mIRC Snippet:  Calendar Barebones
Posted on Dec 9, 2008 1:35 pm
hehe thanks =) I might have an slightly updated version lying around.
jonesy44
Comments: 1,892
 
mIRC Snippet:  Calendar Barebones
Posted on Dec 9, 2008 1:38 pm
Awesome! please upload, really impressed with your work! my logic is not good enough to go through it working it out, so a stable version (although nothing wrong with this) would be awesome! :D
TheImrac
Comments: 70
 
mIRC Snippet:  Calendar Barebones
Posted on Dec 9, 2008 1:49 pm
Uploaded... Let me know if you need any info on it.

Edit: Lol seems like a little bonus slipped into the code. Have fun with it. =)
jonesy44
Comments: 1,892
 
mIRC Snippet:  Calendar Barebones
Posted on Dec 9, 2008 2:54 pm
Thanks, i'll checkit out now! :D
^Neptune
Comments: 629
 
mIRC Snippet:  Calendar Barebones
Posted on Jan 27, 2009 3:53 pm
Could do alot with this, although sadly I have no clue on picwins so I guess I can't do anything with it =[.

I'd like to be able to:
* Set icons for specific dates.
* Click the underlined date to show what tasks you've set for that date.
* Maybe show how many tasks you have for that date.
* In the "set tasks" dialog or picwin or w/e, have away of checking off stuff that you've done.

Guess I won't see this happen though. =[
jonesy44
Comments: 1,892
 
mIRC Snippet:  Calendar Barebones
Posted on Jan 27, 2009 4:31 pm
it's such a nice thing i don't know why this project was never continued! maybe one for someone to continue? i would, but i don't have the time to look over the code, my knowledge of picwins is good enough but just time (N)
TheImrac
Comments: 70
 
mIRC Snippet:  Calendar Barebones
Posted on Jan 27, 2009 7:08 pm
I loose interest in code very quickly, that's why I never completed this. I figure I wouldn't use it, so I don't feel like coding it.
^Neptune
Comments: 629
 
mIRC Snippet:  Calendar Barebones
Posted on Jan 28, 2009 10:21 am
But other people might. =D
Firstmate
Comments: 125
 
mIRC Snippet:  Calendar Barebones
Posted on Jan 31, 2009 9:18 pm
Code:

* /drawrect: insufficient parameters (line 11, script3.mrc)


I get that error when using it.
PATX
Comments: 387
 
mIRC Snippet:  Calendar Barebones
Posted on Mar 14, 2009 2:47 pm
awesome layout! way to keep it simple. i will give it a 9.
sk68
Comments: 68
 
mIRC Snippet:  Calendar Barebones
Posted on Jul 22, 2009 10:31 am
* /drawrect: insufficient parameters (line 12, calender.nns) for me on open

also * /drawrect: insufficient parameters (line 141, calender.nns) every so often, it adds up, fast
jonesy44
Comments: 1,892
 
mIRC Snippet:  Calendar Barebones
Posted on Jul 22, 2009 11:51 am
Can you paste these lines? Maybe we can debug for you:)
FordLawnmower
Comments: 615
 
mIRC Snippet:  Calendar Barebones
Posted on Jul 22, 2009 12:06 pm
I can debug it without seeing it. Remove .nns , haha. It started out as a nice little script but now it's expanded to the point of uselessness. I would suggest loading scripts into a blank mirc. There are always problems when you try to load into a HUGE script like NNS.
PATX
Comments: 387
 
mIRC Snippet:  Calendar Barebones
Posted on Jul 22, 2009 5:12 pm
I love it. It is like a FordLawnmower script!
sk68
Comments: 68
 
mIRC Snippet:  Calendar Barebones
Posted on Jul 24, 2009 12:36 pm
I probably will get rid of it if I can find a way to use nns themes on a blank mIRC, pretty much the only reason I use it

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom