Page 1 of 1

Don't know how to remove imagebuttons.

Posted: Wed Apr 13, 2022 9:12 pm
by Paul Kinsella
I am a novice at renpy. I have the following code as shown below. But when one of the imagebuttons takes the player to "label chief:" all the imagebuttons from "label start:" stay. How do I tell imagebuttons to go away when I'm done with them. Better yet, is there a handy code that clears the screen of all images before a new page or "label" appears. As I'm a novice, who has spent days on this problem, an example of the solution code would be much appreciated. :D

# Big Game Example ##################################################
# Define and declare the color of each character. ##################
define c = Character("Chief",color="#CC0000")
define y = Character("You",color="#0066CC")
define d = Character("Doctor Deeth",color="#CC0000")
define s = Character("Officer Seen",color="#CC0000")
image office = "your_office_background.png"
# New place, room, or container. ####################################
label start:
scene your_office_background
show screen something
"Welcome!"
screen something:
# real buttons here on top...
imagebutton:
idle "your_conference_door_closed.png"
hover "your_conference_door_open.png"
xpos 75 ypos 77
action Jump('test')
imagebutton:
idle "your_chief_door_closed.png"
hover "your_chief_door_open.png"
xpos 325 ypos 75
action Jump('chief')
imagebutton:
idle "your_lounge_door_closed.png"
hover "your_lounge_door_open.png"
xpos 562 ypos 70
action Jump('test')
imagebutton:
idle "your_shooting_door_closed.png"
hover "your_shooting_door_open.png"
xpos 803 ypos 75
action Jump('test')
imagebutton:
idle "your_parking_door_closed.png"
hover "your_parking_door_open.png"
xpos 1040 ypos 73
action Jump('test')
imagebutton:
idle "your_phone.png"
hover "your_phone.png"
xpos 400 ypos 340
action Jump('test')
imagebutton:
idle "your_mug.png"
hover "your_mug.png"
xpos 535 ypos 353
action Jump('test')
imagebutton:
idle "your_todo.png"
hover "your_todo.png"
xpos 625 ypos 409
action Jump('test')
imagebutton:
idle "your_computer.png"
hover "your_computer.png"
xpos 715 ypos 280
action Jump('test')
imagebutton:
idle "your_trash.png"
hover "your_trash.png"
xpos 951 ypos 490
action Jump('test')
# drawers...
imagebutton:
idle "your_drawer_closed_left.png"
hover "your_drawer_open_left.png"
xpos 350 ypos 571
action Jump('test')
imagebutton:
idle "your_drawer_closed_left.png"
hover "your_drawer_open_left.png"
xpos 350 ypos 490
action Jump('test')
imagebutton:
idle "your_drawer_closed_right.png"
hover "your_drawer_open_right.png"
xpos 810 ypos 571
action Jump('test')
imagebutton:
idle "your_drawer_closed_right.png"
hover "your_drawer_open_right.png"
xpos 810 ypos 490
action Jump('test')
# New place, room, or container. ####################################
label test:
"Test text text text text text!"
# New place, room, or container. ####################################
label chief:
scene s1chiefsoffice
show s1chiefatdesk at truecenter
c "Welcome, Detective."
menu:
"It's good to be here. I welcome the opportunity to help the community.":
jump whatever
"It's good to be here. I am looking forard to to working my first case.":
jump whatever
# New place, room, or container. ####################################
label whatever:
y "Good to be here. I-"
c "Fine. Fine. Enough with the chit-chat. Let's get to work!"
c "Early this morning there was a stabbing in Stickville!"
c "We have the suspect in custody. He's covered with the victim's blood."
c "We also have two eye-witnesses and a solid motive."
c "what I need from you is..."
c "One: find the murder weapon."
c "And two: confirm that the cause of death was 'stabbing'."
c "Come back to my office as soon as you have compleaed both tasks."
y "Okay. Thank you."
jump yourdeskfirsttime
# Return ends the game. ###############################################
return

Re: Don't know how to remove imagebuttons.

Posted: Wed Apr 13, 2022 10:36 pm
by rayminator
I would put screen inside it's own rpy file and I would us call screen something instead of show

here is a example:

Code: Select all

screen something:
# real buttons here on top...
    imagebutton:
        idle "your_conference_door_closed.png"
        hover "your_conference_door_open.png"
        xpos 75 ypos 77
        action Jump('test'), Hide("something")
    imagebutton:
        idle "your_chief_door_closed.png"
        hover "your_chief_door_open.png"
        xpos 325 ypos 75
        action Jump('chief'), Hide("something")

Re: Don't know how to remove imagebuttons.

Posted: Sat Apr 16, 2022 5:11 pm
by Paul Kinsella
.

Thank you for getting back to me so quickly. I inserted your sample code (see the code below) but it did not seem to change anything. You wrote
I would put screen inside it's own rpy file and I would us call screen something instead of show
how do I put a screen in it's own renpy file? And how do I use call screen something?" Keep in mind that I'm a novice and an example of the code with changes made would be very much appreciated.

