I am trying to write a simple screen which shows an information page for each character/subplot in my novel and it almost but not quite works. Everything is working apart from the icon.
The story name and hint are displayed correctly and change correctly when you hit Prev/Next, the exit button is always displayed and exits the screen. The Prev/Next buttons work, they appear when they should and cause the information to change to different stories. Unfortunatly, the icon gets displayed for the first story then never changes even though I can see that the name of the icon changes correctly. Its like once there is an icon displayed nothing else can override it. I have checked that all the icon names are correct in the other stories by substituting them into the the story at index zero as well.
I am sure I am missing something obvious but I have no idea what so please point out my mistake.
My code:
Code: Select all
screen storyBook(index):
# Retrieve data about this story
$ story = storyClass.allStories[index]
$ icon = story.getIcon()
$ name = story.getName()
$ hint = story.getHint()
$ maxIndex = len(storyClass.allStories) - 1
# show the icon on the left
add "[icon]" pos (90, 60)
# story name at the top
hbox:
pos (540, 60)
box_wrap True
text "[name]"
# bit of debug text just to prove that the icon name was changing correctly
text " index = [index], icon = [icon]"
# story progress hint underneat
hbox:
pos (540, 210)
box_wrap True
text "[hint]"
# prev story button as long as there is one
if index != 0:
textbutton "Prev":
pos (540, 610)
action Show("storyBook", None, index - 1)
# close this screen
textbutton "Exit":
pos (790, 610)
action Hide("storyBook")
# next story button if there is one
if index < maxIndex:
textbutton "Next":
pos (1040, 610)
action Show("storyBook", None, index + 1)