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.
cedes
Regular
Posts: 44 Joined: Fri Aug 04, 2017 3:33 pm
itch: cedes
Contact:
#1
Post
by cedes » Fri Dec 11, 2020 11:39 pm
I'm trying to use a random picked image of a scratch to appear, but I can't get the image to show up correctly?
Code: Select all
label scratch_pic:
$ scratch= "should be image"
$ scratch6 = 'images/scratch6.png'
$ scratch5 = 'images/scratch5.png'
$ scratch4 = 'images/scratch4.png'
$ scratch3 = 'images/scratch3.png'
$ scratch2 = 'images/scratch2.png'
$ scratch1 = 'images/scratch1.png'
$r = renpy.random.randint(1,6)
"[scratch] [r]"
if r == 1:
$scratch = scratch1
if r == 2:
$scratch = scratch2
if r == 3:
$scratch = scratch3
if r == 4:
$scratch = scratch4
if r == 5:
$scratch = scratch5
if r == 6:
$scratch = scratch6
return
This is the code I'm using to try to randomly pick an image, and using this:
to try to show it at a userdefined location, but it just shows up as a shadow.
The image is in the right location, if i write show scratch4 then it shows up fine but I can't get it down in this way!
Last edited by
cedes on Sun Dec 13, 2020 6:13 pm, edited 1 time in total.
hell_oh_world
Miko-Class Veteran
Posts: 777 Joined: Fri Jul 12, 2019 5:21 am
Contact:
#2
Post
by hell_oh_world » Fri Dec 11, 2020 11:46 pm
should be...
also might be the shortest and easiest way...
Code: Select all
show expression "images/scratch{}.png".format(renpy.random.randint(1, 6)) at ec1
cedes
Regular
Posts: 44 Joined: Fri Aug 04, 2017 3:33 pm
itch: cedes
Contact:
#3
Post
by cedes » Sun Dec 13, 2020 6:13 pm
oh perfect thanks! Works perfect now, thanks for the shortcut as well!
cedes
Regular
Posts: 44 Joined: Fri Aug 04, 2017 3:33 pm
itch: cedes
Contact:
#4
Post
by cedes » Wed Dec 16, 2020 8:30 am
Question, how do I get to hide the image?
I tried to hide image and it's showing up as invalid!
hell_oh_world
Miko-Class Veteran
Posts: 777 Joined: Fri Jul 12, 2019 5:21 am
Contact:
#5
Post
by hell_oh_world » Wed Dec 16, 2020 9:15 am
You tag them then hide them using that tag.
Code: Select all
show expression "something.png" as something
hide something
Users browsing this forum: Ahrefs [Bot] , Ocelot