S2 Tracker

The simplest way to install this is to download S2Tracker, save it somewhere, go to Tools -> Scripts Editor -> at the new window File -> Load and choose the file.
The file has no extension, it's fine just like that

dialog S2_tracker {
  title "SeeD 2 Tracker"
  size -1 -1 257 179
  option dbu
  box "Quicks", 19, 198 102 55 72
  box "HP Modifiers", 42, 198 0 56 21
  box "Armor Modifiers", 41, 198 20 56 20
  edit "", 1, 67 8 55 10, center
  edit "", 2, 134 8 55 10, center
  edit "", 3, 67 25 55 10, center
  edit "", 4, 134 25 55 10, center
  edit "", 31, 67 41 55 10, center
  edit "", 73, 134 41 55 10, center
  edit "", 23, 66 57 55 10, center
  edit "", 16, 134 57 55 10, center
  edit "", 5, 67 75 55 10, center
  edit "", 7, 134 75 55 10, center
  edit "#", 6, 67 92 55 10
  edit "", 72, 134 91 55 10, center
  button "Damage", 9, 5 5 46 12
  button "Healing", 11, 5 18 46 12
  button "MP Recovery", 12, 5 44 46 12
  button "Cast", 13, 5 31 46 12
  button "Post", 14, 5 57 46 12
  check "MP Damage", 17, 201 7 40 10
  check "Piercing Damage", 21, 201 28 50 10
  edit "", 30, 233 91 21 10
  text "Current HP", 32, 67 1 55 6, center
  text "Max HP", 33, 134 1 55 6, center
  text "Current MP", 34, 67 18 55 6, center
  text "Max MP", 35, 134 18 55 6, center
  text "Damage", 36, 67 68 55 6, center
  text "Channel", 37, 67 84 55 6, center
  text "Armor", 38, 134 68 55 7, center
  box "Defense Modifiers", 40, 198 41 56 50
  text "Damage Taken", 47, 195 92 36 8
  button "End Of Turn", 48, 5 70 46 12
  edit "", 100, 8 113 78 10
  edit "", 112, 86 113 15 10, center
  edit "", 101, 8 123 78 10
  edit "", 113, 86 123 15 10, center
  text "Conditions", 66, 8 104 78 8, center
  text "Suit THP", 74, 134 84 55 6, center
  text "Total TMP", 75, 134 34 55 6, center
  edit "", 102, 8 133 78 10
  edit "", 114, 86 133 15 10, center
  edit "", 103, 8 143 78 10
  edit "", 115, 86 143 15 10, center
  edit "", 104, 8 153 78 10
  edit "", 116, 86 153 15 10, center
  edit "", 105, 8 163 78 10
  edit "", 117, 86 163 15 10, center
  edit "", 106, 103 113 78 10
  edit "", 118, 181 113 15 10, center
  edit "", 107, 103 123 78 10
  edit "", 119, 181 123 15 10, center
  edit "", 108, 103 133 78 10
  edit "", 120, 181 133 15 10, center
  edit "", 109, 103 143 78 10
  edit "", 121, 181 143 15 10, center
  edit "", 110, 103 153 78 10
  edit "", 122, 181 153 15 10, center
  edit "", 111, 103 163 78 10
  edit "", 123, 181 163 15 10, center
  text "Barrier", 49, 67 34 55 6, center
  radio "5/5ths", 200, 201 48 50 8
  radio "4/5ths", 201, 201 56 50 8
  radio "3/5ths", 202, 201 64 50 8
  radio "2/5ths", 203, 201 72 50 8
  radio "1/5th", 204, 201 80 50 8
  text "Dur", 8, 86 104 15 8, center
  text "Conditions", 10, 103 104 78 8, center
  text "Dur", 18, 181 104 15 8, center
  text "Luck", 15, 67 50 55 6, center
  text "Max Luck", 22, 134 50 55 6, center
  edit "", 20, 200 111 42 10
  check "", 24, 244 112 8 8
  edit "", 25, 200 121 42 10
  check "", 26, 244 122 8 8
  edit "", 27, 200 131 42 10
  check "", 28, 244 132 8 8
  edit "", 29, 200 141 42 10
  check "", 39, 244 142 8 8
  edit "", 43, 200 151 42 10
  check "", 44, 244 152 8 8
  edit "", 45, 200 161 42 10
  check "", 46, 244 162 8 8
  menu "Menu", 81
  item "End Battle", 82, 81
  item "Open", 83, 81
  item "Save", 84, 81
}

alias s2tracker {
  dialog -md S2_tracker S2_tracker
  s2load
}

