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: 17
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: 440
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)

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

Re: Need to make a texting function

#4 Post by giorgi1111 »

You wanted to see old msgs too. You can do it with define too.for example massages to jasonfrom yuki default tojasonfromyuki = [] and you need define reverse and for others too.it is better to have some kind of db sender, receiver ,massage ,send time or what you need. Some games using json others maybe xml. Maybe you need something like this https://github.com/Elckarow/Better-EMR-Phone

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

Re: Need to make a texting function

#5 Post by giorgi1111 »

Search renpy phone on github

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

Re: Need to make a texting function

#6 Post by jeffster »

giorgi1111 wrote: Sun May 19, 2024 11:43 pm You wanted to see old msgs too. You can do it with define too.for example massages to jasonfrom yuki default tojasonfromyuki = [] and you need define reverse and for others too.it is better to have some kind of db sender, receiver ,massage ,send time or what you need. Some games using json others maybe xml. Maybe you need something like this https://github.com/Elckarow/Better-EMR-Phone
The example I wrote shows all the messages (old messages too).

For all senders and receivers, they all can be stored in one list

Code: Select all

default phone = []
and added, filtered or removed with standard Python methods for list items.

For example, if you want to extract a list of messages from Yuki to Jason only:

Code: Select all

python:
    toJason_fromYuki = [x for x in phone if FROM == Yuki and TO == Jason]
Adding more complexity of DB, sender, receiver... is really not necessary.

Better-EMR-Phone looks good.
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

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

Re: Need to make a texting function

#7 Post by giorgi1111 »

I see that phone codes and as it seems you need predefined speech to be shown as messages . When some conditions changed. For example when yuki met jason they added in contact list then relationship increased or something happened and yuki sent msg to jason play sound sms notify message received when you click yuki in contact list jump label yukijasonmsg: Yuki "hello" menu: helo: jason "hello" i dont want to answer: jump somewear. If choose hello continue sppech if relotionship >=5 more mesages if >= 10 more or if something changed . But you it need different style to be on phone scrern

Post Reply

Who is online

Users browsing this forum: No registered users