Ren'Py questions
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.
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.
Ren'Py questions
Alright, I really couldn't place this in "working on DSE", since it doesn't have the first thing to do with it. So I thought I'd at least keep the thread general, so that other people can use it to ask questions in it to, instead of opening up a new thread each time...
Question:
I have been doing a small side project in the last few hours.
All I am doing, is grabbing a picture from a folder, waiting for the user (via ui.saybehavior+ui.interact ), looping and displaying the next one.
Works wonderfully. Problem: Interactive rollback doesn't work. While saving and loading does. I already tried to add renpy.checkpoint(). I don't know what I am overlooking.
Question:
I have been doing a small side project in the last few hours.
All I am doing, is grabbing a picture from a folder, waiting for the user (via ui.saybehavior+ui.interact ), looping and displaying the next one.
Works wonderfully. Problem: Interactive rollback doesn't work. While saving and loading does. I already tried to add renpy.checkpoint(). I don't know what I am overlooking.
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
Nope, I am leaving the python block.
However, I am not using the while statement either. I am just jumping back to the loop label (same way the DSE main loop works, basically).
However, I am not using the while statement either. I am just jumping back to the loop label (same way the DSE main loop works, basically).
config.rollback_enabled = True
config.hard_rollback_limit = config.rollback_length
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
It's not long, so I am just going to paste it in here.
If you need to look at ui_image and/or find_file as well, just tell me.
If it would me more convenient to have the script send as e-mail: again, just tell me.
Code: Select all
label start:
label main_loop:
scene black
python:
renpy.checkpoint()
#does the image exist?
numberstring=str(stripnumber)
if stripnumber< 10: numberstring='0'+numberstring
if stripnumber<100: numberstring='0'+numberstring
filename=numberstring+letters[letterN]
file=find_file(filename, imageFolders, imageEndings)
if not file:
jump main_end
python:
#display a heading, and the picture
ui_image( None, 'Strip '+str(stripnumber), textSize=30, fillColor=(0,0,0,0),
xpos=0.5, xanchor='center', ysize=100 )
ui_image( file, None, scaleImage=2.0,
xpos=0.5, xanchor='center', ysize=400 )
ui.saybehavior()
#transition if the stripnumber changed
if letterN==0:
renpy.transition( dissolve )
#paint on screen, and wait for user to proceed
ui.interact()
#change stripnumber and letterN to point to the next image
if letterN==len(letters)-1:
letterN=0
stripnumber+=1
else: letterN+=1
#and loop...
jump main_loop
If it would me more convenient to have the script send as e-mail: again, just tell me.
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
- PyTom
- Ren'Py Creator
- Posts: 16088
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Try putting the renpy.checkpoint() right after the ui.interact().
My gut instinct is that what's going on is we're rolling back from the second python block to the first, then immediately rolling forward to the second, giving the appearance of there being no rollback.
(So a print statement put before the ui.interact() would print something out every time you try to roll back.)
Special bonus hint:
Can be written as:
My gut instinct is that what's going on is we're rolling back from the second python block to the first, then immediately rolling forward to the second, giving the appearance of there being no rollback.
(So a print statement put before the ui.interact() would print something out every time you try to roll back.)
Special bonus hint:
Code: Select all
numberstring=str(stripnumber)
if stripnumber< 10: numberstring='0'+numberstring
if stripnumber<100: numberstring='0'+numberstring
Code: Select all
numberstring = "%03d" % stripnumber
Thanks! Works, and works.
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
Just got the following error
Is Ren'Py trying to tell me it can't do it because gifs don't have an alpha channel?
If so, it's pretty poorly worded. Or is something else going on?
EDIT after answer (saw it too late): And while I am asking: Any way to get the point across to Ren'Py that an interaction hasn't occured yet? Right now Ren'Py allows me to skip unseen pictures as well. Would generating from clauses on the fly help? (Haven't looked whether that is possible yet)
I tried to make a gif image half transparent ( via im.Alpha( image, alpha ) ).Exception: Surface alphas do not match.
Is Ren'Py trying to tell me it can't do it because gifs don't have an alpha channel?
If so, it's pretty poorly worded. Or is something else going on?
EDIT after answer (saw it too late): And while I am asking: Any way to get the point across to Ren'Py that an interaction hasn't occured yet? Right now Ren'Py allows me to skip unseen pictures as well. Would generating from clauses on the fly help? (Haven't looked whether that is possible yet)
Last edited by Icekiss on Thu Aug 11, 2005 7:44 am, edited 2 times in total.
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
- PyTom
- Ren'Py Creator
- Posts: 16088
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Hm... What Ren'Py version are you using, and what bit-depth are you running at, and is there an alpha channel already in your image? (The latter may be hard to tell.)
The error you're getting can never happen... Which means I need to find out why it's happening.
A drop of the code would be nice, but I won't be able to deal with it until tonight.
The error you're getting can never happen... Which means I need to find out why it's happening.
A drop of the code would be nice, but I won't be able to deal with it until tonight.
In this case stock Ren'Py 5.0.1
Depth should be 16bpp (thats the first number in the list for screen0, and I can see the staircase effect on my screen)
Can't figure how to tell whether the gif has an alpha channel. Konqueror doesn't provide meta data on it, and I can't find where gimp gives out general informations about the picture I am viewing. Name of an utility I can use to tell would be appreciated.
actual code:
or, condensed to what should be important here:
Depth should be 16bpp (thats the first number in the list for screen0, and I can see the staircase effect on my screen)
Can't figure how to tell whether the gif has an alpha channel. Konqueror doesn't provide meta data on it, and I can't find where gimp gives out general informations about the picture I am viewing. Name of an utility I can use to tell would be appreciated.
actual code:
Code: Select all
$ strip_alpha=0.9
Code: Select all
ui_image( file, None, scaleImage=2.0, alpha=strip_alpha,
xpos=strip_xpos, xanchor=strip_xanchor, ysize=strip_ysize )
Code: Select all
image=im.Image( filename )
if scaleImage==True: image=im.Scale( image, xsize, ysize )
if str(scaleImage)[0].isdigit(): image=im.Rotozoom( image, 0, scaleImage )
if alpha!=1.0: image=im.Alpha( image, alpha )
Code: Select all
image=im.Image( filename )
image=im.Rotozoom( image, 0, 2.0 )
image=im.Alpha( image, 0.9 )
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
- PyTom
- Ren'Py Creator
- Posts: 16088
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
I'd try it at 24, to see if that matters. Ren'Py 5.0.1 should always run at 24 or 32 bits internally... but obviously something is going wrong.Icekiss wrote:In this case stock Ren'Py 5.0.1
Depth should be 16bpp (thats the first number in the list for screen0, and I can see the staircase effect on my screen)
Go into GIMP, and try erasing the image. If it erases to white, no alpha channel, to the gray checkerboard, alpha channel.Can't figure how to tell whether the gif has an alpha channel. Konqueror doesn't provide meta data on it, and I can't find where gimp gives out general informations about the picture I am viewing. Name of an utility I can use to tell would be appreciated.
What happens if you disable the rotozoom? Also, is this happening with every image, or one particular image.Code: Select all
image=im.Image( filename ) image=im.Rotozoom( image, 0, 2.0 ) image=im.Alpha( image, 0.9 )
When I get home tonight, I'll try setting up a 16bpp X server so I can properly troubleshoot this.
Taking the rotozoom out prevents the error from occuring!
I haven't found an image in this series where it doesn't happen.
Gimp shows white background -> no alpha channel in the gifs.
Setting up my own xserver to do 24bpp would be more work (Must have run into some stumbling block when I set up linux, or else it would be in use right now). Might try it later.
I haven't found an image in this series where it doesn't happen.
Gimp shows white background -> no alpha channel in the gifs.
Setting up my own xserver to do 24bpp would be more work (Must have run into some stumbling block when I set up linux, or else it would be in use right now). Might try it later.
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
Glad I could be of help.
Two other questions (no bugs, just questions ):
1)
Any way to get the point across to Ren'Py that an interaction hasn't occured yet? Right now Ren'Py allows me to skip unseen pictures as well. Would generating from clauses on the fly help? (Haven't looked whether that is possible yet)
2)
While I can add images created via im functions as widgets (via ui.add( image ); ha, found that one myself ), ui.add doesn't take positional parameters.
So I have to wrap it into another widget that does. I am currently using ui.fixed for this. But since ui.fixed doesn't react to xfill/yfill, that doesn't work too well when I don't know the size of the image (when I do, I can use xmaximum and ymaximum to restrict ui.fixed to the size of the image).
So what's the easiest way of doing the wrapping? Taking ui.window and stylizing all padding and background away?
Or determinig the size of the image? (How?)
(Basically a question I can figure out myself via brute force. But you could probably point in me in the right direction with a single sentence. So I am asking.)
Two other questions (no bugs, just questions ):
1)
Any way to get the point across to Ren'Py that an interaction hasn't occured yet? Right now Ren'Py allows me to skip unseen pictures as well. Would generating from clauses on the fly help? (Haven't looked whether that is possible yet)
2)
While I can add images created via im functions as widgets (via ui.add( image ); ha, found that one myself ), ui.add doesn't take positional parameters.
So I have to wrap it into another widget that does. I am currently using ui.fixed for this. But since ui.fixed doesn't react to xfill/yfill, that doesn't work too well when I don't know the size of the image (when I do, I can use xmaximum and ymaximum to restrict ui.fixed to the size of the image).
So what's the easiest way of doing the wrapping? Taking ui.window and stylizing all padding and background away?
Or determinig the size of the image? (How?)
(Basically a question I can figure out myself via brute force. But you could probably point in me in the right direction with a single sentence. So I am asking.)
If you are a debian linux user, take a look at my program: http://deb-install.sourceforge.net/
- PyTom
- Ren'Py Creator
- Posts: 16088
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
No, not really. The granularity of the skipping is on the Ren'Py statement level... once you've interacted inside a Ren'Py statement, that statement is eligible to be skipped. I can't think of any other rule for this that makes sense, at least for the type of games Ren'Py is aimed at.Icekiss wrote: 1) Any way to get the point across to Ren'Py that an interaction hasn't occured yet? Right now Ren'Py allows me to skip unseen pictures as well. Would generating from clauses on the fly help? (Haven't looked whether that is possible yet)
You seem to be making some sort of image viewer... This is, to some extent, beyond what Ren'Py is really good at.
I believe that ui.image should be able to take an im-constructed image as its first argument, and it also takes properties as arguments.While I can add images created via im functions as widgets (via ui.add( image ); ha, found that one myself ), ui.add doesn't take positional parameters.
Who is online
Users browsing this forum: Ocelot, trailsiderice