Page 1 of 1

ConditionSwitch and Gallery

Posted: Wed Dec 04, 2019 6:17 pm
by Imperf3kt
I'm using ConditionSwitch to control which character image shows based on a variable called "score", different poses, outfits, etc. I eventually plan to make these animated, but that shouldn't matter.

This works great and as player score goes up and down, the image shown changes accordingly.

However I also have a gallery in my game to showcase the stuff you unlock. This works great if I just show the individual images but as this was giving me trouble with logic, I started using ConditionSwitch.
The trouble here is that this does not work well, none of the images unlock after being seen.

I scoured the documentation for some clues, but couldn't work out why, so instead looked for some kind of renpy.MarkImageAsSeen("imageName") , but didn't find anything.

The best thing I found was

Code: Select all

    show myImage
    hide myImage
But this seems hacky.

Is there any better way to do this?

Re: ConditionSwitch and Gallery

Posted: Wed Dec 04, 2019 6:49 pm
by deltadidirac
Imperf3kt wrote:
Wed Dec 04, 2019 6:17 pm
I'm using ConditionSwitch to control which character image shows based on a variable called "score", different poses, outfits, etc. I eventually plan to make these animated, but that shouldn't matter.

This works great and as player score goes up and down, the image shown changes accordingly.

However I also have a gallery in my game to showcase the stuff you unlock. This works great if I just show the individual images but as this was giving me trouble with logic, I started using ConditionSwitch.
The trouble here is that this does not work well, none of the images unlock after being seen.

I scoured the documentation for some clues, but couldn't work out why, so instead looked for some kind of renpy.MarkImageAsSeen("imageName") , but didn't find anything.

The best thing I found was

Code: Select all

    show myImage
    hide myImage
But this seems hacky.

Is there any better way to do this?
I solved my problem (perhaps not in an elegant way) giving a boolean variable to each stuff; if uou unlock is True, on contrary false; so you can use or if/else or condition switch

..... I suppose....
bye

Re: ConditionSwitch and Gallery

Posted: Tue Dec 10, 2019 12:10 am
by Imperf3kt
No other suggestions?
Using a boolean would work, but I could probably get the same effect by using https://www.renpy.org/doc/html/rooms.ht ... lock_image

Maybe ConditionSwitch is the wrong function to use?

Re: ConditionSwitch and Gallery

Posted: Tue Dec 10, 2019 4:07 am
by deltadidirac
(sorry for the message before I crashed)
You could write a label (or a Function based on a list if you are able to do it), building one single variable and link the different value of it on each single image.

example:

Code: Select all

define img1  = "loock" 
define img2 = ..... etc...  ####### all your images will be loock at start ( but for not define every single image, you could create a function with a list to define this in one step)
define im_val == 0  ##### value == 0 no image
label list_img:
	if img_val >0:
		$ img1 == unlock
	elif img_val >1:
		$ img2 == unlock
	elif.....
		etc.......
	else:
		return  ##### in conditionSwitch you will use the variable img_val
but if you are able to create a list in witch you find all your imagine and an operation that search the img_val value and read the lable list_img to define if and how images are unlock; when you call your function, this last will do all.


Sorry if is not a clear and define msg, I hope you understand the idea...

see you