Monika-After-Story / MonikaModDev

DDLC fan mod to extend Monika
http://www.monikaafterstory.com/
Other
1.18k stars 685 forks source link

Interactive button problem #7746

Closed Lu1508 closed 3 years ago

Lu1508 commented 3 years ago

Hi! Remember when I posted the issue #7701 about improve the interaction with Monika using buttons? Well, I could fix most of the problems (like the button not showing up)

However, there still one problem I cannot find a solution: When the button is pressed, run the label monika_boop

Can someone tell me how to fix it, please?

init 5 python:
    addEvent(Event(persistent.event_database,eventlabel="monika_boop",category=["misc", "monika"],prompt="Boop Monika",pool=True,unlocked=True))

label monika_boop:
    if mas_isMoniBroken():
        m 6fsc "..."
    elif mas_isMoniDis():
        m 2etd "Did you just..."
        m 2esc "Hmm..."
    elif mas_isMoniUpset():
        m 1wublo "Did you just... boop me?"
        m 1esa "Hehe..."
    elif mas_isMoniNormal():
        m 1wublo "Did you just... boop me?"
        m 1hsb "Ehehe~"
    elif mas_isMoniHappy():
        m 1wubso "Di-did you just... boop me?"
        m 1hub "Ehehehe~"
        m 1esble "You caught me by surprise there."
    elif mas_isMoniAff():
        m 1wubfo "Di-did you just... boop me?"
        m 1hub "Ehehehe~"
        m 5eublb "Did I look cute while I was all surprised?"
    elif mas_isMoniEnamored(higher=True):
        m 1wubfo "Di-did you just... boop me?"
        m 1hub "Ehehehe~"
        m 5esbsb "Did I look really cute while I was all flustered?"
        m 5tfbla "Oh, how I wish I could boop you back right now~"
    return

screen nosedot():
    zorder 200
    if not store._menu:
        imagebutton:
            idle ("mod_assets/buttons/face/dot.png")
            xpos 624
            ypos 244
            action Return(monika_boop)

init python:

    def mas_botHideOverlay():
        renpy.hide_screen("nosedot", layer="master")

    def mas_botIsVisible_ovl():
        return renpy.get_screen("nosedot") is not None

    def mas_botShowOverlay():
        if not mas_current_background.hide_calendar and not mas_botIsVisible_ovl():
            renpy.show_screen("nosedot", _layer="master")

Also it comes with an error that says:

File "game/script-ch30.rpy", line 1495, in script call
    call call_next_event from _call_call_next_event_1
  File "game/event-handler.rpy", line 2531, in script call
    call expression event_label from _call_expression
  File "game/script-story-events.rpy", line 1185, in script call
    call mas_crashed_short from _call_mas_crashed_short
  File "game/script-story-events.rpy", line 1460, in script call
    call expression v_quip from _call_expression_10
  File "game/script-story-events.rpy", line 1471, in script
    m 2ekc "Another crash, [player]?"
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\ast.py", line 613, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\exports.py", line 1147, in say
    who(what, interact=interact)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\character.py", line 877, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\character.py", line 716, in do_display
    **display_args)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\character.py", line 508, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\core.py", line 2526, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\core.py", line 2793, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\screen.py", line 399, in visit_all
    callback(self)
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\core.py", line 2793, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\screen.py", line 409, in per_interact
    self.update()
  File "C:\Users\oxflo\Pictures\Monika.chr\conf\together\Doki Doki Literature Club\renpy\display\screen.py", line 578, in update
    self.screen.function(**self.scope)
  File "game/zz_interactivebuttons.rpy", line 34, in execute
    screen nosedot():
  File "game/zz_interactivebuttons.rpy", line 34, in execute
    screen nosedot():
  File "game/zz_interactivebuttons.rpy", line 36, in execute
    if not store._menu:
  File "game/zz_interactivebuttons.rpy", line 37, in execute
    imagebutton:
  File "game/zz_interactivebuttons.rpy", line 37, in keywords
    imagebutton:
  File "<screen language>", line 41, in <module>
NameError: name 'monika_boop' is not defined
Booplicate commented 3 years ago

It tells you what is wrong

NameError: name 'monika_boop' is not defined

In your code you have this

action Return(monika_boop)

You don't define monika_boop anywhere, you probably mean to use a string instead. E.g. action Return("monika_boop")

Also just an FYI, but we have a framework for active interactions. It can actually detect clicks on different parts of the body.

Also also, I'll add that using names like mas_botHideOverlay,mas_botIsVisible_ovl, mas_botShowOverlay is a bad idea. This is the format we use for official code, especially the mas_ prefix.

Lu1508 commented 3 years ago

You are right, now it worked, when it said "is not defined" I thought it meant something else, thank you

Wait...Do we have that? I didn't know, I tried to click on her in a lot of parts of her body and nothing happens

In the case of the names, I see your point, but it was the only way I found for the button to show up

ThePotatoGuy commented 3 years ago

we have a framework for polygon based click detection. the submod should use it if it wants to.

username11421 commented 3 years ago

Let me know if you end up getting the interactions framework to work. I'd like to see how the code looks if you do.