Like simply adds a number to the one shown.
Message opens up another screen where you can type a message and post.
Report opens up another screen where you can report someone.
I have got the buttons in place with the graphics, but I am unsure how to do each task as it needs to like/ message/ report the user clicked on.
Here's my code:
Code: Select all
label start:
# Initialize the chat log
default mylog = ChatLog()
show screen logframe(mylog)
# Add a message to the chat log.
$ mylog.add_chat(msg="Hello World", nick="KoolDog", avatar="images/avatars/kool_dog.png")
pause 1
$ mylog.add_chat(msg="Hey KD! How are you?", nick="Kinmoku", avatar="images/avatars/kinmoku.png")
Code: Select all
screen chat_log(log):
viewport id "chatlog":
xpos 332
ypos 92
ysize 800
yadjustment log.adjustment()
mousewheel True
draggable True
yinitial 1.0
python:
# Thanks to mangoduck at
# https://lemmasoft.renai.us/forums/viewtopic.php?t=32584 for this
# flash of insight for auto scrolling
log.adjustment().value = chat_infinity_float
vbox:
spacing 20
for type, kwargs in log.history():
use expression type pass (**kwargs)
# Defines a single line of the chat log.
# The format is Discord-like.
# avatar nick
# " msg
screen chat_entry(msg="", nick=None, avatar=None):
hbox:
spacing 40
if avatar != None:
add avatar
vbox:
if nick != None:
text nick
text msg
vbox:
yalign 1.0
spacing 8
button:
background "images/button_likes.png"
text "{color=#000}1{/color}" xpos 54 ypos -5
button:
background "images/button_messages.png"
action Show("message_user")
text "{color=#000}0{/color}" xpos 54 ypos -5
button:
background "images/button_report.png"
action Show("report_user")
text "{color=#000}Report{/color}" xpos 10 ypos -5
screen logframe(log):
frame:
use chat_log(log)
"Message" has a number as well, which will go up if you type a message.
"Report" needs the user's name in the screen text. I tried to do this but it didn't work. I'm unsure how to pull this out from what I have.
Code: Select all
screen report_user(msg="", nick=None, avatar=None):
vbox:
xalign 0.5
yalign 0.5
text "Do you want to report user"
if nick != None:
text nick