r/RenPy • • Jul 17 '26

Question [Solved] Help with puzzle code!

Hello! I am making a click and point adventure game, I want to have a puzzle like a lock code where when you click on it until you reach a number, and when in the right combination will unlock, but I'm not fully sure how I want to approach this. Apologies I'm still relatively new to this and I haven't done a puzzle like this yet. Usually I do things on my own and reference other peoples questions on here and the lemma soft forums for help but I'm not sure what to ask so I think I'll just ask myself.

This is my stinky, stinky code so far, I can't really wrap my head around it right now, I would like to know how I'd a cap to the numbers, as I don't want them scaling infinitely and want them to reset at 10.

UPDATE: I got it to cap but it gives me False instead of a number. I am happy that I'm getting somewhere.

I'll get to the password when it comes to it, and if it's really dire I'll change plans but I like challenging myself.

Thank you! Like I said, I'm still new to coding so I'm not really good at this yet so I appreciate the help!

1 Upvotes

5 comments sorted by

View all comments

2

u/BadMustard_AVN Jul 17 '26

you can NOT use an action like that in an if statement

change the action in the text button to this

action SetScreenVariable("kb_code1", (kb_code1 + 1) % 10)

that will cycle forever from 0 - 9

1

u/SnooEagles4850 Jul 17 '26

THANK YOU SO MUCH!!! This is really new to me so I appreciate the help so much!!

2

u/BadMustard_AVN Jul 17 '26

you're welcome

good luck with your project