So say you tune up from the default station.
cur_radio_station = 88.3
label_text = "station_"+str(cur_radio_station).replace(".","_")
renpy.jump(label_text )
and then I have a file radio.rpy that has all the labels station_88_1, through station_107_9.
The radio itself is an image map with the functions called in a pair of hotspot actions
So the player starts the game
clicks on the radio
is presented the radio screen (which should already be tuned to whatever the cur_radio_station is), and the game should jump to appropriate station_[cur_radio_station] label.
However I am getting the following error trackback whenever I go to the radio screen:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/radio.rpy", line 88, in script
r "Family, hear me!"
Exception: ui.interact called with non-empty widget/layer stack. Did you forget a ui.close() somewhere?
Stack was <Layer: 'transient'>
<Many: <renpy.display.layout.Fixed object at 0x0000000005dcc9a0>>
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/radio.rpy", line 88, in script
r "Family, hear me!"
File "H:\Program Files\Ren'Py\renpy\ast.py", line 930, in execute
renpy.exports.say(who, what, *args, **kwargs)
File "H:\Program Files\Ren'Py\renpy\exports.py", line 1474, in say
who(what, *args, **kwargs)
File "H:\Program Files\Ren'Py\renpy\character.py", line 1352, in __call__
self.do_display(who, what, cb_args=self.cb_args, dtt=dtt, **display_args)
File "H:\Program Files\Ren'Py\renpy\character.py", line 1003, in do_display
display_say(who,
File "H:\Program Files\Ren'Py\renpy\character.py", line 693, in display_say
rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
File "H:\Program Files\Ren'Py\renpy\ui.py", line 293, in interact
raise Exception("ui.interact called with non-empty widget/layer stack. Did you forget a ui.close() somewhere?\nStack was " + ('\n'.join([str(item) for item in stack])))
Exception: ui.interact called with non-empty widget/layer stack. Did you forget a ui.close() somewhere?
Stack was <Layer: 'transient'>
<Many: <renpy.display.layout.Fixed object at 0x0000000005dcc9a0>>
here is the code for the amfm_radio screen:
Code: Select all
screen amfm_radio:
imagemap:
ground "images/bg radio.png"
idle "images/bg radio.png"
hover "images/bg radio hover.png"
selected_idle "images/bg radio hover.png"
selected_hover "images/bg radio hover.png"
hotspot (784, 604, 75, 45) action fm_radio_up()
hotspot (861, 600, 82, 54) action fm_radio_down()
hotspot (988, 596, 138, 59) action NullAction()
text "{:.1f}".format(cur_radio_station):
ypos 425
xpos 800
font "font/ticking-timebomb-bb.regular.ttf"
color "#000000"
size 120
text_align 1.0
Code: Select all
def fm_radio_up():
global cur_radio_station
global label_text
if cur_radio_station < 107.9:
cur_radio_station += 0.2
else:
cur_radio_station = 88.1
label_text = "station_"+str(cur_radio_station).replace(".","_")
renpy.jump(label_text)
Code: Select all
def fm_radio_down():
global cur_radio_station
global label_text
if cur_radio_station > 88.1:
cur_radio_station -= 0.2
else:
cur_radio_station = 107.9
label_text = "station_"+str(cur_radio_station).replace(".","_")
renpy.jump(label_text)