[solved] Is there another way I can delete the messages?

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
User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

[solved] Is there another way I can delete the messages?

#1 Post by Nanahs »

I'm using the first messenger on my game:
viewtopic.php?f=51&t=50153

When the conversation ends, I give the player the choice to play the chat again or jump to the next scene. Something like this:

Code: Select all

    menu afterchatchoose:

        "PLAY THE CHAT AGAIN":
            jump chatscene1
        
        "GO TO THE NEXT CHAPTER":
            jump parkatnight3
The problem is that when they jump to the chat label again (label chatscene1), the previous messages don't disappear. So you can play again, but the prevous messages will keep inside the chat.

I tried adding this to the label (hide screen):

Code: Select all

label chatscene1:
    scene bluechat
    hide screen telegram
    show screen telegram
But that doesn't delete the messages either.

The "X" deletes/resets the chat messages:

Image

It's defined like this on screen telegram:

Code: Select all

        button background style_button_inst hover_background style_button_hovr xalign 0.99 yalign 0.03 action Function(del_all_msg) xysize (60,60):
            text "  x  " style "txt_base" size 40 pos (36, -2) 
        # Ползунок прокрутки
But people will not remember to click the X to reset it. They will click "PLAY CHAT AGAIN" and it will look all messed up.

So I was wondering, is there another way I could make this "action Function(del_all_msg)" work?

I know that something like this is not possible:

Code: Select all

        "PLAY THE CHAT AGAIN":
            action Function(del_all_msg)
            jump chatscene1
But I wanted to know if there's a similar way I can do it. To "del_all_msg" without clicking the X.
Make it be "automatic" when the person clicks "PLAY THE CHAT AGAIN".

Thanks :)
Last edited by Nanahs on Wed Oct 24, 2018 12:13 pm, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Is there another way I can delete the messages?

#2 Post by xavimat »

Note that dell_al_msg is a python function. You can call it inside a screen with Function() but you also can call it inside a label with the simple $.
$ is used to start a python line inside a label, so, this should work:

Code: Select all

        "PLAY THE CHAT AGAIN":
            $ del_all_msg()
            jump chatscene1
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: Is there another way I can delete the messages?

#3 Post by Nanahs »

xavimat wrote: Wed Oct 24, 2018 11:49 am Note that dell_al_msg is a python function. You can call it inside a screen with Function() but you also can call it inside a label with the simple $.
$ is used to start a python line inside a label, so, this should work:

Code: Select all

        "PLAY THE CHAT AGAIN":
            $ del_all_msg()
            jump chatscene1
Thank you much! It worked :)

Post Reply

Who is online

Users browsing this forum: Nozori_Games