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.
-
ShadoStalk3r
- Newbie
- Posts: 7
- Joined: Mon Oct 29, 2018 6:17 am
-
Contact:
#1
Post
by ShadoStalk3r » Tue Jun 01, 2021 10:41 pm
Hi all,
I have a gallery built in that typically unlocks an image as it is seen in the game. But I would rather use a code in the script file itself that unlocks an image of my choosing.
I've tried in my script file:
Code: Select all
$ g.unlock_image("ImageIWantUnlocked")
And get nothing at all.
And also:
Code: Select all
$ Gallery.unlock_image("ImageIWantUnlocked")
But I get this:
Code: Select all
While running game code:
File "game/script.rpy", line 82, in script
$ Gallery.unlock_image("ImageIWantUnlocked")
File "game/script.rpy", line 82, in <module>
$ Gallery.unlock_image("ImageIWantUnlocked")
TypeError: unbound method unlock_image() must be called with Gallery instance as first argument (got unicode instance instead)
But it won't unlock anything in my gallery.
How do I do this?
-
mavyxdawn
- Regular
- Posts: 69
- Joined: Sun Dec 20, 2015 6:18 pm
- Github: mavyxdawn
- itch: zeillearnings
- Discord: Zeil#4950
-
Contact:
#2
Post
by mavyxdawn » Tue Jun 01, 2021 11:20 pm
If you have this in your Image gallery code:
Code: Select all
g.button("end1")
g.condition("persistent.end1")
g.image("end1.jpg")
Your script.rpy should use
Reference:
viewtopic.php?f=51&t=46976#p471546
-
ShadoStalk3r
- Newbie
- Posts: 7
- Joined: Mon Oct 29, 2018 6:17 am
-
Contact:
#3
Post
by ShadoStalk3r » Wed Jun 02, 2021 12:18 am
Unfortunately, there's no g.condition in my Gallery script. I added it inbetween g.button and g.unlock_image but it doesn't do anything.
-
mavyxdawn
- Regular
- Posts: 69
- Joined: Sun Dec 20, 2015 6:18 pm
- Github: mavyxdawn
- itch: zeillearnings
- Discord: Zeil#4950
-
Contact:
#4
Post
by mavyxdawn » Wed Jun 02, 2021 2:00 am
Oh. You'll need the g.condition to lock your image.
Then in your grid:
add g.make_button("end1","end1small.jpg", locked = "lock.png")
I'll upload a sample code later in my itch.io
Users browsing this forum: Google [Bot]