[HELP] Screen menu issues

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.
Post Reply
Message
Author
Bryce_HO
Newbie
Posts: 5
Joined: Sat Apr 06, 2024 3:20 am
Contact:

[HELP] Screen menu issues

#1 Post by Bryce_HO »

Greetings!
Have a problem here.
So I wanted to make point 'n' click feature, and subsequent confirm choice. But surfaced that, for some reason, after confirm to interact with pufflet, code wont contunie. It just stops on choice button aftertext. It only work after Shift+R. What might be a reason of it?
I'm not a programmer, only artist, and do code only on guides in internet, so if I do something wrong - I will be really- really thankful for an advice. :shock:

Code: Select all

label start_room_choice:
    play music ("audio/ambient/room_ambient.mp3")
    if curtain:
        scene room_2
    else:
        scene room_1
    if not cloth , curtain , pufflet:
        show screen item_search
    else:
        jump exit_start_room
    pause

return

label exit_start_room:
    scene room_1
    show pufflet
    pause
    show window
    
screen item_search:
    modal True
    tag menu

    imagemap:

     if not curtain:
         idle "images/action_obj/obj_room_normal.png"
         hover "images/action_obj/obj_room_hover.png"
         hotspot (397, 0, 249, 460) action Jump ("curtains_interact")
         if not cloth:
             idle "images/action_obj/obj_room_normal.png"
             hover "images/action_obj/obj_room_hover.png"
             hotspot (110, 464, 222, 255) action Jump ("cloth_interact")
         else:
             idle "images/action_obj/without_cloth_n.png"
             hover "images/action_obj/without_cloth_h.png"
     else:
             idle "images/action_obj/without_curtains_n.png"
             hover "images/action_obj/without_curtains_h.png"
             if not cloth:
                 idle "images/action_obj/without_curtains_n.png"
                 hover "images/action_obj/without_curtains_h.png"
                 hotspot (110, 464, 222, 255) action Jump ("cloth_interact")
             else:
                 idle "images/action_obj/bs_n.png"
                 hover "images/action_obj/bs_h.png"

    imagemap:

        if not pufflet:
            idle "images/action_obj/puff_nor.png"
            hover "images/action_obj/puff_hov.png"
            hotspot (412, 412, 151, 174) action [Hide("displayText"), Jump("puffleto")]:
                hovered Show("displayText")
                unhovered Hide("displayText")
        else:
            idle "images/action_obj/pufflet.png"
screen displayText:
    style_prefix "say_dialogue"

    window:
       id "window"
       text ("Какой мягкий.. Хм. Думаю, если его передвинуть.. он сможет помочь мне добраться до мест, до которых я не могу достать.")
       
label puffleto:
    menu pufflet:
        "Передвинуть пуфик?"
        "Не стоит":
            $ menu_flag = False
            jump start_room_choice


        "Да":
            $ menu_flag = True
            "Малышка начала толкать пуфик."





label pufflet_interact:
    hide screen item_search
    $ pufflet = True
    play sound("audio/sounds/push.mp3")
    with fade
    pause 0.2
    a "мебель оказалась легче, чем выглядит. Малышке без труда удалось пододвинуть пуф к шкафу вплотную."
    $ renpy.notify("Теперь ей видно что там находится.")

    if not cloth , curtain , pufflet:
        jump start_room_choice
    jump exit_start_room
return


jeffster
Veteran
Posts: 409
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: [HELP] Screen menu issues

#2 Post by jeffster »

Bryce_HO wrote: Sat Apr 06, 2024 3:32 am Greetings!
Have a problem here.
So I wanted to make point 'n' click feature, and subsequent confirm choice. But surfaced that, for some reason, after confirm to interact with pufflet, code wont contunie. It just stops on choice button aftertext. It only work after Shift+R. What might be a reason of it?
Hi BroHo,
I just started to look at the code and found some wrong construction:
if not cloth , curtain , pufflet:
I wonder if it gives you error messages.

Are you trying to check if any of cloth, curtain, pufflet are truthy?
Then instead of this

Code: Select all

    if not cloth , curtain , pufflet:
        show screen item_search
    else:
        jump exit_start_room
    pause
use this:

Code: Select all

    if cloth or curtain or pufflet:
        jump exit_start_room
    else:
        show screen item_search
        pause
This will jump if any of the variables (cloth, curtain and pufflet) are not falsy.

Or, if you mean that they all should be not falsy

Code: Select all

    if cloth and curtain and pufflet:
        jump exit_start_room
    else:
        show screen item_search
        pause
This will jump if they all are truthy.

Comma "," is not used in conditional statements like that. Use "and" or "or" to join conditions.

Please respond if the problem if not solved.

