Shoutbox

[REQUEST] Sign on alarm - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [REQUEST] Sign on alarm (/showthread.php?tid=65818)

[REQUEST] Sign on alarm by Dabbi on 09-04-2006 at 10:08 AM

What i'm thinkig about is a alarm clock like script, where you can let the alarm go off then a certain user signs on, and turn off when you snooze it.

i know about the sign in/out sound notifications, its just that i need it to ring until i snooze, and have quick and comfortable enable/disable feature.


RE: [REQUEST] Sign on alarm by benjyrama on 09-04-2006 at 11:43 AM

an actual alarm clock is a gd idea too :D


RE: [REQUEST] Sign on alarm by AberNStein on 09-04-2006 at 09:32 PM

interesting idea. i'll have a go at it tonight.


RE: [REQUEST] Sign on alarm by Zeh on 09-04-2006 at 09:46 PM

I didn't understand very well what is that you requested Dabbi. But I think an alarm clock would be great. I actually thought about one last night, I was like "I wish I had an alarm clock in my computer...". LOL :p


RE: RE: [REQUEST] Sign on alarm by Chris4 on 09-04-2006 at 09:50 PM

quote:
Originally posted by Zeh
I didn't understand very well what is that you requested Dabbi. But I think an alarm clock would be great. I actually thought about one last night, I was like "I wish I had an alarm clock in my computer...". LOL :p

Simple Alarm 1.2

But that's not what Dabbi is requesting. He want's an alarm that goes ff when a certain contact signs in.
RE: [REQUEST] Sign on alarm by Zeh on 09-04-2006 at 09:57 PM

Well but you can use Plus! for that, you can choose any sound to be played when a contact signs in so you can give it an alarm sound.


RE: [REQUEST] Sign on alarm by AberNStein on 09-04-2006 at 10:30 PM

he wants a sound that won't stop till he responds
i'm more than half-way through the script, but feel free to make it if you want.-


RE: [REQUEST] Sign on alarm by Zeh on 09-04-2006 at 10:33 PM

Oh a sound that never stops... That could be handy... well if your half way trough then I'll sit thight waiting for the release. Eheh


RE: [REQUEST] Sign on alarm by AberNStein on 09-04-2006 at 10:57 PM

Alarm v. 0.1

mkay really basic first working version of this script is attached
i got the sound from some free sound site and i stole the image.
edit the script to change the contact's email.
future versions will have:
-on/off
-multiple contacts
-interface


RE: [REQUEST] Sign on alarm by Zeh on 09-04-2006 at 10:59 PM

Thanks, when will you be working on the next version?


RE: [REQUEST] Sign on alarm by AberNStein on 09-04-2006 at 11:04 PM

right after dinner


RE: [REQUEST] Sign on alarm by Chris4 on 09-04-2006 at 11:48 PM

Haha, that's a cool script. How can I change the picture?


RE: [REQUEST] Sign on alarm by Zeh on 09-04-2006 at 11:54 PM

You could place the image you want in the \scripts\alarm\images and name it alarm.jpg replacing the image there. Don't know what will happen if the image is bigger then the window. Some scripts that use text or images stop working if the text or the image are bigger then the window size.


RE: [REQUEST] Sign on alarm by AberNStein on 09-05-2006 at 12:50 AM

you can edit the xml file to change the height and width

i'll have another release out tonight. i've replaced the image with http://en.wikipedia.org/wiki/Image:Windup_alarm_clock.jpg because it's public domain (among a whole lot of other features).
if anyone has a better image that's freely useable please post it.

edit: newer version attached. supports multiple contacts and has enable/disable.
you have to enable it from the script menu before it will work
the script stores the enabled/disabled state in registry
and disabling it will kill the alarm

this isn't the last build tonight, i'm just going to watch prison break.
i'll have an interface for inputting the contacts' emails put it tonight. promise.
also on the to-do list:
- put the contact's name at the top of the alarm window
- open a convo with said contact when you click the alarm


RE: [REQUEST] Sign on alarm by CookieRevised on 09-05-2006 at 01:28 AM

some quick pointers (Im in a hurry):

