Hello!
I made a horror game that came out on Steam recently, and I'm looking into making some DLC for it. A feature of the DLC is the use of a radio. Here's what the bare bones version of the radio's interface looks like:
How this works is that it uses a set of screens, one that is the radio itself, and a custom bar slider that acts as the tuner. The numbers above the bar correspond to the current radio station, which is important to this section of the game. Here's the code I've made to create this screen:
Code: Select all
screen Leave:
frame:
align (.79,.8)
padding (20,10)
textbutton "LEAVE" action Jump("AnotherDay"):
activate_sound "audio/typeClick.mp3"
init python:
signals = [
101.1, 101.2, 101.3, 101.4,
102.1, 102.2, 102.3, 102.4,
103.1, 103.2, 103.3, 103.4,
104.1, 104.2, 104.3, 104.4
]
persistent.signal = 0
stationNum = persistent.signal
currentSignal = signals[stationNum]
screen radioBar2:
bar:
value FieldValue(persistent, "signal", 15, style="radio_slider", step=1, force_step = False)
align (.5,.5)
xsize 600
ysize 35
thumb "gui/slider/rad_thumb.png"
thumb_offset 32
left_gutter 13
right_gutter 13
screen cellRadio():
$ stationNum = persistent.signal
$ currentSignal = signals[stationNum]
frame:
align (0.5,0.5)
padding (100,80)
vbox:
spacing 30
frame:
align (.5,.5)
padding (25,15)
text "[currentSignal]" size 50 font "fonts/digital-7.ttf"
use radioBar2
use Leave
label radioScreen:
call screen cellRadio
Here's the issue: When the cellRadio screen is open, and I go to the pause menu, there's an issue when I come back, but ONLY from the Options screen (the EXACT same screen as the 'Preferences' screen in a vanilla Ren'py project found in screens.rpy). When I right click and go to Options, and then right click to close it and come back to the gameplay, it will return an error. The error is the same as the subject line for this post: TypeError: list indicies must be integers or slices, not NoneType. For anyone curious, here's exactly what the error screen looks like:
The main question is this: Why do the Options screen and the cellRadio screen have issues with each other? I've tried deleting and altering certain values used in cellRadio, but nothing really changes. Curiously, deleting $ stationNum = persistent.signal and $ currentSignal = signals[stationNum] results in a different error:
TROUBLESHOOTING:
I've tried a bit of troubleshooting on my end. I think this is because something in the 'signals' list is turning up as "None," or that the range I'm using is too large, but I haven't found any significant change that stops either error. Because this ONLY happens with the Options screen, I assumed it might be an issue with the bars on that screen and the cellRadio screen. I've tried using different bar settings like StaticValue instead of FieldValue, and while the radio still functioned after making the proper edits, it still turned up the same error.
Apologies if this is a long post, but I'd like to get this issue resolved soon, and wanted to make sure I provided as many different facets of the issue as possible. Thanks in advance to anyone who has any info on this issue!