Dreaded post-release exception bugs!

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Message
Author
User avatar
Zetsubou
Miko-Class Veteran
Posts: 513
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Dreaded post-release exception bugs!

#16 Post by Zetsubou » Fri Sep 23, 2022 9:01 pm

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.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

Image

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Dreaded post-release exception bugs!

#17 Post by AnnieTiamat » Thu Sep 29, 2022 6:38 pm

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

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Dreaded post-release exception bugs!

#18 Post by AnnieTiamat » Tue Oct 04, 2022 4:43 pm

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!

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Dreaded post-release exception bugs!

#19 Post by AnnieTiamat » Fri Oct 07, 2022 2:18 pm

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. :{

User avatar
Zetsubou
Miko-Class Veteran
Posts: 513
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Dreaded post-release exception bugs!

#20 Post by Zetsubou » Sat Oct 08, 2022 4:37 am

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.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

Image

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Dreaded post-release exception bugs!

#21 Post by AnnieTiamat » Mon Nov 14, 2022 2:08 pm

Yeah, I bet 100% it's Python 3 straight-up heckin with me, which is making me absolutely dread having to redo my UI. I've pretty much committed to turning all the incredibly exhaustive frame-by-frame animations into webm files, so in for a dime, in for a dollar, I suppose?

I don't want to stop using RenPy, so hacking at a new UI for a new game (percolating in my head already) might be a decent test bed for what I'm looking for. I'm wanting to do the whole "gallery unlocks new images when you get different endings and they're locked from the beginning" thing there too, so while that's a longer step, might be a better one.

(YEEEEEESH I am not looking forward to it tho, I tell you what)

Post Reply

Who is online

Users browsing this forum: No registered users