Page 1 of 1

Text system (mobile ohone)

Posted: Fri Mar 16, 2018 2:55 am
by DragonKnight

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

Re: Text system (mobile ohone)

Posted: Fri Mar 16, 2018 11:21 am
by Ocelot
How is your message_start and reply_message labels are defined?

Re: Text system (mobile ohone)

Posted: Fri Mar 16, 2018 12:00 pm
by DragonKnight

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...........................

Re: Text system (mobile ohone)

Posted: Fri Mar 16, 2018 3:18 pm
by DragonKnight
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 ##########

Re: Text system (mobile ohone)

Posted: Fri Mar 16, 2018 5:35 pm
by Ocelot
Your reply_message label accepts only one argument. You are trying to pass two. Hence the error.

Re: Text system (mobile ohone)

Posted: Sat Mar 17, 2018 4:02 am
by DragonKnight
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.

Re: Text system (mobile ohone)

Posted: Sat Mar 17, 2018 4:20 am
by Ocelot
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.

Re: Text system (mobile ohone)

Posted: Sat Mar 17, 2018 5:26 am
by DragonKnight
I figured it out(solved)

Re: Text system (mobile ohone)

Posted: Sat Mar 17, 2018 5:53 am
by PREZ
Congrats!
Could you post the final solution? :)

Re: Text system (mobile ohone)

Posted: Sat Mar 17, 2018 9:14 am
by DragonKnight
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.