alias s2save {
  if ($did(S2_tracker,1) != $null) { writeini seedchar.ini $me currhp $did(S2_tracker,1) }
  if ($did(S2_tracker,2) != $null) { writeini seedchar.ini $me maxhp $did(S2_tracker,2) }
  if ($did(S2_tracker,3) != $null) { writeini seedchar.ini $me currmp $did(S2_tracker,3) }
  if ($did(S2_tracker,4) != $null) { writeini seedchar.ini $me maxmp $did(S2_tracker,4) }
  if ($did(S2_tracker,7) != $null) { writeini seedchar.ini $me arm $did(S2_tracker,7) }
  if ($did(S2_tracker,23) != $null) { writeini seedchar.ini $me luck $did(S2_tracker,23) }
  if ($did(S2_tracker,16) != $null) { writeini seedchar.ini $me maxluck $did(S2_tracker,16) }
  if ($did(S2_tracker,72) != $null) { writeini seedchar.ini $me suithp $did(S2_tracker,72) }
}

alias S2load {
  /did -o S2_tracker 1 1 $readini(seedchar.ini,$me,currhp)
  /did -o S2_tracker 2 1 $readini(seedchar.ini,$me,maxhp)
  /did -o S2_tracker 3 1 $readini(seedchar.ini,$me,currmp)
  /did -o S2_tracker 4 1 $readini(seedchar.ini,$me,maxmp)
  /did -o S2_tracker 7 1 $readini(seedchar.ini,$me,arm)
  /did -o S2_tracker 23 1 $readini(seedchar.ini,$me,luck)
  /did -o S2_tracker 16 1 $readini(seedchar.ini,$me,maxluck)
  /did -o S2_tracker 72 1 $readini(seedchar.ini,$me,suithp)
}

alias S2armor {
  if ($did(S2_tracker,21).state) { return 0 }
  return $did(S2_tracker,7)
}

alias S2damage {
  var %damage = $1
  if ($did(S2_tracker,17).state) { 
    if (%damage >= $did(S2_tracker,3)) { var %fdam = $did(S2_tracker,3) | did -o S2_tracker 3 1 0 }
    else { did -o S2_tracker 3 1 $calc($did(S2_tracker,3) - %damage) | var %fdam = %damage }
  }
  else {
    if (%damage >= $did(S2_tracker,1)) { var %fdam = $did(S2_tracker,1) | did -o S2_tracker 1 1 0 }
    else { did -o S2_tracker 1 1 $calc($did(S2_tracker,1) - %damage) | var %fdam = %damage }
  }
  did -o S2_tracker 30 1 %fdam
}

alias S2heal {
  var %heal = $2
  if ($1 == 1) {
    if ($calc(%heal + $did(S2_tracker,1)) >= $did(S2_tracker,2)) { did -o S2_tracker 1 1 $did(S2_tracker,2) }
    else { did -o S2_tracker 1 1 $calc(%heal + $did(S2_tracker,1)) }
  }
  else {
    if ($calc(%heal + $did(S2_tracker,3)) >= $did(S2_tracker,4)) { did -o S2_tracker 3 1 $did(S2_tracker,4) }
    else { did -o S2_tracker 3 1 $calc(%heal + $did(S2_tracker,3)) }
  }
  ; Usage: heal <HP:1/MP:2>
}

on *:dialog:S2_tracker:sclick:9: {
  ; Damage button

  ; Defense Modifier
  if ($did(S2_tracker,200).state) { var %defend = 1 }
  elseif ($did(S2_tracker,201).state) { var %defend = 0.8 }
  elseif ($did(S2_tracker,202).state) { var %defend = 0.6 }
  elseif ($did(S2_tracker,203).state) { var %defend = 0.4 }
  elseif ($did(S2_tracker,204).state) { var %defend = 0.2 }
  else { var %defend = 1 }

  ; Check if damage > 0 after armor
  var %damage = $int($calc(($did(S2_tracker,5) - $S2armor) * %defend))
  if (%damage <= 0) { var %damage = 1 }

  ;Suit THP Damage
  if ($did(S2_tracker,72) > 0) && ($did(S2_tracker,72) isnum) {
    if (%damage <= $did(S2_tracker,72)) {
      did -o S2_tracker 72 1 $calc($did(S2_tracker,72) - %damage)
      var %damage = 0
    }
    else {
      var %damage = $calc( %damage - $did(S2_tracker,72) )
      did -o S2_tracker 72 1 0
    }
  }

  ;Stoneskin Damage
  if ($did(S2_tracker,31) > 0) && ($did(S2_tracker,31) isnum) {
    if (%damage <= $did(S2_tracker,31)) {
      did -o S2_tracker 31 1 $calc($did(S2_tracker,31) - %damage)
      var %damage = 0
    }
    else {
      var %damage = $calc( %damage - $did(S2_tracker,31) )
      did -o S2_tracker 31 1 0
    }
  }

  S2damage $int(%damage)
}

on *:dialog:S2_tracker:sclick:11: {
  ; Healing button
  S2heal 1 $did(S2_tracker,5)
}

