Text system (mobile ohone)

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
User avatar
DragonKnight
Regular
Posts: 44
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Text system (mobile ohone)

#1 Post by DragonKnight » Fri Mar 16, 2018 2:55 am

Code: Select all

call phone_start
call message_start("[player_name]", "Hey, Mom and I are going out to eat.  Wanna come?")
call reply_message("[sister_name]", "Sure,  can we eat at Dad's favorite place?")
# this one is the same as the above one, but instead it has one more place for you to set an image
# you have to make the image be small enough to fit the screen or its gonna stretch weird!
call messa
How do you make the reply messages show who sent them, I got the outgoing message(it is in the script), but I run into this each time I put the [sister_name]:
problem2.png
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
Ocelot
Miko-Class Veteran
Posts: 802
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Text system (mobile ohone)

#2 Post by Ocelot » Fri Mar 16, 2018 11:21 am

How is your message_start and reply_message labels are defined?
< < insert Rick Cook quote here > >

User avatar
DragonKnight
Regular
Posts: 44
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: Text system (mobile ohone)

#3 Post by DragonKnight » Fri Mar 16, 2018 12:00 pm

Code: Select all

init offset = -1





############ phone code here########
# if you dont use  1920 x 1080 youre going to have to play with these numbers to get it to work and make the phone image be smaller somehow
# just keep changing stuff and refreshing the game until it works, sorry lol


init 5:
    style phone_message_vbox:
        xalign 0.5
        yalign 0
        ypos 280
        xsize 340
        xoffset 2
        
    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 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 -340        
        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 -340        
        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.5
        yalign 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.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 ############
Like this...........................
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
DragonKnight
Regular
Posts: 44
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: Text system (mobile ohone)

#4 Post by DragonKnight » Fri Mar 16, 2018 3:18 pm

You said labels right:

Code: Select all

label phone_start:
    window hide
    show phone at phone_pickup
    $ renpy.pause(0.2)
    return
    
label phone_msg:
    $ renpy.pause()
    hide screen phone_message
    $ renpy.pause(0.1)
    return
        
label phone_msg2:
    $ renpy.pause()
    hide screen phone_message2
    $ renpy.pause(0.1)
    return
        
label phone_msgi:
    $ renpy.pause()
    hide screen phone_message_image
    $ renpy.pause(0.1)
    return


label phone_after_menu:
    hide screen phone_message
    hide screen phone_message2
    hide screen phone_message3
    hide screen phone_message_image
    $ renpy.pause(0.1)
    return    
    
label phone_end:
    $ renpy.pause()
    hide screen phone_message
    hide screen phone_message2
    hide screen phone_message3
    hide screen phone_message_image
    show phone at phone_hide
    $ renpy.pause(0.2)
    return

label message(who, what):
    $ renpy.pause()
    hide screen phone_message
    hide screen phone_message2
    hide screen phone_message3
    hide screen phone_message_image
    $ renpy.pause(0.1)
    # if you want to change the players name to be something else than "me" you can change it here
    if who.lower() == "[player_name]":
        show screen phone_message2(who, what)
    else:
        show screen phone_message(who, what)
    return
    
label reply_message(who):
    $ 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_message3(who)
    return

label 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


label message_start(who, what):
    # if you want to change the players name to be something else than "me" you can change it here
    if who.lower() == "[player_name]":
        show screen phone_message2(who, what)
    else:
        show screen phone_message(who, what)
    return    


    

    
######### phone code ends here ##########
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
Ocelot
Miko-Class Veteran
Posts: 802
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Text system (mobile ohone)

#5 Post by Ocelot » Fri Mar 16, 2018 5:35 pm

Your reply_message label accepts only one argument. You are trying to pass two. Hence the error.
< < insert Rick Cook quote here > >

User avatar
DragonKnight
Regular
Posts: 44
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: Text system (mobile ohone)

#6 Post by DragonKnight » Sat Mar 17, 2018 4:02 am

You couldn't tell by my constant erasure marks I didn't think of that already. When I put two argument:

Code: Select all

label reply_message(who, what):
    $ 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_message3(who, what)
    return
My reply message didn't show up, it went on to the next message.
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
Ocelot
Miko-Class Veteran
Posts: 802
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Text system (mobile ohone)

#7 Post by Ocelot » Sat Mar 17, 2018 4:20 am

THat would be another problem. Problem in OP post is clear: you are calling something intended to call with one argument wit two. Either call it with only one, or change label to accept two arguments.

With your screen proble it is not clear: is it screen which fails to show, or is it message that fails to appear, or is it something else? Also notice that reply screen accepts a single argument too. You need to fix that. Either by calling it with only one argument or modifying screen to accept both.
< < insert Rick Cook quote here > >

User avatar
DragonKnight
Regular
Posts: 44
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: Text system (mobile ohone)

#8 Post by DragonKnight » Sat Mar 17, 2018 5:26 am

I figured it out(solved)
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
PREZ
Newbie
Posts: 6
Joined: Wed Mar 14, 2018 3:45 pm
Location: Cantabria, Spain
Contact:

Re: Text system (mobile ohone)

#9 Post by PREZ » Sat Mar 17, 2018 5:53 am

Congrats!
Could you post the final solution? :)

User avatar
DragonKnight
Regular
Posts: 44
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: Text system (mobile ohone)

#10 Post by DragonKnight » Sat Mar 17, 2018 9:14 am

Solution:
Download the phone template from renpy cookbook, and go to the screen.rpy and change screen_message3(what) into (who, what): and go down into vbox into:
vbox:
style "phone_message_contents"
##text who style "phone_message_who"
text what style "phone_message_what"
into
vbox:
style "phone_message_contents"
text who style "phone_message_who"
text what style "phone_message_what"
And that's it.
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], mdbanares