0 votes
by (210 points)

Hey everyone,
I have an inventory interface(a lot of divs with layering images) in the left sidebar of my game. The interface has two tabs, clothing and backpack. For now, the code looks like this:

<<link [img[images/icons/ui01.png]]>>
	<<set $Visiblelayer to "clothing">>
	<<goto `passage()`>>
	<</link>>
<<link [img[images/icons/ui02.png]]>>
	<<set $Visiblelayer to "backpack">>
	<<goto `passage()`>>
	<</link>>
<<if $Visiblelayer is "clothing">>
	*clothing interface*
<<elseif $Visiblelayer is "backpack">>
	*backback inferface*
<</if>>

It works fine, but the unnecesary reload of the whole passage bothers me, it may cause troubles in the future. And overall I think there must be some cleaner way to do this.

So the question is - how can I refresh just she sidebar without refreshing the whole passage? Thanks in advance!

1 Answer

+1 vote
by (68.6k points)

You really don't even need to refresh the entire UI bar.

Assuming this is in the StoryCaption special passage, try the following:

<<link [img[images/icons/ui01.png]]>>
	<<set $Visiblelayer to "clothing">>
	<<replace "#story-caption">><<include "StoryCaption">><</replace>>
<</link>>
<<link [img[images/icons/ui02.png]]>>
	<<set $Visiblelayer to "backpack">>
	<<replace "#story-caption">><<include "StoryCaption">><</replace>>
<</link>>

 

by (210 points)
It works absolutely perfectly. Thank you very much!
...