Page 1 of 1
yet another phone system + UI
Posted: Wed Aug 04, 2021 1:02 pm
by Nighten
Code: Select all
# How this scene is implemented:
nvl_narrator "Nighten added Eileen to the group"
n_nvl e2m2 "Hey! Welcome to the demo Eileen!"
e_nvl "who's this?"
n_nvl e2m1 "haha, silly you"
n_nvl e1m2 "We talked about showing off the phone the other day, remember?"
e_nvl "it's today? {image=emoji/fear.png}"
A simple messaging system, built on top of the NVL mode and easy to use
Instructions:
- Add the images and PhoneTexting.rpy to your project folder
- In this file, change the name of the main character to yours (MC_Name)
- Edit the nvl screen in screen.rpy as follow:
Code: Select all
screen nvl(dialogue, items=None):
#### ADD THIS TO MAKE THE PHONE WORK!! :) ###
if nvl_mode == "phone":
use PhoneDialogue(dialogue, items)
else:
####
## Indent the rest of the screen
window:
style "nvl_window"
# ...
- Change gui.nvl_list_length in gui.rpy to None, so that all the message are shown
- You'll then have to make a nvl character speak!
- To use the regular nvl screen again, change the nvl_mode variable to something else, like "classic"
- To include emojis and pictures, you can simply use an image tag; make sure they are the right size for the phone screen.
Browser demo on Itch.io
Mirror download on my website
Full source code on Github
Credits:
The background is made by
Uncle Mugen. All the other art assets and the code are done by me, Nighten, and free to use in your project if you want (the source files are available).
I'm really interested in your feedback, so if you see any improvement to make to this system, don't hesitate to point it out!
Have a nice day!

Re: yet another phone system + UI
Posted: Wed Aug 04, 2021 4:24 pm
by HypersDev
Damn, this looks really nice

Re: yet another phone system + UI
Posted: Wed Aug 18, 2021 1:15 pm
by heartfragment
This is great! I replaced my previous phone system with this because the code for it is so much quicker to input. Thank you for sharing!
Re: yet another phone system + UI
Posted: Tue Aug 24, 2021 4:36 pm
by BáiYù
Oh, this is fantastic! I was working on something like this but couldn't figure out the ATL for the messages to play right, so I'm glad someone else was able to do it.
Would you be able to me what license you're distributing this code under, and how to credit you properly? Thanks again!
Re: yet another phone system + UI
Posted: Tue Aug 24, 2021 10:56 pm
by Nighten
Thanks a lot for your comments! I'm so glad it can help other people!
The code is distributed under the MIT license; and as of credits, it's not required but you can simply refer to me as Nighten.
Have a great day!
Re: yet another phone system + UI
Posted: Wed Oct 27, 2021 12:53 pm
by Nighten
Someone contacted me by email to ask how to make a different icon appear depending on the character speaking; so here's a quick fix I propose:
On the line 103 of PhoneTexting.rpy, you can change:
Code: Select all
if d.who == MC_Name:
$ message_icon = "phone_send_icon.png"
else:
$ message_icon = "phone_received_icon.png"
To:
Code: Select all
if d.who == MC_Name:
$ message_icon = "phone_"+d.who+"_icon.png" //This now include the name of the character
else:
$ message_icon = "phone_received_icon.png"
This way, the image that will be shown will include the character's name : If Eileen speak, the icon used will be called "phone_Eileen_icon.png"
I hope it help! Questions by email or private messages are totally welcome btw

Re: yet another phone system + UI
Posted: Fri Dec 03, 2021 11:29 pm
by ghostclown
This is great. I was just thinking I should refactor my own phone system, and this will save me a lot of time.

