Alarm System

By N4warhead on Jun 18, 2010

This is one of my first scripts, so go easy on me. I know it could probably been done a lot better, ill fix it up and update it later. It's a basic alarm system script with dialogs, add your own music and enjoy :]
To start just right click on any window in mIRC and click on Alarm System.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; Alarm System ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;; Created by: N4warhead ;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Please report any bugs                ;
; Need help? Contact me on:             ;
; Server: irc.Goc-Renx.info             ;
; Name: N4warhead                       ;
; Has a 10 min snooze                   ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

menu * {
  -
  .Alarm System: /dialog -m alarm alarm
  -
}
dialog Alarm {
  title "Alarm System"
  size -1 -1 466 286
  option pixels
  text "Add your own alarm sounds.", 12, 201 28 247 17, center
  box "Alarm Sound", 9, 201 8 247 207
  text "Enter Alarm Name - Ex. Wake up", 7, 11 90 166 17, center
  text "Enter Alarm Time - Ex.17:00", 2, 10 31 166 17, center
  box "Set Alarm", 1, 10 14 169 127, ok
  text "Current Time:", 3, 12 145 69 17
  text "Alarm Time:", 4, 12 167 57 17
  text "Alarm:", 5, 12 189 33 17
  edit "", 6, 42 50 100 20
  edit "", 8, 42 110 99 20
  list 10, 208 54 134 163
  button "Find File", 11, 351 58 65 63
  edit "", 16, 88 142 59 20, read
  edit "", 13, 74 165 57 20, read
  edit "", 14, 49 187 34 20, read
  button "Set Alarm", 15, 26 250 72 32
  button "Unset Alarm", 17, 197 250 75 32
  button "Done", 18, 368 251 72 32, ok
  button "Use Sound", 19, 351 137 76 33
  text "Alarm Name:", 20, 11 209 65 17
  edit "", 21, 88 206 95 20, read
}
dialog asounds {
  title "Alarm Sounds"
  size -1 -1 265 133
  option pixels
  edit "", 1, 15 39 117 20
  text "Name your sound", 2, 11 11 124 17, center
  button "Browse", 3, 163 41 67 30
  text "Find your sound.", 4, 146 12 100 17, center
  button "Done", 5, 138 99 65 25, ok
  text "-Warning: More then 1 word will confuse the script", 6, 17 64 112 40
}
dialog alarmset {
  title "Alarm!!"
  size -1 -1 222 139
  option pixels
  edit "", 2, 1 16 220 20, read
  button "Turn Off", 4, 119 67 80 46, ok
  button "Snooze", 1, 8 50 100 77, cancel
}

on *:dialog:Alarm:INIT:*: {
  did -i alarm 16 1 $time(hh:nn)
  timerctime 0 5 /ctime
  var %as = 1
  while (%as <= $lines(soundnames.txt)) {
    did -a $dname 10 $read(soundnames.txt,%as)
    inc %as
  }
  if (%alarm) { did -i alarm 16 1 %alarm-time }
  if (!%alarm) { did -1 alarm 14 1 off }
  if (!%alarm-name) {
    did -i alarm 21 1 None
    else {
      did -i alarm 21 1 %alarm-name
    }
  }
}
on *:dialog:alarmset:sclick:*: {
  if ($did == 4) {
    /splay stop
    aunset
  }
  if ($did == 1) {
    splay stop
    timersnooze 1 600 snooze
    timerusound off
  }
}
on *:dialog:Asounds:sclick:*: {
  if ($did == 3) {
    set %alarm.file $sfile(C:\*.mp3,Select a file,Select)
  }
  if ($did == 5) {
    writeini Alarm-Sounds.ini $did(1)- Dir %alarm.file
    write soundnames.txt $did(1)
    did -i alarm 1 10 %alarm-file
    unset %alarm-file
  }
}
on *:dialog:Alarm:sclick:*: {
  if ($did == 15) {
    if (!$did(6).text) { noop $input(You did not add a time.,uwo,Error!) | halt }
    if (!$did(10).seltext) { noop $input(You did not select a sound.,uwo,Error!) | halt }
    else {
      set %alarm On
      set %alarm-time $did(6)
      set %alarm-name $did(8)
      did -i alarm 13 1 %alarm-time
      did -i alarm 14 1 On
      did -i alarm 21 1 %alarm-name
      timeralarm 0 30 /alarm
      timerctime off
    }
  }
  if ($did == 17) {
    aunset
    did -r alarm 13
    did -i alarm 14 1 Off
    did -r alarm 21
    timeralarm off
  }
  if ($did == 19) { 
    if (!$did(10).seltext) { noop $input(You did not selete a file.,nwo,Error!) | halt }
    else {
    set %asound $did(10).seltext
    noop $input(You have selected $did(10).seltext $+ .,uio,Selected!)
     }
  }
  if ($did == 11) {
    dialog -m Asounds asounds
  }
  if ($did == 18) { timerctime off }
}

alias ctime {
  did -i Alarm 16 1 $time(hh:nn)
}
alias alarm {
  if ($time(HH:nn) == %alarm-time) {
    //splay -p $readini(alarm-sounds.ini,%asound,dir)
    dialog -m alarmset alarmset
    did -i alarmset 2 1 Alarm: %alarm-name
    timeralrm off
    else {
      timeralarm 0 30 /alarm
    }
  }
}
alias snooze {
  //splay -p $readini(alarm-sounds.ini,%asound,dir)
  dialog -m alarmset alarmset
  did -i alarmset 2 1 Alarm: %alarm-name
}
alias aunset {
  unset %alarm*
  unset %asound
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.