Code:
on *:text:!Eat*:#Lunarmyst:{
  if (%health [ $+ [ $nick ] ] >= 100) {
    msg $chan You Already Have Full Health!
    return
  }

  var %restore = $iif($calc( 100 - %health [ $+ [ $nick ] ] ) < %cache, $v1, $v2)

  if (%restore <= 0) {
    msg $chan Cache is empty
    return
  }

  dec %cache %restore
  inc %health [ $+ [ $nick ] ] %restore

  msg $chan $nick You Have Just Ate from the Cache and restored %restore health!!
  msg $chan Remaining cache: %cache Points
}


From context I assume this is what you want. I've added the appropriate logic such that %cache will not become negative.

Last edited by Loki12583; 24/09/14 03:04 AM.