telegram messenger (2 version)

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
User avatar
Andredron
Regular
Posts: 174
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

telegram messenger (2 version)

#1 Post by Andredron » Fri May 18, 2018 10:01 am

Image
1 version
my friend made an instant messenger telegram to anyone who enjoys using it.

download project https://yadi.sk/d/JasKIC7U3WMovt
autor Valentin Bez'chanuk https://m.vk.com/sota6

The license is free, but I'll be glad if ty specify the author

_________________________________________

Image
Autor: Ruslan Nebykov
2 version message telegram

Gui Renpy
http://renpyfordummies.blogspot.com/201 ... i.html?m=1

Alt version Renpy
http://renpyfordummies.blogspot.com/201 ... t.html?m=1
Last edited by Andredron on Mon Sep 03, 2018 5:25 pm, edited 9 times in total.
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

User avatar
gas
Veteran
Posts: 439
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: telegram messenger

#2 Post by gas » Sat May 19, 2018 10:08 am

Thanks to both you and your friend.
10 ? "RENPY"
20 GOTO 10

RUN

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

Re: telegram messenger

#3 Post by DragonKnight » Sun May 20, 2018 5:43 am

Thanks
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
gas
Veteran
Posts: 439
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: telegram messenger

#4 Post by gas » Sun May 20, 2018 10:24 am

There's a bug in the remove last message function!
It throw an empty list error if you erase the first message in a sequence.
I don't have the exqct code right there, but it lack a check for an empty list before apply del[-1].
10 ? "RENPY"
20 GOTO 10

RUN

User avatar
Andredron
Regular
Posts: 174
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: telegram messenger

#5 Post by Andredron » Tue May 22, 2018 10:37 am

gas wrote:
Sun May 20, 2018 10:24 am
There's a bug in the remove last message function!
It throw an empty list error if you erase the first message in a sequence.
I don't have the exqct code right there, but it lack a check for an empty list before apply del[-1].
I understood, I will write to him about the error
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

User avatar
Andredron
Regular
Posts: 174
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: telegram messenger

#6 Post by Andredron » Tue May 22, 2018 10:54 am

Code: Select all

def del_last_msg(): 
    if len(store.m_msg) > 0: 
        del store.m_msg[-1]
link updated
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Saiffyros
Newbie
Posts: 15
Joined: Sun May 21, 2017 10:13 pm
Contact:

Re: telegram messenger

#7 Post by Saiffyros » Fri Jun 01, 2018 6:16 pm

I added a way to include pictures on it. Code and example bellow.
The dimensions of the pic: 200x200

Thank you for sharing it :-)

Image

Code: Select all

    yadj = ui.adjustment()
    # Добавление нового сообщения
    def msg(txt, who=False, image1=False, sound=False):
        store.m_msg.append((who, txt, image1, sound))
        store.yadj.value = store.yadj.range+300
        renpy.restart_interaction()
        if who:
            renpy.play("new_message.mp3", "sound")
        renpy.pause()
    # Удаление последнего сообщения
    def del_last_msg():
        if len(store.m_msg) > 0:
            del store.m_msg[-1]
    # Удаление всех сообщений
    def del_all_msg():
        store.m_msg = []

#################################################################################
# Экран сообщения
screen telegram():
    frame background "messenger/back.png" xysize (600,975) align (0.9,.5):
        frame background None xysize (560, 810) align (0.5,0.58):
            viewport id "vp_msg" mousewheel True  yadjustment yadj:
                vbox spacing 15 xsize 550 xalign 0.4 box_reverse True:
                    for message in m_msg[::-1]:
                        $ who, txt, image1, sound = message
                        $ xgn = 0.0 if who else 1.0
                        if sound:
                            imagebutton auto "messenger/sound_%s.png" xalign xgn action Play("sound", sound)
                        if image1:
                            imagebutton idle image1 hover image1 xalign xgn action NullAction()
                        else:
                            button xalign xgn xmaximum 580 xpadding 20 ypadding 10 background Frame("messenger/box.png", 25, 25):
                                text "%s"%(txt) style "txt_base"

        # Имя собеседника
        text "%s"%(msg_name) style "txt_base" size 35 xalign 0.31 xanchor 0.0 yalign 0.04
        # Аватарка собеседника
        add "messenger/av/"+msg_name.lower().replace(' ', '_')+".png" pos (100,27)
        # Стрелка
        imagebutton auto "messenger/arr_%s.png" pos (10, 33) action NullAction()
        # Стереть сообщения
        button background style_button_inst hover_background style_button_hovr xalign 0.99 yalign 0.03 action Function(del_all_msg) xysize (60,60):
            text "  x  " style "txt_base" size 40 pos (36, -2)
        # Ползунок прокрутки
        vbar value YScrollValue("vp_msg") style "bar_vert"

User avatar
Andredron
Regular
Posts: 174
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: telegram messenger

#8 Post by Andredron » Sat Jun 02, 2018 4:58 am

Saiffyros wrote:
Fri Jun 01, 2018 6:16 pm
I added a way to include pictures on it. Code and example bellow.
The dimensions of the pic: 200x200

Thank you for sharing it :-)

Image

