A downloadable phone code

Download NowName your own price
  • free to use, crediting me is appreciated but not required
  • based on the code found in cute demon crashers
  • supports menus and images
  • designed for 1920 x 1080, but if you play with the numbers enough you can make it work for any size
  • uh windows only i guess? i just zipped the whole renpy project idk if it works on other OS's lol
  • done with and for renpy version 6.99.14.3135 
  • example of how you can write the code in your dialogue
call message_img("nadia", "it works with images too!","images/pic1.png")
call message_img("nadia", "receive cute pics from your friend","images/pic2.png")
call message("nadia", "the text box changes depending on how much content there is. dont put too big images or its gonna look weeeeiiiird")
call message("nadia", "you can also do menus here")

i hope you enjoy!

StatusReleased
CategoryAssets
Rating
(25)
Authornadia nova
Made withRen'Py
Tagsasset, renpy, sourcecode

Download

Download NowName your own price

Click download now to get access to the following files:

phone template new.zip 1 MB

Development log

Comments

Log in with itch.io to leave a comment.

(1 edit) (+1)

For those using 1280 x 720, revised code:


Screens code:


init 5:
    style phone_message_vbox:
        xalign 0.5
        yalign 0
        ypos 150
        xsize 260
        
        
    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 21

    style phone_message_what is phone_message:
        color "#ffffff"
        size 20
    style phone_reply is default:
        size 18
        xalign 0.5
        xsize 275
        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 -384        
        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 -384        
        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.529
        yalign 0.65
        spacing 2
        
        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.5
        yalign 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
                

############# phone code ends ############


In Options:

Change this part only (right at top of code):


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




ALSO:

* Resize the images provided, including the phone image - the ones provided are too big.

Wow, thanks alot! Could you by any chance give me the new sizes you gave to the images? (The phone template and the bubbles)
Thanks!

(+1)

Yeah of course, the phone is 400x720, the in-message images are 150x150 but could probably go a little bigger if wanted. The text bubbles will resize themselves of course.

You’ll want to change this part in ‘Options’ if using my exact sizes:

 

# Picking up the phone

transform phone_pickup:

    yalign 1.0 xalign 0.5

    yoffset 900

    xoffset 32

    easein 0.3 yoffset 0

 


Link to resized phone: https://filebin.net/ak2vthastxrlw9wt

Thanks!

I was trying to use this for my game and it keeps giving me an error when I try to launch the project. I've checked to make sure I have the right code for scripts and I used the code provided in the file as reference while I worked on it. I'm not sure what the problem is.

The error i got :


I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 37, in script call
    call phone_start
  File "game/script.rpy", line 37, in script call
    call phone_start
ScriptError: could not find label 'phone_start'.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 37, in script call
    call phone_start
  File "C:\Users\Jareth\Desktop\program stuff\renpy\renpy-7.3.5-sdk\renpy\ast.py", line 1436, in execute
    rv = renpy.game.context().call(label, return_site=self.next.name)
  File "game/script.rpy", line 37, in script call
    call phone_start
  File "C:\Users\Jareth\Desktop\program stuff\renpy\renpy-7.3.5-sdk\renpy\script.py", line 898, in lookup
    raise ScriptError("could not find label '%s'." % str(original))
ScriptError: could not find label 'phone_start'.

Windows-8-6.2.9200
Ren'Py 7.3.5.606

You need to move the code to your own game script/screen/options scripts accordingly. Copy and paste the phone code from each of hers to yours.

would it be okay to use this for a commercial project with credits? thank you so much for making this nonetheless!

yea thats cool tho i think with the license stuff it would mean you would have to replace the art assets tho? i think

oh that sounds fair, tysm!!

Thank you, now I can continue to finish my project (for personal use only)

I've wanted to implent something like this in one of my VNs for so long! Thank you so much for posting this, that makes it so much easier!

yay

(1 edit)

I was playing around with the code and i wanted to send as the MC a picture. Is there a way to "reply" with an image being the MC?

The best i could do is put the call in the script.rpy as:

call message("nadia", "Why you don't send me a picture?")

call reply_message_img("me", "what do you think?","graphics/pic1.png")

and put the label in the options.rpy as follows:

label reply_message_img(who, what,img):
    $ renpy.pause()
    hide screen phone_message
    hide screen phone_message2
    hide screen phone_message3
    hide screen phone_message_image
    $ renpy.pause(0.1)
    show screen phone_message_image(who, what,img)
    return

But playing the game the message of the MC still looks as a message of nadia, I know i have to do something in the screen panel but i'm out of ideas.

Thanks for sharing the code, btw :) 


This is beyond cool!

Thanks for sharing :)

Just played around with it for a few hours. Thanks so much for sharing. I wish I would have looked for this when I was doing nanoreno 2018 lol

Useful code. Great comments. Very helpful! Thanks :)

Loved! Thanks! I was looking for this!

Cute design. I like it. I tried to run your original file and find out that it fit my small screen. But when I copy your marked phone code to my project, it has bigger phone size. How to fix this? I'm still new at Ren'py.

if youre changing the  size you have to edit the image file for the phone to either make it  bigger or smaller to suit what you need. and change the numbers in the code to match the new size

I don't understand with the screen properties so I changed my whole project resolution to 1920*1080 lol and it's works fine with yours. Thank you. Your project really helpful for my school project.

Nadia, thanks for this and if you don't mind, can you tell me what I must change, I just need the name and then I'll solve it by my self.

Aaaahhh, thanks so much for posting this!!

i don't really understand how to do it. can u explain?

can you be more specific? 

hi!! i downloaded this and i'm really looking forward to using it, but it gives me an error when i try to run it :(

[code]
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 276, in script
    init python:
  File "game/screens.rpy", line 277, in <module>
    config.character_id_prefixes.append('namebox')
Exception: config.character_id_prefixes is not a known configuration variable.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/screens.rpy", line 276, in script
    init python:
  File "G:\software\game development\renpy-6.99.11-sdk\renpy\ast.py", line 805, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "G:\software\game development\renpy-6.99.11-sdk\renpy\python.py", line 1641, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/screens.rpy", line 277, in <module>
    config.character_id_prefixes.append('namebox')
  File "G:\software\game development\renpy-6.99.11-sdk\renpy\defaultstore.py", line 80, in __getattr__
    raise Exception('config.%s is not a known configuration variable.' % (name))
Exception: config.character_id_prefixes is not a known configuration variable.

Windows-8-6.2.9200
Ren'Py 6.99.11.1749
 
[/code]

i havent ran into an error like that before. are you directly running the game template you download with no modifications? cause if not try that first. also make sure your renpy is up to date. i dont know how to offer advice out of this though, sorry!

(+1)

this is pretty neat!!!! thanks for posting this

thanks! im happy to hear you like it