* Script pack didn't imported, contained an error (also make your wml files unicode and add the proper header to scriptinfo.xml)

* Ident your code with tabs, add some lines between functions.

* Dont use Messenger.MyEmail for storing information, use Messenger.MyUserID instead (if you can, never put emails directly in the registry as this forms a possible security/privacy risk)

* There is no need for the variable ringing and assigning it 1 or 0; you can leave all those lines and checks out of it.

* Since you only use 1 timer, no need for checking the TimerId; you can leave that check out

* No need for checking the catch error event (if (e != 0)), it will always be something different than 0, otherwise it wouldn't be an error.

* Functions OnGetScriptMenu(), toggle and OnEvent_ContactSignin all miss an error catching (each time you read/write to the registry you must use error catching).

* You didn't declare the variable enabled as a global variable
       
* Unless you're going to use other menu options, checking on the menu id isn't needed

* Using a normal string to contain the email addresses might result in errors when you use eml.indexOf(TheEmail)>-1. Better make eml an array. You can also iterate thru the array more easly.

* since you use a timer in your script, read the important notes about timers here: CookieRevised's reply to [release] Who's online

* other optimizations exist though

;)


RE: RE: [REQUEST] Sign on alarm by AberNStein on 09-05-2006 at 01:48 AM

thanks for wading through my code. i know i'm a sloppy programmer.

quote:
Originally posted by CookieRevised
some quick pointers (Im in a hurry):

* Script pack didn't imported, contained an error (also make your wml files unicode and add the proper header to scriptinfo.xml)

sorry. dunno what happenned there
quote:
Originally posted by CookieRevised
* Ident your code with tabs, add some lines between functions.

fine i'll indent it. i'm not commenting though.
quote:
Originally posted by CookieRevised
* Dont use Messenger.MyEmail for storing information, use Messenger.MyUserID instead (if you can, never put emails directly in the registry as this forms a possible security/privacy risk)

fix'd in next version.
quote:
Originally posted by CookieRevised
* There is no need for the variable ringing and assigning it 1 or 0; you can leave all those lines and checks out of it.

that's a relic from an earlier version. delet'd in next version
quote:
Originally posted by CookieRevised
* Since you only use 1 timer, no need for checking the TimerId; you can leave that check out

remov'd in next version
quote:
Originally posted by CookieRevised
* No need for checking the catch error event (if (e != 0)), it will always be something different than 0, otherwise it wouldn't be an error.

not my code. i copy/pasted that from a script repository
quote:
Originally posted by CookieRevised
* Functions OnGetScriptMenu(), toggle and OnEvent_ContactSignin all miss an error catching (each time you read/write to the registry you must use error catching).

good point. add'd in next version
quote:
Originally posted by CookieRevised
* You didn't declare the variable enabled as a global variable
   
in next ver.
quote:
Originally posted by CookieRevised   
* Using a normal string to contain the email addresses might result in errors when you use eml.indexOf(TheEmail)>-1. Better make eml an array. You can also iterate thru the array more easly.

originally i had it in an array, but i thought that looping through it to search it would be bad if there were a lot of items. a fast array searching function would merge it into a string, so i just left it as a string. back to looping through the array it is.

thanks a lot.

edit: also in the next version will be checking whether it's the same user when the timer triggers and also not doing stuff if boss mode is on.
---------
EDIT:
alarm v. 0.2
-click 'choose contacts' on the menu to choose what contacts alarm applies to
-cookierevisited's suggestions integrated
still to come:
-contact's email in the alarm
-clicking the alarm opens a convo

there are quite probably a bunch of things that could be streamlined in my code. right now i'm going for functionality. this build should run properly. that's what matters for now.
oh and by the way i'm new to xml so if anyone wants to make the interface windows prettier or whatever feel free to post your changes.

this is the last build tonight. i'll hopefully finish it tomorrow night.

edit:
known bugs:
with multiple alarms open, only the most recent one will close, and the ringing will stop. also, disabling the alarm will only kill the most recent window.

i'm starting to think that the programming required for making the alarms show the emails and stuff is beyond me.