Post new topic    
Slime Knight
Send private message
Quick Status Menu: Update after items/magic menu 
 PostFri Apr 25, 2014 8:50 am
Send private message Reply with quote
I'm working on a new version of my old Emiki game that went nowhere, and I have a question about the "quick status" feature I have in it.

Here is the relevant part of my HSS file:
Code:
script, create quick status, begin
   quick status := load slice collection(2)
   
          herobox := lookup slice(sli:Box0)
          display hero box(0)
          herobox := lookup slice(sli:Box1)
          display hero box(1)
          herobox := lookup slice(sli:Box2)
          display hero box(2)
          
          #get map name and change short box
          variable(v, temp)
          temp := lookup slice(sli:MapName)
          get map name (1, current map)
          set slice text (temp, 1)
       
          #display money
          temp := lookup slice(sli:Money)
          clear string(1)
          append number(1, party money)
          append ascii(1, 32)
          append ascii(1, 36)
          set slice text(temp, 1)
       
          #display play time
          temp := lookup slice(sli:PlayTime)
          clear string(1)
          append ascii(1, 159)
          append ascii(1, 32)
          v := (days of play * 24) + hours of play
          if(v << 10) then(
             append ascii(1,48)
          )
          append number(1, v)
          append ascii(1, 58)
          if(minutes of play << 10) then(
             append ascii(1,48)
          )
          append number(1, minutes of play)
          set slice text(temp, 1)
          wait for key
end

script, display hero box, i = 0, begin
   variable(temp, v)
   if(hero by rank(i) <> -1) then(      
      #get information of hero
      #change sprite picture
      
      temp := lookup slice(sli:Portrait, herobox)
      replace portrait sprite(temp, plut(hero by rank(i)))
      
      #change hero lv
      
      temp := lookup slice(sli:Level, herobox)
      $1="LV "
      append number (1, get hero level(i))
      set slice text (temp, 1)
      
      #change hero name
      
      temp := lookup slice(sli:Name, herobox)
      get hero name(1, i)
      set slice text (temp, 1)
   
      #calculate HP and MP bars
      #((78*cur)/ max) = X
      
      temp := lookup slice(sli:HPBar, herobox)         
      v := get hero stat(i,stat:HP,current stat) * 78
      v := v / get hero stat(i,stat:HP,maximum stat)
      set slice width(temp, v)
      
      temp := lookup slice(sli:HP, herobox)
      clear string(1)
      append number(1, get hero stat(i,stat:HP,current stat))
      append ascii(1, 47)
      append number(1, get hero stat(i,stat:HP,maximum stat))
      set slice text(temp, 1)
      
      temp := lookup slice(sli:MPBar, herobox)      
      v := get hero stat(i,stat:MP,current stat) * 78
      v := v / get hero stat(i,stat:MP,maximum stat)
      set slice width(temp, v)
      
      temp := lookup slice(sli:MP, herobox)
      clear string(1)
      append number(1, get hero stat(i,stat:MP,current stat))
      append ascii(1, 47)
      append number(1, get hero stat(i,stat:MP,maximum stat))
      set slice text(temp, 1)
   )
   else(set slice visible(herobox,off))
end


Now if I use a healing item or spell from a submenu, the info will be out of date. How can I make it update?

Additional info: It's triggered from an "on key press" script and the main menu allows scripts and gameplay
Metal King Slime
Send private message
 
 PostFri Apr 25, 2014 1:28 pm
Send private message Reply with quote
There's an option in the menu editor to have a script that runs when you close the menu, the "On-Close Script". Presumably any spell or potion you'd use would be from the menu, maybe you could have an On-Close script that would update the stat boxes?
Blubber Bloat
Send private message
 
 PostFri Apr 25, 2014 3:30 pm
Send private message Reply with quote
Why'd you drop Emiki, anywho?
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x V
Slime Knight
Send private message
 
 PostSat Apr 26, 2014 12:41 am
Send private message Reply with quote
Meowskivich wrote:
Why'd you drop Emiki, anywho?


Real life issues (college mostly)

Gizmog wrote:
There's an option in the menu editor to have a script that runs when you close the menu, the "On-Close Script". Presumably any spell or potion you'd use would be from the menu, maybe you could have an On-Close script that would update the stat boxes?


The quick status screen is made to appear when the main menu is open only, so the on-close script is the destructor code for the quick status screen.
Metal King Slime
Send private message
Re: Quick Status Menu: Update after items/magic menu 
 PostSun Apr 27, 2014 9:27 am
Send private message Reply with quote
The simplest thing to do is to create two plotscripts to wrap the Items and Spells menus which first calls the itemsmenu or spellsmenu command, then destroys and recreates the quick status menu. Replace the Items and Spells menu items with calls to those scripts.

Actually, even simpler would be to just destroy and recreate the quick status menu either every tick or every time the player touches a key.
Slime Knight
Send private message
 
 PostMon Apr 28, 2014 2:35 am
Send private message Reply with quote
The "destroy and recreate each tick" trick works. So if I don't have a complete game, I at least have a neat little tech demo.
Display posts from previous: