Mobile phone text-message system

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
ysa27
Newbie
Posts: 5
Joined: Thu Jan 10, 2019 9:28 pm
Deviantart: ysa27
Contact:

Re: Mobile phone text-message system

#31 Post by ysa27 »

XxrenxX wrote: Thu May 09, 2019 6:00 pm
ysa27 wrote: Tue Apr 09, 2019 8:49 am
It might be easier to just define an image for calls with the names on them and use the show function like you would with sprites since calls can use the regular dialogue box. I'm curious though so I'm playing around with code to see if possible but it's be more code than defining images I think.

Edit=========

finished code

I've also done some minor changes to the call labels for the texting feature which is simple enough of an edit but thought would include in case anyone else wants it.

Code: Select all

label message_start(who, what):
    if who.lower() == "me": #this allows the player to text first
        show screen phone_message3(what)
    if who.lower() == "unknown": #this allows an image text to appear first
        show screen phone_message_image(who, what, img)
    else:
        show screen phone_message(who, what)
    return
if who.lower() == "me":

I have set for only what so that there isn't the "me" text on the screen cause I've never used a cell that says my own name in the text so included that as a personal preference. And it works how intended.

I've also discovered you can jump between the cell and dialogue if you need to.

Code: Select all

call phone_start
call message_start("Human", "Text")
pause #ensures player has to click to continue
"Dialogue will appear without the phone or text disappearing."
call reply_message(" text")
call phone_end
Thank you so much! I'll test this out right away uwu

User avatar
YumaDazai
Regular
Posts: 34
Joined: Wed Jul 04, 2018 4:10 pm
Projects: PD9
Contact:

Re: Mobile phone text-message system

#32 Post by YumaDazai »

Hey, I know this thread is kind of old, but I seem to have a problem I can't fix. The phone is too big for the resolution used in the game I'm making and so I changed the size of the phone and the message tips. I also started messing with the numbers on the screens.rpy file. But no matter what I change, no change is showing after I save and reload the game. I changed all values by half a first after changing the size of the images, but the was no change what so ever. Any advice?
Programmer that will work paid and or for free! Message me on discord for more info at: Yuma#8158

Sushiii
Newbie
Posts: 2
Joined: Thu Jan 30, 2020 4:43 pm
Contact:

Re: Mobile phone text-message system

#33 Post by Sushiii »

YumaDazai wrote: Sun Dec 29, 2019 4:57 pm Hey, I know this thread is kind of old, but I seem to have a problem I can't fix. The phone is too big for the resolution used in the game I'm making and so I changed the size of the phone and the message tips. I also started messing with the numbers on the screens.rpy file. But no matter what I change, no change is showing after I save and reload the game. I changed all values by half a first after changing the size of the images, but the was no change what so ever. Any advice?
Hi! Attached is the part I modified in phone_options.rpy to shift all phone-elements to the right-side of the display. I have tested this on both my PC (1080p) as well as many windowed resolutions and also tested it on my smartphone. The parts I commented out are the original values!

Code: Select all

# Picking up the phone
transform phone_pickup:
    yalign 1.0 xalign 0.95 #xalign 0.5
    yoffset 900
    easein 0.3 yoffset 100

transform phone_hide:
    yalign 1.0 xalign 0.95 #xalign 0.5
    yoffset 100
    easein 0.3 yoffset 1300


transform phone_message_bubble_tip:
    #yalign 1.0 xalign 0.95
    xoffset 10
    yoffset 1

transform phone_message_bubble_tip2:
    xoffset 165
    yoffset 1

transform scrolling_out_message:
    easeout 0.1 yoffset -30 alpha 0

transform incoming_message:
    yoffset 100
    alpha 0
    parallel:
        easein 0.1 alpha 1
    parallel:
        easein 0.2 yoffset 0

    on hide:
        scrolling_out_message
The part that starts the phone slide-up animation:

Code: Select all

[spoiler]label phone_start:
    hide window
    $ renpy.pause(0.2)
    show phone at phone_pickup #Change 'phone' to whatever image you want! Feel free to add more images as well ;)
    $ renpy.pause(0.2)
    return[/spoiler]
The code below is also what I changed to have all elements properly displaying and animation with the phone shifted to the right-side:

Code: Select all

[spoiler]init 5:
    style phone_message_vbox:
        xalign 0.88
        yalign 0#0
        ypos 380
        xsize 360 #sets the width
        xoffset -40

    style phone_message_frame:
        background Solid("#d9398c")
        ypadding 10
        xpadding 10

    style phone_message_frame2:
        background Solid("#78E8A0")
        ypadding 10
        xpadding 10

    style phone_message_contents:
        spacing 10

    style phone_message is say_dialogue:
        xoffset 0
        outlines []
        xalign 1
        yalign 0

    style phone_message2 is say_dialogue:
        xoffset 0
        outlines []
        xalign 1
        yalign 0


    style phone_message_who is phone_message:
        color "#ecf0f1"
        size 25

    style phone_message_what is phone_message:
        color "#ffffff"
        size 24
    style phone_reply is default:
        size 18
        xalign 0.5
        xsize 475
        background Solid("#666")
        hover_background Solid("#78E8A0")
        ypadding 10
        xpadding 10


screen phone_message(who, what):
    vbox at incoming_message:
        style_group "phone_message"
        add "images/bubble-tip.png" at phone_message_bubble_tip

        frame:
            style_group "phone_message"

            vbox:
                style "phone_message_contents"
                text who style "phone_message_who"
                text what style "phone_message_what"

