telegram messenger (4 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
verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: telegram messenger (2 version)

#106 Post by verysunshine »

Sayumi101 wrote: Fri Oct 04, 2019 9:31 am Hello!
So I tried the code and it's working like an absolute dream!! :D

I just had a question. Would it be possible to text two different people with two different histories in play? Not a group chat but two separate chat threads?
I have the same question.

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
sDextra
Regular
Posts: 40
Joined: Fri Oct 12, 2018 2:06 am
Organization: Event Horizon Games
Github: sDextra
Location: Kazakhstan
Contact:

Re: telegram messenger (2 version)

#107 Post by sDextra »

verysunshine wrote: Wed Mar 04, 2020 3:46 pm
Sayumi101 wrote: Fri Oct 04, 2019 9:31 am Hello!
So I tried the code and it's working like an absolute dream!! :D

I just had a question. Would it be possible to text two different people with two different histories in play? Not a group chat but two separate chat threads?
I have the same question.
I've already answered that question.
sDextra wrote: Fri Oct 04, 2019 10:28 am
Sayumi101 wrote: Fri Oct 04, 2019 9:31 am Hello!
So I tried the code and it's working like an absolute dream!! :D

I just had a question. Would it be possible to text two different people with two different histories in play? Not a group chat but two separate chat threads?
Yeah, of course.
You just need to add a new function in messenger.rpy:

Code: Select all

init python:
	# ...
	def switch_dialogue(name='sDextra', dialogue=store.messages):
        	store.interlocutor_name = name
        	store.messages = dialogue
Update messenger.rpy on GitHub.

Usage example:

Code: Select all

$ dialogue_one = [] #Poe
$ dialogue_two = [] #sDextra

$ switch_dialogue(name='Poe', dialogue=dialogue_one)
$ msg ("Hi. This is the first dialogue.", who=1)
pause
$ switch_dialogue(name='sDextra', dialogue=dialogue_two)
$ msg ("This is the second dialogue.", who=1)
pause
$ switch_dialogue(name='Poe', dialogue=dialogue_one)
    ...

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: telegram messenger (2 version)

#108 Post by verysunshine »

sDextra wrote: Thu Mar 05, 2020 1:10 am
verysunshine wrote: Wed Mar 04, 2020 3:46 pm
Sayumi101 wrote: Fri Oct 04, 2019 9:31 am Hello!
So I tried the code and it's working like an absolute dream!! :D

I just had a question. Would it be possible to text two different people with two different histories in play? Not a group chat but two separate chat threads?
I have the same question.
I've already answered that question.
sDextra wrote: Fri Oct 04, 2019 10:28 am
Sayumi101 wrote: Fri Oct 04, 2019 9:31 am Hello!
So I tried the code and it's working like an absolute dream!! :D

I just had a question. Would it be possible to text two different people with two different histories in play? Not a group chat but two separate chat threads?
Yeah, of course.
You just need to add a new function in messenger.rpy:

Code: Select all

init python:
	# ...
	def switch_dialogue(name='sDextra', dialogue=store.messages):
        	store.interlocutor_name = name
        	store.messages = dialogue
Update messenger.rpy on GitHub.

Usage example:

Code: Select all

$ dialogue_one = [] #Poe
$ dialogue_two = [] #sDextra

$ switch_dialogue(name='Poe', dialogue=dialogue_one)
$ msg ("Hi. This is the first dialogue.", who=1)
pause
$ switch_dialogue(name='sDextra', dialogue=dialogue_two)
$ msg ("This is the second dialogue.", who=1)
pause
$ switch_dialogue(name='Poe', dialogue=dialogue_one)
    ...
Oh, sorry. I was actually thinking of switching conversations by clicking a button.

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
sDextra
Regular
Posts: 40
Joined: Fri Oct 12, 2018 2:06 am
Organization: Event Horizon Games
Github: sDextra
Location: Kazakhstan
Contact:

Re: telegram messenger (2 version)

#109 Post by sDextra »

verysunshine wrote: Thu Mar 05, 2020 2:46 pm
sDextra wrote: Thu Mar 05, 2020 1:10 am
verysunshine wrote: Wed Mar 04, 2020 3:46 pm

I have the same question.
I've already answered that question.
sDextra wrote: Fri Oct 04, 2019 10:28 am

Yeah, of course.
You just need to add a new function in messenger.rpy:

Code: Select all

init python:
	# ...
	def switch_dialogue(name='sDextra', dialogue=store.messages):
        	store.interlocutor_name = name
        	store.messages = dialogue
Update messenger.rpy on GitHub.

Usage example:

Code: Select all

$ dialogue_one = [] #Poe
$ dialogue_two = [] #sDextra

$ switch_dialogue(name='Poe', dialogue=dialogue_one)
$ msg ("Hi. This is the first dialogue.", who=1)
pause
$ switch_dialogue(name='sDextra', dialogue=dialogue_two)
$ msg ("This is the second dialogue.", who=1)
pause
$ switch_dialogue(name='Poe', dialogue=dialogue_one)
    ...
Oh, sorry. I was actually thinking of switching conversations by clicking a button.
textbutton "Poe" action Function(switch_dialogue, name='Poe', dialogue=dialogue_one)
textbutton "sDextra" action Function(switch_dialogue, name='sDextra', dialogue=dialogue_two)

Snek
Newbie
Posts: 4
Joined: Wed Apr 22, 2020 6:38 am
Contact:

Re: telegram messenger (2 version)

#110 Post by Snek »

Hi there! Love this thing, it's fantastic!

I was wondering, is there a way to re-arrange everything in such format:

<time> <nickname>: message

Basically for group chat/private chat always have time and nickname in front, kinda like IRC.

Also sent you a message, Dextra. Thank you for your hard work!

creativechaos
Newbie
Posts: 9
Joined: Wed Apr 29, 2020 3:27 pm
Contact:

Re: telegram messenger (2 version)

#111 Post by creativechaos »

Hi,
First of all thanks for your work.

I tried to put the messenger on a icon. so when you click in the game on a icon (in this case mobile phone icon) the messenger shows up. No matter what i did i miserable failed.
Would you be so kind and show me how to do it?

Thanks in advanced

User avatar
sDextra
Regular
Posts: 40
Joined: Fri Oct 12, 2018 2:06 am
Organization: Event Horizon Games
Github: sDextra
Location: Kazakhstan
Contact:

Re: telegram messenger (2 version)

#112 Post by sDextra »

creativechaos wrote: Thu Apr 30, 2020 5:29 am Hi,
First of all thanks for your work.

I tried to put the messenger on a icon. so when you click in the game on a icon (in this case mobile phone icon) the messenger shows up. No matter what i did i miserable failed.
Would you be so kind and show me how to do it?

Thanks in advanced
Can u show me your code with that?

creativechaos
Newbie
Posts: 9
Joined: Wed Apr 29, 2020 3:27 pm
Contact:

Re: telegram messenger (2 version)

#113 Post by creativechaos »

It have set the imagebutton

Code: Select all

imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0.2
            focus_mask True
            idle "mobile-icon-idle"
            hover "mobile-icon-hover"
            action Jump("groupchat_or_dialogue")
But i get this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 15140, in script
    $ show_messenger()
  File "game/script.rpy", line 15140, in <module>
    $ show_messenger()
  File "game/messenger.rpy", line 51, in show_messenger
    renpy.pause(1.0, hard=True)
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 341, in execute
    if under_messenger:
  File "game/messenger.rpy", line 342, in execute
    add '#00000090' at blackout
  File "game/messenger.rpy", line 342, in keywords
    add '#00000090' at blackout
NameError: name 'blackout' is not defined
I want to use the option group or dialogue. I am completly lost at the moment

User avatar
sDextra
Regular
Posts: 40
Joined: Fri Oct 12, 2018 2:06 am
Organization: Event Horizon Games
Github: sDextra
Location: Kazakhstan
Contact:

Re: telegram messenger (2 version)

#114 Post by sDextra »

creativechaos wrote: Thu Apr 30, 2020 8:23 am It have set the imagebutton

Code: Select all

imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0.2
            focus_mask True
            idle "mobile-icon-idle"
            hover "mobile-icon-hover"
            action Jump("groupchat_or_dialogue")
But i get this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 15140, in script
    $ show_messenger()
  File "game/script.rpy", line 15140, in <module>
    $ show_messenger()
  File "game/messenger.rpy", line 51, in show_messenger
    renpy.pause(1.0, hard=True)
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 341, in execute
    if under_messenger:
  File "game/messenger.rpy", line 342, in execute
    add '#00000090' at blackout
  File "game/messenger.rpy", line 342, in keywords
    add '#00000090' at blackout
NameError: name 'blackout' is not defined
I want to use the option group or dialogue. I am completly lost at the moment
But this code works fine for me.
Probably a mistake elsewhere.
Check your script 'images.rpy'

Code: Select all

    transform blackout():
        alpha 1
        on show:
            alpha 0
            easein .5 alpha 1
        on hide:
            easeout .5 alpha 0
Can I see the full script of the screen?

creativechaos
Newbie
Posts: 9
Joined: Wed Apr 29, 2020 3:27 pm
Contact:

Re: telegram messenger (2 version)

#115 Post by creativechaos »

Here the complete error script.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 15140, in script
    $ show_messenger()
  File "game/script.rpy", line 15140, in <module>
    $ show_messenger()
  File "game/messenger.rpy", line 51, in show_messenger
    renpy.pause(1.0, hard=True)
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 341, in execute
    if under_messenger:
  File "game/messenger.rpy", line 342, in execute
    add '#00000090' at blackout
  File "game/messenger.rpy", line 342, in keywords
    add '#00000090' at blackout
NameError: name 'blackout' is not defined

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

Full traceback:
  File "game/script.rpy", line 15140, in script
    $ show_messenger()
  File "F:\Progs\renpy-7.3.5-sdk\renpy\ast.py", line 914, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\python.py", line 2028, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 15140, in <module>
    $ show_messenger()
  File "game/messenger.rpy", line 51, in show_messenger
    renpy.pause(1.0, hard=True)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\exports.py", line 1480, in pause
    rv = renpy.ui.interact(mouse='pause', type='pause', roll_forward=roll_forward)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\ui.py", line 297, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 2702, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 3094, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\screen.py", line 430, in visit_all
    callback(self)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 3094, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\screen.py", line 440, in per_interact
    self.update()
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\screen.py", line 625, in update
    self.screen.function(**self.scope)
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 341, in execute
    if under_messenger:
  File "game/messenger.rpy", line 342, in execute
    add '#00000090' at blackout
  File "game/messenger.rpy", line 342, in keywords
    add '#00000090' at blackout
  File "<screen language>", line 342, in <module>
NameError: name 'blackout' is not defined

Windows-8-6.2.9200
Ren'Py 7.3.5.606
Lets Start 1.0
Thu Apr 30 17:05:19 2020

User avatar
sDextra
Regular
Posts: 40
Joined: Fri Oct 12, 2018 2:06 am
Organization: Event Horizon Games
Github: sDextra
Location: Kazakhstan
Contact:

Re: telegram messenger (2 version)

#116 Post by sDextra »

creativechaos wrote: Thu Apr 30, 2020 11:15 am Here the complete error script.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 15140, in script
    $ show_messenger()
  File "game/script.rpy", line 15140, in <module>
    $ show_messenger()
  File "game/messenger.rpy", line 51, in show_messenger
    renpy.pause(1.0, hard=True)
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 341, in execute
    if under_messenger:
  File "game/messenger.rpy", line 342, in execute
    add '#00000090' at blackout
  File "game/messenger.rpy", line 342, in keywords
    add '#00000090' at blackout
NameError: name 'blackout' is not defined

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

Full traceback:
  File "game/script.rpy", line 15140, in script
    $ show_messenger()
  File "F:\Progs\renpy-7.3.5-sdk\renpy\ast.py", line 914, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\python.py", line 2028, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 15140, in <module>
    $ show_messenger()
  File "game/messenger.rpy", line 51, in show_messenger
    renpy.pause(1.0, hard=True)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\exports.py", line 1480, in pause
    rv = renpy.ui.interact(mouse='pause', type='pause', roll_forward=roll_forward)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\ui.py", line 297, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 2702, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 3094, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\screen.py", line 430, in visit_all
    callback(self)
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\core.py", line 3094, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\screen.py", line 440, in per_interact
    self.update()
  File "F:\Progs\renpy-7.3.5-sdk\renpy\display\screen.py", line 625, in update
    self.screen.function(**self.scope)
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 340, in execute
    screen messenger():
  File "game/messenger.rpy", line 341, in execute
    if under_messenger:
  File "game/messenger.rpy", line 342, in execute
    add '#00000090' at blackout
  File "game/messenger.rpy", line 342, in keywords
    add '#00000090' at blackout
  File "<screen language>", line 342, in <module>
NameError: name 'blackout' is not defined

Windows-8-6.2.9200
Ren'Py 7.3.5.606
Lets Start 1.0
Thu Apr 30 17:05:19 2020
Sorry, I'm talking about your script with the button.
Full version of this screen:

Code: Select all

imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0.2
            focus_mask True
            idle "mobile-icon-idle"
            hover "mobile-icon-hover"
            action Jump("groupchat_or_dialogue")

creativechaos
Newbie
Posts: 9
Joined: Wed Apr 29, 2020 3:27 pm
Contact:

Re: telegram messenger (2 version)

#117 Post by creativechaos »

Code: Select all

  screen mc_room_map:
    imagemap:

        vbox:
            textbutton "{b}[clock.time]{/b}"
            textbutton "{b}[clock.weekday]{/b} {b}[clock.day]{/b}"
        hbox:
            imagebutton:
                top_margin .01
                left_margin .15
                xalign 0.0 ypos 0
                focus_mask True
                idle "time-icon-idle"
                hover "time-icon-hover"
                action Function(clock.advance)

        imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0
            focus_mask True
            idle "map-icon-idle"
            hover "map-icon-hover"
            action Jump("morrison_navigation")

        imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0.2
            focus_mask True
            idle "mobile-icon-idle"
            hover "mobile-icon-hover"
            action Jump("lb_groupchat")
You mean this?

User avatar
sDextra
Regular
Posts: 40
Joined: Fri Oct 12, 2018 2:06 am
Organization: Event Horizon Games
Github: sDextra
Location: Kazakhstan
Contact:

Re: telegram messenger (2 version)

#118 Post by sDextra »

creativechaos wrote: Sat May 02, 2020 7:19 am

Code: Select all

  screen mc_room_map:
    imagemap:

        vbox:
            textbutton "{b}[clock.time]{/b}"
            textbutton "{b}[clock.weekday]{/b} {b}[clock.day]{/b}"
        hbox:
            imagebutton:
                top_margin .01
                left_margin .15
                xalign 0.0 ypos 0
                focus_mask True
                idle "time-icon-idle"
                hover "time-icon-hover"
                action Function(clock.advance)

        imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0
            focus_mask True
            idle "map-icon-idle"
            hover "map-icon-hover"
            action Jump("morrison_navigation")

        imagebutton:
            top_margin .01
            right_margin .01
            xalign 1.0 ypos 0.2
            focus_mask True
            idle "mobile-icon-idle"
            hover "mobile-icon-hover"
            action Jump("lb_groupchat")
You mean this?
Can u send me your project via PM? I'll try to fix the error.
There may be an error in the incorrect call of the screen.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: telegram messenger

#119 Post by rayminator »

Nanahs wrote: 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.
open sms.rpy

find and change

Code: Select all

# положение окна с смс
    sms_xalign, sms_yalign = .75, .25

Dr_arell
Regular
Posts: 70
Joined: Sun Feb 23, 2020 11:24 pm
Deviantart: DarellArt
Contact:

Re: telegram messenger (2 version)

#120 Post by Dr_arell »

i was breaking my head a few months ago trying to achieve something like this, and i came up with a very decent result, but this one seems better, ill give it a try thank you.

Post Reply

Who is online

Users browsing this forum: No registered users