Page 2 of 2
Re: Dreaded post-release exception bugs!
Posted: Fri Sep 23, 2022 9:01 pm
by Zetsubou
Code: Select all
renpy.image (filter(str.isalnum, atlas_item) + "_text", Text("[atlas_item]",xalign=0.4,yalign=0.85,size=30,color="#bfbfbf"))
TypeError: unsupported operand type(s) for +: 'filter' and 'str'
You're adding a filter ("filter(str.isalnum, atlas_item)") and a string ("_text") together. Renpy is telling you that you can't do that.
Are you trying to remove non alphanumeric characters from atlas_item before concatenating the string?
If so, maybe try something like
Code: Select all
init +1 python:
# Here is where the idle and hover text overlays are created. This will show whatever string is used in the atlas_gallery_items.
for atlas_item in atlas_gallery_items:
safe_str = ''.join(c for c in atlas_item if c.isalnum())
renpy.image (safe_str + "_text", Text("[atlas_item]",xalign=0.4,yalign=0.85,size=30,color="#bfbfbf"))
renpy.image (safe_str + "_text_hover", Text("[atlas_item]",xalign=0.4,yalign=0.85,size=30,color="#ffffff"))
That should go through atlas_item character by character, then join the alphanumeric characters together to create a new string.
Re: Dreaded post-release exception bugs!
Posted: Thu Sep 29, 2022 6:38 pm
by AnnieTiamat
Thanks for the reply! I wish I could recall with better clarity what I was fussing with - nearly 3 years since I messed with the screens code last and it was a lot of work back then!
Unfortunately, even adding the additional "safe_str" line still gets me the exception, only difference being a line lower. :/
Part of the difficulty with taking something built in a significantly older version and trying to update it... /sigh
Re: Dreaded post-release exception bugs!
Posted: Tue Oct 04, 2022 4:43 pm
by AnnieTiamat
Not sure if it would help to give context, but the error is surfacing in the screens.rpy file for the Gallery - I'll include the previous code if that helps:
Code: Select all
##############################################################################
# Gallery
#
# The gallery is used to display images unlocked by doing stuff.
init python:
# Yearbook settings - start
# The order of names in this list determines the order of placement in the Yearbook:
atlas_gallery_items = [atlas_entry_The_Fight_name,atlas_entry_Snuffed_Out_name,atlas_entry_Courtroom_Battle_name,atlas_entry_Company_Property_name,atlas_entry_Hard_Time_name,atlas_entry_Finally_Located_name,atlas_entry_Final_Message_name,atlas_entry_Last_Word_name,atlas_entry_Signal_Restored_name,atlas_entry_Fatal_Venting_name,atlas_entry_Timely_Arrival_name,atlas_entry_Restraint_Error_name,atlas_entry_Unsecured_Cargo_name,atlas_entry_Going_Down_name,atlas_entry_Hard_Landing_name,atlas_entry_Legal_War_name,atlas_entry_Fortunate_Escape_name,atlas_entry_Media_Circus_name,atlas_entry_Crumple_Zones_name,atlas_entry_Just_Too_Much_name]
#how many rows and columns in the gallery screens?
atlas_rows = 3
atlas_cols = 3
#thumbnail size in pixels:
atlas_thumbnail_x = 222
atlas_thumbnail_y = 152
atlas_cells = atlas_rows * atlas_cols
atlas_gallery = Gallery()
# Yearbook settings - end
# 1 - Killed in Fight
atlas_gallery.button("The Fight")
atlas_gallery.condition("persistent.end_01")
atlas_gallery.image("aFightDeath")
(etc etc more like the above until the last bit here)
Code: Select all
atlas_gallery.transition = fade
atlas_gallery.navigation = True
atlas_page=0
After that is the "init +1 python" code listed previously. Hopefully that helps!
Re: Dreaded post-release exception bugs!
Posted: Fri Oct 07, 2022 2:18 pm
by AnnieTiamat
Another bit of potentially useful info: I'd built the original game in RenPy 7.3.5, I believe - comparing the screens.rpy with a new 8.0.3 version with my classic one shows vast differences between the two, the biggest one being the wholesale lack of a gallery (which I believe past me added with assistance from this very patient forum). Thus my lack of intuition on it (and well... it's been almost 3 years since I looked at it last, that's a big thing).
UI is always a very tricky beast, and trying to fiddle with this is no exception. Essentially I have a gallery of images in the game that's only unlocked (and the name revealed) when the related ending has been unlocked. In addition to the UI, I have another file (0005_localization) that carries text in it.
Example snippet:
Code: Select all
# Gallery
$ atlas_gallery_title = "{font=P1XL.ttf}{size=110}Gallery{/size}{/font}"
$ atlas_nav_button_Previous = "Previous"
$ atlas_nav_button_Next = "Next"
$ atlas_entry_The_Fight_name = "The Fight"
$ atlas_entry_Snuffed_Out_name = "Snuffed Out"
Also I just found that commenting that part out on a lark makes another thing pop up with similar scripting later on, which I think means I need to figure out a new way to present all this. /sigh
I am INTENSELY hoping I don't have to just rebuild the entire UI to get this working. :{
Re: Dreaded post-release exception bugs!
Posted: Sat Oct 08, 2022 4:37 am
by Zetsubou
If you don't need Renpy 8 specifically, have you tried using Renpy 7.5.3 instead?
If this worked with 7.3.5, then I'd imagine that most if not all of the errors you're having are caused by the transition from Python 2 to Python 3.
Also I just found that commenting that part out on a lark makes another thing pop up with similar scripting later on
Always a good debugging step.
Comment out the problem code and try again. Rinse and repeat until it compiles/runs.
Then you'll have isolated the problematic lines and you can address them accordingly.
If all else fails, you might want to consider creating a minimal build with just the problem screen. (Is it just one screen?)
eg. Create a brand new game, import just that screen (and the images needed for that screen) from your existing game into the new one, then upload that build for someone to take a look at.
That way someone can get a better idea of what you're trying to do (ie. see the full screen and its code rather than snippets posted here) and try to compile it themself.