KCalorie Tracker v.1.0.0.1

By Tamaki on May 31, 2009

There is no significant point to this script, other than I thought it would be interesting to make.
You do NOT need TAD's Integration Script to use this. Load into your remotes and type /cal or /cal -d to open it on the desktop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;Calorie Tracker;;;;;;;;;;;;;
;;;;;The_Almighty_Duelist's Scripts;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;Loading and Starting;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:LOAD: {
  set %k.cal 0
  set %kcas off
  echo -a Please type /cal to start the Calorie Tracker. You can also type /cal -d to open it on your desktop.
}

on *:START: {
  If (%kcas == on) {
    dialog -m cal cal
  }
  Else {
    echo -a Please type /cal to start the Calorie Tracker. You can also type /cal -d to open it on your desktop.
  }
}

alias ical {
  set %k.cal 0
  set %kcas off
  echo -a Please type /cal to start the Calorie Tracker. You can also type /cal -d to open it on your desktop.
}

;;;;;;;;;;;;;;;;;
;;;;;Aliases;;;;;
;;;;;;;;;;;;;;;;;

alias addkcal {
  set %k.cal $calc(%k.cal + $did(cal, 2))
  did -rf cal 2
  did -ra cal 4 %k.cal
}

alias -l autokstart {
  If (%kcas == on) {
    set %kcas off
    did -u cal 7
  }
  Else {
    set %kcas on
    did -c cal 7
  }
}

alias cal {
  dialog $iif($1 == $null,$iif($dialog(cal) == cal,-v cal,-m cal cal),$iif($dialog(cal) == cal,-v cal,-md cal cal))
}

;;;;;;;;;;;;;;;;;
;;;;;Dialogs;;;;;
;;;;;;;;;;;;;;;;;

dialog cal {
  title Calorie Tracker
  option dbu
  size -1 -1 101 55
  text "Enter Calories", 1, 1 1 100 10
  edit "", 2, 1 11 100 10, right default autohs
  text "Total Calories", 3, 1 22 100 10
  edit %k.cal, 4, 1 33 100 10, right read autohs
  button "Eat", 5, 1 44 100 10, default
  menu "Manage", 6
  item "AutoStart", 7, 6
  item "Reset", 8, 6
}

on *:DIALOG:cal:*:*: {
  If ($devent == init) {
    If (%kcas == on) {
      did -c cal 7
    }
  }
  If ($devent == sclick) {
    If ($did == 5) {
      addkcal
    }
  }
  If ($devent == menu) {
    If ($did == 7) {
      autokstart
    }
    If ($did == 8) {
      set %k.cal 0
      did -r cal 2,4
      did -a cal 4 %k.cal
      did -f cal 2
    }
  }
}

Comments

Sign in to comment.
Tamaki   -  Jun 01, 2009

Update from v.1.0.0.0 to v.1.0.0.1

Fixed the auto-start feature.

 Respond  
WorldDMT   -  Jun 01, 2009

hi

why do u set a global variable!!! set it local

If (%k.c.a.s == on) { <===== where is that variable???
must be if (%kcas == on)

unless code :/ but see your code can be like that mabe that can help u for do some thing better

for alias autokstart and cal

alias -l autokstart if (%kcas == on) did -c cal 7

alias cal dialog $iif($dialog(cal),-v,$iif($1 == -d,-md,-m) cal) cal
 Respond  
Tamaki   -  May 31, 2009

i'll try to do that XD

 Respond  
sunslayer   -  May 31, 2009

rofl i find the idea of this quite interesting :p

maybe add another dialog to find out how many calories are in a particular food?

 Respond  
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.