Code: Select all

screen something:
# real buttons here on top...
# testing ground 1 ##################################################

# Define and declare the color of each character. ##################
define c = Character("Chief",color="#CC0000")
define y = Character("You",color="#0066CC")
define d = Character("Doctor Deeth",color="#CC0000")
define s = Character("Officer Seen",color="#CC0000")

image office = "your_office_background.png"
# New place, room, or container. ####################################
label start:
    scene your_office_background
    show screen something
    "Welcome!"
screen something:
# real buttons here on top...
    imagebutton:
        idle "your_conference_door_closed.png"
        hover "your_conference_door_open.png"
        xpos 75 ypos 77
        action Jump('test'), Hide("something")
    imagebutton:
        idle "your_chief_door_closed.png"
        hover "your_chief_door_open.png"
        xpos 325 ypos 75
        action Jump('chief'), Hide("something")
    imagebutton:
        idle "your_lounge_door_closed.png"
        hover "your_lounge_door_open.png"
        xpos 562 ypos 70
        action Jump('test')
    imagebutton:
        idle "your_shooting_door_closed.png"
        hover "your_shooting_door_open.png"
        xpos 803 ypos 75
        action Jump('test')
    imagebutton:
        idle "your_parking_door_closed.png"
        hover "your_parking_door_open.png"
        xpos 1040 ypos 73
        action Jump('test')
    imagebutton:
        idle "your_phone.png"
        hover "your_phone.png"
        xpos 400 ypos 340
        action Jump('test')
    imagebutton:
        idle "your_mug.png"
        hover "your_mug.png"
        xpos 535 ypos 353
        action Jump('test')
    imagebutton:
        idle "your_todo.png"
        hover "your_todo.png"
        xpos 625 ypos 409
        action Jump('test')
    imagebutton:
        idle "your_computer.png"
        hover "your_computer.png"
        xpos 715 ypos 280
        action Jump('test')
    imagebutton:
        idle "your_trash.png"
        hover "your_trash.png"
        xpos 951 ypos 490
        action Jump('test')
        # drawers...
    imagebutton:
        idle "your_drawer_closed_left.png"
        hover "your_drawer_open_left.png"
        xpos 350 ypos 571
        action Jump('test')
    imagebutton:
        idle "your_drawer_closed_left.png"
        hover "your_drawer_open_left.png"
        xpos 350 ypos 490
        action Jump('test')
    imagebutton:
        idle "your_drawer_closed_right.png"
        hover "your_drawer_open_right.png"
        xpos 810 ypos 571
        action Jump('test')
    imagebutton:
        idle "your_drawer_closed_right.png"
        hover "your_drawer_open_right.png"
        xpos 810 ypos 490
        action Jump('test')
# New place, room, or container. ####################################
label test:
    "Test text text text text text!"
# New place, room, or container. ####################################
label chief:
    scene s1chiefsoffice
    show s1chiefatdesk at truecenter
    c "Welcome, Detective."
menu:
    "It's good to be here. I welcome the opportunity to help the community.":
        jump whatever
    "It's good to be here. I am looking forard to to working my first case.":
        jump whatever
# New place, room, or container. ####################################
label whatever:
    y "Good to be here. I-"
    c "Fine. Fine. Enough with the chit-chat. Let's get to work!"
    c "Early this morning there was a stabbing in Stickville!"
    c "We have the suspect in custody. He's covered with the victim's blood."
    c "We also have two eye-witnesses and a solid motive."
    c "what I need from you is..."
    c "One: find the murder weapon."
    c "And two: confirm that the cause of death was 'stabbing'."
    c "Come back to my office as soon as you have compleaed both tasks."
    y "Okay. Thank you."
    jump yourdeskfirsttime
# Return ends the game. ###############################################
    return

        
[/quote]

Re: Don't know how to remove imagebuttons.

Posted: Sat Apr 16, 2022 5:26 pm
by rayminator
do I really have tell you how to make a new file?

in atom click on file then select New File and make sure you put .rpy like something.rpy
same thing in most of other editors

Re: Don't know how to remove imagebuttons.

Posted: Sat Apr 16, 2022 10:30 pm
by Imperf3kt
To put the screen in its own file simply means create a new file called "anything you like.rpy"
Putting your screen in there will merely make it easier to edit and modify, but is entirely optional.

To call a screen, in your script you would use

Code: Select all

call screen myScreen
myScreen of course being the screen name.

Whether a call is what you need to use or not depends on what you are trying to achieve. Do you want players to click on a button before anything happens, or can they click on them at will and the story progresses like normal (allowing the player to ignore the buttons altogether if they should so wish)
From what I can see of your code, it looks like you want players to be able to open and close drawers, look at their phone, etc, so in this case you could use either show scree myScreen or call screen myScreen. The project you've chosen looks ambitious for a beginner.


To help you get a better idea of how to structure your game, I strongly suggest reading through the documentation and using it as a reference.
https://www.renpy.org/doc/html/screen_actions.html