Code: Select all

    yadj = ui.adjustment()
    # Добавление нового сообщения
    def msg(txt, who=False, image1=False, sound=False):
        store.m_msg.append((who, txt, image1, sound))
        store.yadj.value = store.yadj.range+300
        renpy.restart_interaction()
        if who:
            renpy.play("new_message.mp3", "sound")
        renpy.pause()
    # Удаление последнего сообщения
    def del_last_msg():
        if len(store.m_msg) > 0:
            del store.m_msg[-1]
    # Удаление всех сообщений
    def del_all_msg():
        store.m_msg = []

#################################################################################
# Экран сообщения
screen telegram():
    frame background "messenger/back.png" xysize (600,975) align (0.9,.5):
        frame background None xysize (560, 810) align (0.5,0.58):
            viewport id "vp_msg" mousewheel True  yadjustment yadj:
                vbox spacing 15 xsize 550 xalign 0.4 box_reverse True:
                    for message in m_msg[::-1]:
                        $ who, txt, image1, sound = message
                        $ xgn = 0.0 if who else 1.0
                        if sound:
                            imagebutton auto "messenger/sound_%s.png" xalign xgn action Play("sound", sound)
                        if image1:
                            imagebutton idle image1 hover image1 xalign xgn action NullAction()
                        else:
                            button xalign xgn xmaximum 580 xpadding 20 ypadding 10 background Frame("messenger/box.png", 25, 25):
                                text "%s"%(txt) style "txt_base"

        # Имя собеседника
        text "%s"%(msg_name) style "txt_base" size 35 xalign 0.31 xanchor 0.0 yalign 0.04
        # Аватарка собеседника
        add "messenger/av/"+msg_name.lower().replace(' ', '_')+".png" pos (100,27)
        # Стрелка
        imagebutton auto "messenger/arr_%s.png" pos (10, 33) action NullAction()
        # Стереть сообщения
        button background style_button_inst hover_background style_button_hovr xalign 0.99 yalign 0.03 action Function(del_all_msg) xysize (60,60):
            text "  x  " style "txt_base" size 40 pos (36, -2)
        # Ползунок прокрутки
        vbar value YScrollValue("vp_msg") style "bar_vert"
or make a button in the background frame to click on the picture and the transformation to an enlarged image worked

the author wrote
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Nanahs
Regular
Posts: 97
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: telegram messenger

#9 Post by Nanahs » Fri Aug 24, 2018 10:00 pm

This is amazing! Thank you so much for sharing! :D
I have one question though. Is there a way I can give the player options of anwers?
I mean, the character asks you in a message "How are you doing?". Then a menu choice pops up with answers options like "I'm fine, and you?" and "I'm booored". Then, depending on your choice, his answer is going to be different as well. Thank you :)

User avatar
Andredron
Regular
Posts: 174
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: telegram messenger

#10 Post by Andredron » Sun Aug 26, 2018 2:14 pm

Nanahs wrote:
Fri Aug 24, 2018 10:00 pm
This is amazing! Thank you so much for sharing! :D
I have one question though. Is there a way I can give the player options of anwers?
I mean, the character asks you in a message "How are you doing?". Then a menu choice pops up with answers options like "I'm fine, and you?" and "I'm booored". Then, depending on your choice, his answer is going to be different as well. Thank you :)
Valentin said:
Image
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Nanahs
Regular
Posts: 97
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: telegram messenger

#11 Post by Nanahs » Mon Aug 27, 2018 5:44 pm

Thank you so much Andredom! If I use the codes, I'll give you credit :)

User avatar
Andredron
Regular
Posts: 174
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: telegram messenger

#12 Post by Andredron » Mon Aug 27, 2018 6:23 pm

Nanahs wrote:
Mon Aug 27, 2018 5:44 pm
Thank you so much Andredom! If I use the codes, I'll give you credit :)

Please do not need to publish me, he's an author Valentin Bez'chanuk, he's just busy, that would personally write in the forum
I know, I have terrible English
I'm writing a Renpy textbook (in Russian). I would be glad if someone translated into an English or German textbook https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Nanahs
Regular
Posts: 97
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: telegram messenger

#13 Post by Nanahs » Mon Aug 27, 2018 8:13 pm

Andredron wrote:
Mon Aug 27, 2018 6:23 pm
Nanahs wrote:
Mon Aug 27, 2018 5:44 pm
Thank you so much Andredom! If I use the codes, I'll give you credit :)

Please do not need to publish me, he's an author Valentin Bez'chanuk, he's just busy, that would personally write in the forum
That's ok. Thank you :)

Nanahs
Regular
Posts: 97
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: telegram messenger

#14 Post by Nanahs » Mon Aug 27, 2018 8:28 pm

Oh! One more question I have. Sorry to bother you. I was just wondering, is it possible to add more people in the chat?
I mean, if I wanted to pretend it's a group chat. Like, let's just say the group is called "friends". And add more people chatting. Is it possible? Thank you.

Nanahs
Regular
Posts: 97
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: telegram messenger

#15 Post by Nanahs » Thu Aug 30, 2018 6:25 pm

Andredron wrote:
Mon Aug 27, 2018 6:23 pm
Nanahs wrote:
Mon Aug 27, 2018 5:44 pm
Thank you so much Andredom! If I use the codes, I'll give you credit :)

Please do not need to publish me, he's an author Valentin Bez'chanuk, he's just busy, that would personally write in the forum
Hello! Silly question, but how can I place the phone in the middle of the screen?
Whenever I try to do that I get an error message.

Post Reply

Who is online

Users browsing this forum: No registered users