Ogame timer [Dutch]

By Freckle on Oct 24, 2007

Hello all,

I was bored so i made a script for Ogame.nl
Sorry for it being dutch but I was so happy I finished it :D

/ogame

It lets you know when you have enough "grondstoffen" to buy something
Good luck

alias ogame { dialog -dm ogame ogame }
dialog ogame {

  title "Ogame"
  size 0 0 120 95
  option dbu

  text "Huidig:", 4, 8 10 20 20
  edit "", 5, 25 9 40 10

  text "Nodig:", 6, 8 25 20 20
  edit "", 7, 25 24 40 10

  text "Productie per uur:", 8, 8 40 60 20
  edit "", 9, 53 39 40 10

  button "Reken Uit!", 10, 56 52 33 15
  edit "", 11, 10 55 40 10, read

  text "Het rekenwerk is gedaan door Spoiled-Chicken", 12, 73 70 40 50

  button "Start de tijd!", 13, 10 80 60 10
  button "Stop de tijd!", 14, 10 70 60 10
}

on *:dialog:ogame:*:*: {
  if ($devent == init) {
    if (%huidig) { did -ra $dname 5 %huidig }
    if (%nodig) { did -ra $dname 7 %nodig }
    if (%puur) { did -ra $dname 9 %puur }
  }
  if ($devent == sclick && $did == 10) { 
    %huidig = $remove($did(5),.,$chr(44))
    %doel = $remove($did(7),.,$chr(44))
    %puur = $remove($did(9),.,$chr(44))
    %nodig = $calc(%doel - %huidig)
    %tijdsec = $calc(3600 * $calc(%nodig / %puur))
    %uur = $floor($calc(%tijdsec / 3600))
    %mintest = $calc($calc(%tijdsec / 3600) - %uur)
    %minpro = $calc(%mintest * 100)
    %min = $floor($calc(0.6 * %minpro))
    %sectest = $calc($calc(0.6 * %minpro) - %min)
    %secpro = $calc(%sectest *100)
    %sec = $floor($calc(0.6 * %secpro))

    if ($len(%uur) == 1) { %uur = 0 $+ %uur }
    if ($len(%sec) == 1) { %sec = 0 $+ %sec }
    if ($len(%min) == 1) { %min = 0 $+ %min }
    did -ra $dname 11 %uur $+ : $+ %min $+ : $+ %sec
  }
  if ($devent == sclick && $did == 13) {
    .timerogame 0 1 o.timer
  }
  if ($devent == sclick && $did == 14) {
    .timerogame off
  }
}

alias o.timer {
  unset %done
  dec %sec
  if (%sec == 00 || %sec == 0) {
    if (%min == 0 || %min == 00) { goto minutes }
    if ($dialog(ogame)) { did -ra ogame 11 $iif($len(%uur) == 1, 0 $+ %uur,%uur) $+ : $+ $iif($len(%min) == 1, 0 $+ %min,%min) $+ : $+ $iif($len(%sec) == 1, 0 $+ %sec,%sec) }
    %done = sec
    :minutes
    %sec = 60
    dec %min
  }
  if (%min == -1) {
    if (%uur == 00 || %uur == 0) {
      if ($dialog(ogame)) { did -ra ogame 11 Time's up! }
      .timerogame off 
      beep 50 
      halt 
    }
    if ($dialog(ogame)) { did -ra ogame 11 $iif($len(%uur) == 1, 0 $+ %uur,%uur) $+ :00:00 }
    dec %uur
    %done = min
    %min = 59
  }
  if (!%done && $dialog(ogame)) { did -ra ogame 11 $iif($len(%uur) == 1, 0 $+ %uur,%uur) $+ : $+ $iif($len(%min) == 1, 0 $+ %min,%min) $+ : $+ $iif($len(%sec) == 1, 0 $+ %sec,%sec) }
}

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.