A downloadable asset pack

Download NowName your own price

Demo Video:
Youtube: https://youtu.be/GAfO_lYWkzU

Description:
This is a still-in-progress simple messaging system that I made.

Implemented Features:
Messenger Version 1.0.0 [2020-10-20 - 12:02 AM]

  • One-to-One Text Messaging.
  • One-to-Many Text Messaging (Group Chats).
  • Typing Indicator.
  • Seen Feature for the Messenger's User.
  • Auto scrolling to bottom on each message entry.
  • Message Timestamps.

Planned Features:

  • Image/Displayable/Attachment Messaging.
  • Integrate with an overall Smartphone System that can contain other applications besides from this.
  • More...

Quickstart:

  • Download the file from my itch page (Consider supporting me if you like it :) Every help will go into the future development of the project as well as for my studies.)
  • Move/Copy the file to your Ren'Py game's folder, so it should look like as <Your Game Name>/game/messenger.rpy. Be noted that you can place it inside sub-folders, as long as those sub-folders are still inside the game directory.
  • Anywhere in your rpy files, we will declare the necessary instances of classes that are essential for the Messaging System, after all this extension is Object-Oriented so expect that every component is based on instanstation.
    ## Your characters for your game.
    define m = Character("Mike")
    define k = Character("Kaela")
    define j = Character("John")
    define v = Character("Vanessa")
    define s = Character("Shiela")
    ## Using the MessengerUser class, we create a new user that can be plugged in
    ## into our Messenger Application. We are using the characters that we defined
    ## earlier as the starting name of the users.
    default mc = MessengerUser(str(m))
    default kc = MessengerUser(str(k))
    default jc = MessengerUser(str(j))
    default vc = MessengerUser(str(v))
    default sc = MessengerUser(str(s))
    ## Using the MessengerConversation class, we create conversations that can be
    ## plugged into our Messenger Application. We are using the MessengerUser instances
    ## that we created earlier in specifying the participants for the conversations.
    ## If the name is set to None, then we will let the application to set the name base
    ## on the participants' names. By default, it is set to None, so you can directly ignore it.
    default c1 = MessengerConversation(    name=None,    participants=[        kc, jc, vc, sc # 4 participants    ],
    )
    default c2 = MessengerConversation(    participants=[        kc # 1 participant    ],
    )
    ## Finally, we create our main Messenger Application using the Messenger class.
    ## We will specify who owns the Messenger App, by using the owner parameter
    ## and specifying the name of the variable of the MessengerUser.
    ## Through the participants parameter, we can restrict who are the available
    ## available messenger users that can access the Messenger application.
    ## This means that even if we specified a user in the conversation above,
    ## but we didn't specify that user as part of all the possible participants in general for all conversations,
    ## then that user won't be able to message through the application still.
    ## The conversations parameter, tell what are the pre-existing conversations that are already
    ## included in the app.
    default messenger = Messenger(    owner=mc,    participants=[        kc, jc, vc, sc    ],    conversations=[        c1    ]
    )
    
  • Next is to create a screen that will use the messenger instance as the basis of operations.
    screen messenger(messenger):
        frame:        background "#20202033"        align (0.5, 0.5)        xysize (300, 450)
            vbox:            if not messenger.selected_conversation: # first we check if there's a conversation opened. if not then we will list all the conversations that can be opened. this serves as our home screen for the app.                for conversation in messenger.conversations:                    textbutton conversation.name: # conversation.name, is what you specified earlier when we are creating the instances of conversations.                        action messenger.SelectConversation(conversation) # messenger has an action SelectConversation, that can take a conversation instance, so we can select/open it.
                            background "#151515"                        xysize (300, 30)
                else:                # this serves as our conversation screen, where we will list all the text messages.                $ conversation = messenger.selected_conversation # since this is else, this means that there is an opened conversation, so we alias it for much easier reference.
                    textbutton "Back": # a simple back button that can deselect all conversations using the messenger app's DeselectAllConversations action                    action messenger.DeselectAllConversations()
                    viewport: # the viewport, we will give it an id so we can reference it in the auto-scroll function of the app.                    id "vp"                    scrollbars "vertical"                    mousewheel True
                        vbox:                        spacing 5
                            for message in conversation.messages: # conversation has a property called messages, where we can access all the messages added to the conversation, we will just loop in this list.                            python:                                if message.is_from_owner: # we will define some variables to for the positioning of the text messages depending on the sender, if it is from sender then it should be right aligned and has green background.                                    xalign = 1.0                                    background = "#0f0"
                                    else:                                    xalign = 0.0                                    background = "#151515"
                                frame:                                xfill True
                                    frame:                                    xmaximum 200 # we give the text box an xmaximum so we can see the positioning properly                                    xalign xalign # the xalign that we defined earlier                                    background background # the background we defined earlier
                                        vbox:                                        text message.sender.name # the message has a property sender, which returns the MessageUser who sent the message, a MessageUser instance has a property name, we specified the name earlier using MessengerUser(str(m))                                        text message.message # the message instance has a message property that returns the string message                                if conversation.typing_participants: # this is the typing indicator, we will first check if there are typing participants in the conversation.                    text conversation.typing_message # after checking, we will use the property of the conversation typing_message to get the typing users information.
        if messenger.selected_conversation: # this is the auto scroll function, we will first check if there's a selected_conversation or opened conversation. if there is then we can auto-scroll down the viewport.        add messenger.selected_conversation.AutoScrollDown(screen="messenger2", id="vp", duration=2.0) # we will use the selected_conversation's AutoScrollDown displayable using the add statement of renpy, then specifying the current screen of the viewport and it's id. Optionally, we can specify the duration of the scroll, by default it is set to 0.25 second.
    
  • Now the last process is to use the screen anywhere in your script, by showing it and passing our main messenger instance, then add any messages or timestamps that you want inside a label.
    label start:    show screen messenger(messenger) # we will show first the screen, and pass the messenger instance, in this way, we can create multiple messenger instances if needed or use different screens for different layout.        ## we will go full python below, so we will start our statements with $.    $ messenger.setTimestamp("October 2, 2020") # we will first set the timestamp  using the setTimestamp method of messenger before adding the message, so from this point messages will be marked with this timestamp, until the next set of timestamp.    $ c1.messageText(mc, "Happy Birthday to me!!!") # we can now add messages, using the messageText function of the conversation that we want to fill with messages, we will pass the MessageUser instance, then the text message for that user. in this case, we are using the mc MessageUser instance that we declared earlier.        $ messenger.setTimestamp("October 3, 2020") # new timestamp, meaning messages from this point will be under this timestamp.    $ c1.messageText(kc, "OMG! It's your birthday today? I mean yesterday?") # new text, from different participant of the conversation.
        $ c1.messageText(kc, "I totally forgot about it!")
        $ c1.messageText(kc, "Sorry I wasn't able to prepare a gift for you today :(")
        $ c1.messageText(mc, "No sweat! I'm used to it already. Really.")        $ c1.messageText(kc, "I--I'm sorry.")        $ c1.messageText(jc, "F**king A!")    $ c1.messageText(jc, "It's your birthday today?")    $ c1.messageText(jc, "Holy s**t!")    $ c1.messageText(jc, "I feel like I am a s**t friend now!")        ## by default, the auto typing indicator function is true by default, but we can disable it    ## by setting the typing_pause to None. setting it to a number will show the typing indicator until that amount    ## of pause it met. setting it to "auto" is the same as the default, meaning it is calculated automatically,    ## depending on the length of the characters in the message.    ## the typing_hard is a boolean (true/false), if set to True then the game is pause until the typing_pause is met.    ## basically, imagine the typing_pause and typing_hard as what you would normally do using the renpy.pause()    $ c1.messageText(jc, "Where are you now bro? I'm coming for you. I'll try to grab the quickest possible gift that I can give.", typing_pause=3.0, typing_hard=True)
        $ c1.messageText(mc, "Don't bother, it's already midnight guys.")    $ c1.messageText(mc, "I don't want to waste your time for this nonsense event.")    $ c1.messageText(mc, "Don't worry I'll manage.")    $ c1.messageText(mc, "Besides, this is not the first time that I've dealt with this kind of situation, so no worries :)")
        m "F**kers. So much for so-called friends. F**k you guys!" # this just shows the flexibility of the app, we can combine messaging as well as normal dialogue    window hide
        $ c1.messageText(kc, "...", pause=0) # setting the pause or hard parameter means that the game will automatically proceed onto the statement below this after the seconds stated in the pause parameter, in this case, it's zero, so it will immediately show the jc text message after kc message.    $ c1.messageText(jc, "...")
        pause
    

Additional Information:

This post is also posted much more nicely in Lemmasoft Forums.

Tips and Tricks:
To be filled out later. Sorry for the inconvenience. It's already past midnight in here :(

About
This is made by the Nonlogical Coder, under no license. My only illegit condition is to credit me, by including the Nonlogical Coder as part of your credits :)
Consider supporting the Nonlogical Coder if you are pleased with the project :).

Download

Download NowName your own price

Click download now to get access to the following files:

messenger.rpy 23 kB

Leave a comment

Log in with itch.io to leave a comment.