screen phone_message2(who, what):
    vbox at incoming_message:
        style_group "phone_message"
        xoffset 40#xoffset -584
        xalign 1.0
        # this one adds the triangular tip for the bubble, if you change colors you change this images too
        add "images/bubble-tip2.png" at phone_message_bubble_tip2

        frame:
            style_group "phone_message2"
            background Solid("#78E8A0")
            xsize 200

            vbox:
                style "phone_message_contents"
                text who style "phone_message_who"
                text what style "phone_message_what"

screen phone_message3(what):
    vbox at incoming_message:
        style_group "phone_message"
        xoffset 40#-584
        xalign 1.0
        # this one adds the triangular tip for the bubble, if you change colors you change this images too
        add "images/bubble-tip2.png" at phone_message_bubble_tip2

        frame:
            style_group "phone_message2"
            background Solid("#78E8A0")
            xsize 200

            vbox:
                style "phone_message_contents"
                ##text who style "phone_message_who"
                text what style "phone_message_what"

screen phone_reply(reply1, label1, reply2, label2):
    modal True
    vbox:
        xalign 0.92#0.5
        yalign 0.8#0.8
        spacing 5

        textbutton "[reply1]" action Jump(label1) style "phone_reply"
        textbutton "[reply2]" action Jump(label2) style "phone_reply"

# here is a new menu that has more options than two
# basically i just added one more textbutton here, and the additional labels needed in the call
# if you wish to make a menu with one or four just copy the code below and modify it a bit
screen phone_reply3(reply1, label1, reply2, label2, reply3, label3,):
    modal True
    vbox:
        xalign 0.92#0.5
        yalign 0.8#0.8
        spacing 5

        textbutton "[reply1]" action Jump(label1) style "phone_reply"
        textbutton "[reply2]" action Jump(label2) style "phone_reply"
        textbutton "[reply3]" action Jump(label3) style "phone_reply"


style phone_reply_text:
    xalign 0.5

screen phone_message_image(who, what, img):
    vbox at incoming_message:
        style_group "phone_message"
        # this one adds the triangular tip for the bubble, if you change colors you change this images too
        add "images/bubble-tip.png" at phone_message_bubble_tip

        frame:
            style_group "phone_message"

            vbox:
                style "phone_message_contents"
                text who style "phone_message_who"
                text what style "phone_message_what"
                add img
[/spoiler]
For reference, look up the terms size, xsize and ysize up at: https://www.renpy.org/doc/html/style_properties.html Goodluck!

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Mobile phone text-message system

#34 Post by Kinmoku »

Hey, I know this is an old thread, but I'm wondering if anyone figured out how to display more than one message box at once? I'd like to use it in my game but as a social network, not phone messages. I just can't figure out how to get it working more like NVL mode..

User avatar
quesadiaz
Newbie
Posts: 1
Joined: Sun May 03, 2020 4:40 pm
Projects: untitled vn
Contact:

Re: Mobile phone text-message system

#35 Post by quesadiaz »

Kinmoku wrote: Fri Apr 17, 2020 11:40 am Hey, I know this is an old thread, but I'm wondering if anyone figured out how to display more than one message box at once? I'd like to use it in my game but as a social network, not phone messages. I just can't figure out how to get it working more like NVL mode..
Made an account after lurking for forever just to reply to this lmao. Wanted to know if you've seen this scrolling chat on itchio. Seems like one would be able to incorporate it into the sms gui to get scrolling sms! I'm not confident enough to try it out myself so if someone else succeeds it'd be cool lol.

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Mobile phone text-message system

#36 Post by Kinmoku »

quesadiaz wrote: Sun May 03, 2020 4:46 pm Made an account after lurking for forever just to reply to this lmao. Wanted to know if you've seen this scrolling chat on itchio. Seems like one would be able to incorporate it into the sms gui to get scrolling sms! I'm not confident enough to try it out myself so if someone else succeeds it'd be cool lol.
Oh wow, I appreciate you making an account to tell me this haha :mrgreen: I hadn't seen this, but it looks like it will be super useful for me! I'll check it out and see if I can get it working...

ollieollie123
Newbie
Posts: 2
Joined: Wed Mar 20, 2019 6:25 pm
Contact:

Re: Mobile phone text-message system

#37 Post by ollieollie123 »

I know this thread is old, but does anyone know how to show messages past the first one? I have more than one message written in the script, but the in-game phone will only display the first message. I definitely feel like I'm doing something wrong lol

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Mobile phone text-message system

#38 Post by rayminator »

ollieollie123 wrote: Sat May 30, 2020 6:20 pm I know this thread is old, but does anyone know how to show messages past the first one? I have more than one message written in the script, but the in-game phone will only display the first message. I definitely feel like I'm doing something wrong lol
how are you calling your message?

just don't keep calling the same call phone_start

example:

Code: Select all

label start:
	a "Oh I got message from my dad."
	call dad
	a "Oh I got message from my sister too."
	call sister
	
label dad:
	call message_start("dad", "hey, this is a phone texting thingy")
	call reply_message("oh really? what does it do lol")
	return
	
label sister:
	call message_start("sister", "hey, this is a phone texting thingy")
	call reply_message("oh really? what does it do lol")
	return

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]