(And when it's solved, you can edit the original post and add [SOLVED] to the title).

Good luck with learning to program Ren'Py and Python!
They really are simple.

Bryce_HO
Newbie
Posts: 5
Joined: Sat Apr 06, 2024 3:20 am
Contact:

Re: [HELP] Screen menu issues

#3 Post by Bryce_HO »

jeffster wrote: Sat Apr 06, 2024 3:05 pm
Bryce_HO wrote: Sat Apr 06, 2024 3:32 am Greetings!
Have a problem here.
So I wanted to make point 'n' click feature, and subsequent confirm choice. But surfaced that, for some reason, after confirm to interact with pufflet, code wont contunie. It just stops on choice button aftertext. It only work after Shift+R. What might be a reason of it?
Hi BroHo,
I just started to look at the code and found some wrong construction:
I tryed, but problem still here. :<

jeffster
Veteran
Posts: 409
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: [HELP] Screen menu issues

#4 Post by jeffster »

Bryce_HO wrote: Sun Apr 07, 2024 5:26 am I tryed, but problem still here. :<
Other problems in the posted code are:

(1) Wrong indentations. Each level of indentation should be 4 spaces.

(2) Multiple "idle" and "hover" in the same imagemap.

"idle" and "hover" are images (like backgrounds) for their imagemap, so there should be only one "idle" and one "hover".
https://renpy.org/doc/html/screens.html#imagemap

Here for example

Code: Select all

        if not curtain:
            idle "images/action_obj/obj_room_normal.png"
            hover "images/action_obj/obj_room_hover.png"
            hotspot (397, 0, 249, 460) action Jump ("curtains_interact")
            if not cloth:
                idle "images/action_obj/obj_room_normal.png"
                hover "images/action_obj/obj_room_hover.png"
                hotspot (110, 464, 222, 255) action Jump ("cloth_interact")
            else:
                idle "images/action_obj/without_cloth_n.png"
                hover "images/action_obj/without_cloth_h.png"
first you set

Code: Select all

            idle "images/action_obj/obj_room_normal.png"
            hover "images/action_obj/obj_room_hover.png"
and then you replace them with

Code: Select all

                # THIS
                idle "images/action_obj/obj_room_normal.png"
                hover "images/action_obj/obj_room_hover.png"

                # OR THIS
                idle "images/action_obj/without_cloth_n.png"
                hover "images/action_obj/without_cloth_h.png"
(3) And if curtain and cloth then there's this

Code: Select all

                idle "images/action_obj/bs_n.png"
                hover "images/action_obj/bs_h.png"
but no hotspots at all, which makes no sense. If there are no hotspots, then it's just a background image, not imagemap.

(4) Script blocks after labels have questionable endings. See
https://renpy.org/doc/html/label.html
They either have "return" which would probably finish the program early, or they have no "return" or "jump" at all, so the control will just move to next script line.

For example, after label exit_start_room: the script would probably go to label puffleto:.
Could that cause the problem?

If problems aren't solved, please correct the errors and post the new version of the script (with explanation what goes wrong at which moment exactly).

Bryce_HO
Newbie
Posts: 5
Joined: Sat Apr 06, 2024 3:20 am
Contact:

Re: [HELP] Screen menu issues

#5 Post by Bryce_HO »

jeffster wrote: Sun Apr 07, 2024 8:26 am
Bryce_HO wrote: Sun Apr 07, 2024 5:26 am I tryed, but problem still here. :<
but no hotspots at all, which makes no sense. If there are no hotspots, then it's just a background image, not imagemap.
I wanted to make objects look different and become not interactive after first interact, so..

Bryce_HO
Newbie
Posts: 5
Joined: Sat Apr 06, 2024 3:20 am
Contact:

Re: [HELP] Screen menu issues

#6 Post by Bryce_HO »

jeffster wrote: Sun Apr 07, 2024 8:26 am
Bryce_HO wrote: Sun Apr 07, 2024 5:26 am I tryed, but problem still here. :<
Other problems in the posted code are
I'm really sorry, that I not told You how exactly it looks like.
All this codes isn't in one file
Main labels is in script.rpy
Image
Imagemaps\Screen item_search -- Is imagemap.rpy (yeah, I wanted try to create 3 different imagemaps in one screen. Just curious.)
Image
And all obj interact with lable puffleto -- is in obj_interact.rpy.
Image

This is how exactly it looks like

Bryce_HO
Newbie
Posts: 5
Joined: Sat Apr 06, 2024 3:20 am
Contact:

Re: [HELP] Screen menu issues

#7 Post by Bryce_HO »

I found out that if imagemaps replace with common menu variant of answer, all works fine.
And without pufflet interact too. So problem really hides in pufflet interact label for some reason. So I wonder, what exactly goes wrong with puff menu.

Post Reply

Who is online

Users browsing this forum: Google [Bot]