Old Gallery Code in New Ren'Py Issues

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
User avatar
Posts: 494
Joined: Fri Jun 27, 2014 12:26 am
Completed: numerous
Tumblr: godlinegames
Deviantart: godline-games
itch: godline

Old Gallery Code in New Ren'Py Issues

#1 Post by Godline » Sun Sep 08, 2019 1:28 am

Hey guys,
Probably a bit of a stupid question but in the latest ren'py I'm having issues getting an older gallery code to work.
Screen Shot 2019-09-08 at 3.24.46 pm.png
I'm getting this error. For this code.

init python:
#Galleries settings - start
#list the CG gallery images here:
gallery_cg_items = ["cg1", "cg2 1", "cg3", "cg6", "cg7"]

#how many rows and columns in the gallery screens?
gal_rows = 2
gal_cols = 2
#thumbnail size in pixels:
thumbnail_x = 240
thumbnail_y = 180
#the setting above (267x150) will work well with 16:9 screen ratio. Make sure to adjust it, if your are using 4:3 or something else.
#Galleries settings - end

gal_cells = gal_rows * gal_cols
g_cg = Gallery()
for gal_item in gallery_cg_items:
g_cg.button(gal_item + " butt")
g_cg.transition = fade

init +1 python:
#Here we create the thumbnails. We create a grayscale thumbnail image for BGs, but we use a special "locked" image for CGs to prevent spoilers.
for gal_item in gallery_cg_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))

screen cg_gallery:
tag menu
add "gui/bg.png"

add "gui/cred.png"
add "gui/cg.png" xpos 530 ypos 0
xpos 370
yalign 0.89

textbutton _("Back") action Return()

xpos 90
yalign 0.89

textbutton _("Achievements") action ShowMenu ("endings")
frame background None xpos 10:
grid gal_rows gal_cols:
xpos 90
ypos 100
$ i = 0
$ next_cg_page = cg_page + 1
if next_cg_page > int(len(gallery_cg_items)/gal_cells):
$ next_cg_page = 0
for gal_item in gallery_cg_items:
$ i += 1
if i <= (cg_page+1)*gal_cells and i>cg_page*gal_cells:
add g_cg.make_button(gal_item + " butt", gal_item + " butt", im.Scale("gallocked.png", thumbnail_x, thumbnail_y), xalign=0.5, yalign=0.5, idle_border=None, background=None, bottom_margin=24, right_margin=30)
for j in range(i, (cg_page+1)*gal_cells): #we need this to fully fill the grid
xpos 550
yalign 0.9

if len(gallery_cg_items)>gal_cells:
textbutton _("Next") action [SetVariable('cg_page', next_cg_page), ShowMenu("cg_gallery")]


User avatar
Miko-Class Veteran
Posts: 976
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao

Re: Old Gallery Code in New Ren'Py Issues

#2 Post by isobellesophia » Fri Sep 13, 2019 6:34 am

Most likely the gallery code its too old, and cannot be reused in new version. I think there will be alot of changes and fixes.

What version of that code is used in RenPy?

I think this one is a good to use, since i was using it currently.

Dont worry about that new code, its not that even hard to use, there are tutorials for how will you use it.
I am a friendly user, please respect and have a good day.



Post Reply

Who is online

Users browsing this forum: Google [Bot]