on *:dialog:S2_tracker:sclick:13 {
  ; Spellcast button
  var %cost = $did(S2_tracker,5)
  if (%cost > $calc($did(S2_tracker,3) + $did(S2_tracker,73))) { msg $me MP cost exceeds current MP, cannot cast }

  ; TMP Calc
  else {
    if ($did(S2_tracker,73) > 0) && ($did(S2_tracker,73) isnum) {
      if (%cost <= $did(S2_tracker,73)) {
        did -o S2_tracker 73 1 $calc($did(S2_tracker,73) - %cost)
        var %cost = 0
      }
      else {
        var %cost = $calc( %cost - $did(S2_tracker,73) )
        did -o S2_tracker 73 1 0
      }
    }
    did -o S2_tracker 3 1 $calc($did(S2_tracker,3) - %cost)
  }
}

on *:dialog:S2_tracker:sclick:12: {
  ; MP Recovery button
  S2heal 2 $did(S2_tracker,5)
}

; Status Tracker
on *:dialog:S2_tracker:sclick:48: {
  ; End of Turn
  var %currstatus = 1
  while (%currstatus <= 12) {
    var %currtimer = $calc(%currstatus + 111)
    if ($did(S2_tracker, $+ %currtimer $+) isnum) && ($did(S2_tracker, $+ %currtimer $+) > 0) {
      did -o S2_tracker %currtimer 1 $calc($did(S2_tracker, $+ %currtimer $+) - 1)
    }
    inc %currstatus
  }
  ; Ignore name of status, status timer has an offset of +111
}

; End of status tracker

on *:dialog:S2_tracker:menu:83: {
  ; Character Open
  S2load
}

on *:dialog:S2_tracker:menu:84: {
  ; Character Save
  S2save
}

on *:dialog:S2_tracker:menu:82: {
  ; Battle End (Clear Status, Save Character)
  var %currstatus = 1
  while (%currstatus <= 12) {
    var %currtimer = $calc(%currstatus + 111)
    var %currname = $calc(%currstatus + 99)
    did -o S2_tracker %currtimer 1 $null
    did -o S2_tracker %currname 1 $null
    inc %currstatus
  }
  S2save
}

on *:dialog:S2_tracker:sclick:14: {
  ; Post button

  ; Color Coding for HP
  if ($did(S2_tracker,1) <= $calc($did(S2_tracker,2) / 10)) { var %color =  $+ 4 | var %color2 =  }
  elseif ($did(S2_tracker,1) <= $calc($did(S2_tracker,2) / 4)) { var %color =  $+ 7 | var %color2 =  }
  else { var %color = $null | var %color2 = $null }

  ; THP lines
  if ($did(S2_tracker,31) > 0) { var %thpline = $chr(91) $+ THP: $did(S2_tracker,31) $+ $chr(93) $+ $chr(32) }
  if ($did(S2_tracker,72) > 0) { var %shpline = $chr(91) $+ SHP: $did(S2_tracker,72) $+ $chr(93) $+ $chr(32) }
  var %hpline = HP: $+ %color $did(S2_tracker,1) $+ %color2 $+ / $+ $did(S2_tracker,2)

  ; MP lines
  if ($did(S2_tracker,73) > 0) { var %tmpline = $chr(91) $+ TMP: $did(S2_tracker,73) $+ $chr(93) $+ $chr(32) }
  var %mpline = MP: $+ $chr(32) $+ $did(S2_tracker,3) $+ / $+ $did(S2_tracker,4)
  var %sos = SoS: $int($calc($did(S2_tracker,2) / 4))
  var %currstatus = 1
  while (%currstatus <= 12) {
    ; Status line generator 
    var %currtimer = $calc(%currstatus + 111)
    var %currname = $calc(%currstatus + 99)
    if ($did(S2_tracker, $+ %currname $+ ) != 0) && ($did(S2_tracker, $+ %currname $+ ) != $null) {
      var %statusline = $addtok(%statusline,$did(S2_tracker, $+ %currname $+ ) ( $+ $did(S2_tracker, $+ %currtimer $+ ) $+ ),44)
    }
    inc %currstatus
  }

  ; Luck line
  var %luck = LP: $did(S2_tracker,23) $+ / $+ $did(S2_tracker,16)

  ; Spacers
  if (%statusline == $null) { var %spacer = $null }
  else { var %spacer = $chr(32) - $chr(32) }
  if ($did(S2_tracker,31) > 0) { var %spacer2 = $chr(32) }
  if ($did(S2_tracker,72) > 0) { var %spacer3 = $chr(32) }
  if ($did(S2_tracker,73) > 0) { var %spacer4 = $chr(32) }

  ; Line construction
  msg $did(S2_tracker,6) (( $+ %thpline $+ %spacer2 $+ %shpline $+ %spacer3 $+ %hpline $+ , %tmpline $+ %spacer4 $+ %mpline $+ , %luck $+ , %sos $+ %spacer $+ %statusline $+ ))
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License