What I'm trying to do is create a screen that will be called whenever the player is prompted a question that requires them to present evidence.
I'm a little fuzzy on the details on how this screen works. It uses classes to sort give each item a name, description, and thumbnail. So that when an item is selected, it shows the description and thumbnail.
So when using this first I call the screen with the following.
Code: Select all
call screen evidence("How do we make this screen usable?")
Code: Select all
#Class code
init python:
class Item():
def __init__(self, name, desc, pic):
self.name = name
self.desc = desc
self.pic = pic
#Screen code
screen evidence(question):
imagemap:
ground "UI/evidence_screen.png"
hotspot (1176, 604, 85, 100) action Return
text question ypos 603 xpos 149 size 40
fixed:
xysize (995, 556)
xalign 0.5
yalign 0.1
vpgrid:
default selected_item = None
cols 1
spacing -4
draggable True
mousewheel True
scrollbars "vertical"
xpos 0
ypos 0
side_xalign 0.0
xysize (400, 558)
for evidence_item in evidence_list:
textbutton evidence_item.name xysize (385, 50):
bottom_margin 10
right_margin 5
left_padding 25
text_size 30
text_color "fff"
background "#222"
hover_background "#f00"
selected_background "#960000"
action (SetScreenVariable(name='selected_item', value=evidence_item))
#Thumbnail
vbox:
yalign 0
xpos 400
xysize (500, 300)
vbox:
if selected_item:
add selected_item.pic
yalign 0.5 xalign 0.5
else:
add "in_blank"
yalign 0.5 xalign 0.5
#Description
frame:
xpos 400
background "in_frame"
yalign 1.0
xysize (595, 256)
viewport:
if selected_item:
text selected_item.desc size 20
else:
pass
Code: Select all
$ evi = "Value" #Probably a unique number I can associate with the corresponding item.
#I've tried testing it with something like this, but it never returned a usable value.
$ evi = selected_item.name
Sorry if I'm rambling or not making sense. I appreciate appreciate any suggestions on my approach.