Quick Status Menu: Update after items/magic menu

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
Ichiro
Slime Knight
Posts: 237
Joined: Sat Sep 11, 2010 1:20 am
Location: john madden

Quick Status Menu: Update after items/magic menu

Post by Ichiro »

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: Select all

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&#40;v << 10&#41; then&#40;
    			append ascii&#40;1,48&#41;
    		&#41;
    		append number&#40;1, v&#41;
    		append ascii&#40;1, 58&#41;
    		if&#40;minutes of play << 10&#41; then&#40;
    			append ascii&#40;1,48&#41;
    		&#41;
    		append number&#40;1, minutes of play&#41;
    		set slice text&#40;temp, 1&#41;
    		wait for key
end

script, display hero box, i = 0, begin
	variable&#40;temp, v&#41;
	if&#40;hero by rank&#40;i&#41; <> -1&#41; then&#40;		
		#get information of hero
		#change sprite picture
		
		temp &#58;= lookup slice&#40;sli&#58;Portrait, herobox&#41;
		replace portrait sprite&#40;temp, plut&#40;hero by rank&#40;i&#41;&#41;&#41;
		
		#change hero lv
		
		temp &#58;= lookup slice&#40;sli&#58;Level, herobox&#41;
		$1="LV "
		append number &#40;1, get hero level&#40;i&#41;&#41;
		set slice text &#40;temp, 1&#41;
		
		#change hero name
		
		temp &#58;= lookup slice&#40;sli&#58;Name, herobox&#41;
		get hero name&#40;1, i&#41;
		set slice text &#40;temp, 1&#41;
	
		#calculate HP and MP bars
		#&#40;&#40;78*cur&#41;/ max&#41; = X
		
		temp &#58;= lookup slice&#40;sli&#58;HPBar, herobox&#41;			
		v &#58;= get hero stat&#40;i,stat&#58;HP,current stat&#41; * 78
		v &#58;= v / get hero stat&#40;i,stat&#58;HP,maximum stat&#41;
		set slice width&#40;temp, v&#41;
		
		temp &#58;= lookup slice&#40;sli&#58;HP, herobox&#41;
		clear string&#40;1&#41;
		append number&#40;1, get hero stat&#40;i,stat&#58;HP,current stat&#41;&#41;
		append ascii&#40;1, 47&#41;
		append number&#40;1, get hero stat&#40;i,stat&#58;HP,maximum stat&#41;&#41;
		set slice text&#40;temp, 1&#41;
		
		temp &#58;= lookup slice&#40;sli&#58;MPBar, herobox&#41;		
		v &#58;= get hero stat&#40;i,stat&#58;MP,current stat&#41; * 78
		v &#58;= v / get hero stat&#40;i,stat&#58;MP,maximum stat&#41;
		set slice width&#40;temp, v&#41;
		
		temp &#58;= lookup slice&#40;sli&#58;MP, herobox&#41;
		clear string&#40;1&#41;
		append number&#40;1, get hero stat&#40;i,stat&#58;MP,current stat&#41;&#41;
		append ascii&#40;1, 47&#41;
		append number&#40;1, get hero stat&#40;i,stat&#58;MP,maximum stat&#41;&#41;
		set slice text&#40;temp, 1&#41;
	&#41;
	else&#40;set slice visible&#40;herobox,off&#41;&#41;
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
Image
User avatar
Gizmog
Metal King Slime
Posts: 2615
Joined: Tue Feb 19, 2008 5:41 am

Post by Gizmog »

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?
User avatar
Meowskivich
Blubber Bloat
Posts: 2199
Joined: Tue Mar 06, 2012 12:38 am
Location: Earth
Contact:

Post by Meowskivich »

Why'd you drop Emiki, anywho?
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x :V
User avatar
Ichiro
Slime Knight
Posts: 237
Joined: Sat Sep 11, 2010 1:20 am
Location: john madden

Post by Ichiro »

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.
Last edited by Ichiro on Sat Apr 26, 2014 7:58 pm, edited 2 times in total.
Image
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Re: Quick Status Menu: Update after items/magic menu

Post by TMC »

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.
User avatar
Ichiro
Slime Knight
Posts: 237
Joined: Sat Sep 11, 2010 1:20 am
Location: john madden

Post by Ichiro »

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.
Last edited by Ichiro on Mon Apr 28, 2014 3:15 am, edited 1 time in total.
Image
Post Reply