Need to make a texting function

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
kedta35
Regular
Posts: 46
Joined: Wed Aug 30, 2023 1:31 pm
Contact:

Need to make a texting function

#1 Post by kedta35 »

I'm trying to get a texting function into my game that ticks off all of these:
  • Main texter/texter POV can be changed (character POVs can be changed and other characters' phone's should open their own texts with whatever contacts they have).
  • Images can be sent that can be opened to get a better view.
  • Multiple choice texts can be sent whilst on specific contacts in phone screen, like in the form of little square buttons to the side of the phone whenever a contact's messages are displayed.
  • The phone, whilst messaging with any character, can be hidden to show regular dialogue and scene/show images momentarily then be brought back up right after. But also scenarios where the phone can stay up whilst regular Ren'Py dialogue is being shown as a representation of the characters thoughts whilst messaging.
  • Past messages with all characters must be saved and can be seen anytime a text event pops up or if you open on the text app on the phone and look at messages with different contacts.
  • It should be simple/straightforward enough to change/replace the images & dimensions If I ever feel like I want to change them.

I would be grateful if anyone let's me know in the replies but I know that this could be a real task to get it exactly how I want it and I also would prefer to have this functions implemented sooner rather than later. So if anyone can 100% make this down to every detail then hit me up in my messages and we can work out a deal.

giorgi1111
Newbie
Posts: 14
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Need to make a texting function

#2 Post by giorgi1111 »

You need to define everything and use some db. I made online app so using mysql. Not yet in store.it has chat mail login register review snd other things.i am sending and receiving everything. You must do same localy maybe json i dont know exactly

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

Re: Need to make a texting function

#3 Post by jeffster »

giorgi1111 wrote: Sun May 19, 2024 12:05 pm You need to define everything and use some db. I made online app so using mysql. Not yet in store.it has chat mail login register review snd other things.i am sending and receiving everything. You must do same localy maybe json i dont know exactly
I think TS speaks about showing in-game conversations, not actual messaging between different computers. Then you don't really need DBs like MySQL. A simple list will do. Suppose you want to add a message and a picture from Jason to Yuki:

Code: Select all

label example:
    # Add a message and a picture from Jason to Yuki
    python:
        phone.append({FROM: Jason, TO: Yuki, TEXT: "Hey check that!"})
        phone.append({FROM: Jason, TO: Yuki, PIC: "phone/kitty.jpg"})
        renpy.notify("New message")
    play sound "sms.ogg"
Here phone is a list that contains all messages and pictures, and for a character it could be filtered like that:

Code: Select all

screen phone_of(person=Yuki):
    viewport:
        # ...the viewport's parameters and whatnot...
        for p in phone:
            if p[FROM] == person or p[TO] == person:
                if PIC in p:
                    # Show picture
                    #...
                elif TEXT in p:
                    # Show text
                    #...
                elif CHOICE in p:
                    # Show choice
                    #...
where constants could be for example:

Code: Select all

init python:
    FROM = 0
    TO = 1
    TEXT = 2
    PIC = 3
    CHOICE = 4
Likewise, Jason, Yuki etc. could be any unique identifiers like characters' objects or just strings:

Code: Select all

define Jason = 'Jason'
define Yuki = 'Yuki'
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

Post Reply

Who is online

Users browsing this forum: No registered users