Re: yet another phone system + UI
Posted: Wed Feb 16, 2022 2:52 pm
by chekkin
This is fantastic, thanks!
I was wondering if there's a way to move the position of the phone on the screen? I can't quite figure it out.
*EDIT: I was just a fool blundering around in the screens and gui scripts, when you'd made it easy! It's right at the top of PhonTexting.rpy, labelled phone_poisition_x and phone_position_y. Simple!
Re: yet another phone system + UI
Posted: Sat Mar 19, 2022 12:46 pm
by wwwormmie
Thank you so much for this! I wanted to know if there was a way to get menus to work on this?
Re: yet another phone system + UI
Posted: Sat Mar 19, 2022 4:12 pm
by Nighten
wwwormmie wrote: ↑Sat Mar 19, 2022 12:46 pm
Thank you so much for this! I wanted to know if there was a way to get menus to work on this?
Hum, it depend; if you mean the choice it should be possible with some work. I got some request about it already, but I really not have the energy nor the time to work on it right now. But if I manage to get it working I'll release my solution here for sure
If you mean more complex menu, like having a CGs gallery accessible via the phone, it would obviously be a lot of more work; the nvl screen behave sometime in an unexpecting way. I don't plan to work much on this, especially because it would be hard to make it generic enough to be useful for a lot of people.
I'm glad my code is useful!
Re: yet another phone system + UI
Posted: Tue Mar 22, 2022 7:55 am
by chekkin
Nighten wrote: ↑Sat Mar 19, 2022 4:12 pm
wwwormmie wrote: ↑Sat Mar 19, 2022 12:46 pm
Thank you so much for this! I wanted to know if there was a way to get menus to work on this?
Hum, it depend; if you mean the choice it should be possible with some work. I got some request about it already, but I really not have the energy nor the time to work on it right now. But if I manage to get it working I'll release my solution here for sure
If you mean more complex menu, like having a CGs gallery accessible via the phone, it would obviously be a lot of more work; the nvl screen behave sometime in an unexpecting way. I don't plan to work much on this, especially because it would be hard to make it generic enough to be useful for a lot of people.
I'm glad my code is useful!
Assuming wwwormmie is asking about choice menus, I actually implemented this based on the code for your other phone UI system, Nighten. I'm still a bit of a coding noob, but hopefully it works for everyone else too.
My project is in 1920x1080, so if yours is different you may have to change some numbers.
Go into PhoneTexting.rpy, and replace screen PhoneDialogue with the following:
Code: Select all
screen PhoneDialogue(dialogue, items=None):
style_prefix "phoneFrame"
frame at phone_transform(phone_position_x, phone_position_y):
if len(dialogue) == 1:
at phone_appear(phone_position_x, phone_position_y)
viewport:
draggable True
mousewheel True
yinitial 1.0
vbox:
null height 20
use nvl_phonetext(dialogue)
null height 100
# If there is a choice menu, move the messages up so the latest can still be seen
if len(items) > 0:
null height len(items) * 100
# Adding in choice menu
if len(items) > 0:
frame:
yalign 0.9
xalign 0.5
ysize len(items) * 115
xsize 480
background Solid("#000000")
foreground None
vbox:
yalign 0.9
for i in items: #For each choice, add its button
button:
action i.action
xalign 0.5
frame:
background Solid("#808b96")
foreground None
xysize (450,90)
text i.caption:
align (0.5,0.5)
text_align 0.5
size 26
Let me know if there are any issues with it. Hope that helps someone!
Edit to add: Don't forget that in order to see this, use menu(nvl=True)
Re: yet another phone system + UI
Posted: Mon May 16, 2022 7:41 pm
by edgebug
Hey, I'm having the WACKIEST issue where everything said in the phone system is showing up twice.
Can you also explain the "e1m2" tags you're using?

Sorry if this is a stupid question, hehe.
Re: yet another phone system + UI
Posted: Wed May 18, 2022 5:24 am
by Nighten
The problem was solved by adding "window show" in the script, in case anyone stumble upon the same issue.
The e1m2 tag is just a image tag, specific to the sprite I used for the demo. If your are curious, e1m2 mean "eyes 1, mouth 2". I don't setup my sprite like this anymore, as it's not really intuitive. But you don't have to worry about it, since it is just how I named the sprites.
Thanks again for anyone who is using this code!
Re: yet another phone system + UI
Posted: Thu Jul 07, 2022 6:25 pm
by slamy
You said you would deliver the revised code by last weekend.
Still, you don't have any answer.
You are unilaterally disconnecting without giving a reason.
I gave you the money first because you said you would have to pay to deliver the code.
However, requests for correction of errors found in the code are being ignored.
Please respect my project.
Your behavior is too violent and irresponsible.