JMC scriptlets

by Neale

Back to Mechanic's Corner.

Neale2004-11-20 02:26:44
OK, so it's not the best client, being half in Russian and not developed any more, but it generally does what I want and someone else might use it, so I'm going to post all my scriptlets here and if anyone needs help setting them up I'll see what I can do. Oh, and when I say scriptlets, I mean stuff written in JScript that goes in your *profilename*.scr file, and you need to have your scripting options set to use JScript.

This first one shows you the day and time on a mark, controlled by alarmMinutes. For example, if alarmMinutes is 15, then it shows you the day and time at 1:00, 1:15, 1:30, etc. I recommend always setting it to a number which goes evenly into 60, otherwise it'll look kind of silly, like if it's 7, then 1:00, 1:07, 1:21... 1:56, 2:03, 2:10... Anyway, I use it to remind me that time passes and I do have to go to class eventually.
QUOTE
var alarmMinutes = 15;
var alarmStartDate = new Date();

//if it doesn't work, take the line breaks out here...
jmc.setTimer(901,((alarmMinutes*600) -
  ((alarmStartDate.getMinutes()%alarmMinutes)*600) -
  (startDate.getSeconds()*10)));

jmc.registerHandler("Timer", "onTimer()");

function onTimer()
{
  var timerID = jmc.Event;
  switch(timerID)
  {
    case 901:
      jmc.setTimer(902,alarmMinutes*600);
      jmc.killTimer(901);
    case 902:
      if(jmc.IsConnected)
      {
        jmc.showMe("");
        jmc.showMe(Date().toLocaleString());
      }
      break;
  }
}