Old message system [SOLVED]

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
Potato0095
Regular
Posts: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

Old message system [SOLVED]

#1 Post by Potato0095 »

So, I got a code for a message system here: viewtopic.php?f=51&t=19295
It's from 2013/2014 (kinda old). With the new gui system it looks like this:
screenshot0000.png

I managed to do this:
screenshot0001.png

I wanted to be like this:
screenshot0003.png

When I change the code, instead of being fit inside the screen, the screen also resizes:
screenshot0002.png

I don't want this, could someone help me out?

My code:
messages.rpy
(6.5 KiB) Downloaded 99 times

The Demo for the system, it's also on the original post.
script.rpy
(4.22 KiB) Downloaded 90 times
Last edited by Potato0095 on Thu Jul 27, 2017 11:26 pm, edited 1 time in total.
"There are two types of lies: Lies that hurt, and lies that don't."

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Old message system

#2 Post by philat »

I don't know what your resolution is, so you'll have to fiddle with the numbers yourself, but it seems like you're having trouble with the area calculations and it might just be simpler to use an hbox and adjust xsize/ysize.

The following looks passably similar to your mockup on 1280x720.

Code: Select all

screen mailbox:
    tag menu
    modal True
    default current_message = None
    $ available_drafts = [i for i in contacts if i.draft_label]
    frame:
        xalign 0.0 yalign 0.5
        style_group "mailbox"
        vbox:
            label "Inbox"
            if new_message_count() > 0:
                text ("Messages: %d (%d unread)") % (message_count(), new_message_count())
            else:
                text ("Messages: %d") % message_count()
            hbox:
                side "c r":
                    xsize 500 # this
                    ysize 500 # this
                    viewport id "message_list":
                        draggable True mousewheel True
                        vbox:
                            for i in mail:
                                if i.view:
                                    if not i.read:
                                        textbutton ("*NEW* " + i.sender + " - " + i.subject) action [SetScreenVariable("current_message",i), i.mark_read] xfill True xalign 0.0
                                    else:
                                        textbutton (i.sender + " - " + i.subject) action SetScreenVariable("current_message",i) xfill True xalign 0.0
                    vbar value YScrollValue("message_list")
                side "c r":
                    xsize 800 # this
                    ysize 500 # this
                    viewport id "view_message":
                        draggable True mousewheel True
                        vbox:
                            if current_message:
                                text ("From: " + current_message.sender)
                                text ("Subject: " + current_message.subject)
                                text current_message.body
                    vbar value YScrollValue("view_message")
            use mailbox_commands

User avatar
Potato0095
Regular
Posts: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

Re: Old message system

#3 Post by Potato0095 »

It worked, as you said, I had to put the numbers myself, since I'm using 1920x1080, it came out this way:

Code: Select all

hbox:
                side "c r":
                    xsize 700 # this
                    ysize 600 # this
                    viewport id "message_list":
                        draggable True mousewheel True
                        vbox:
                            for i in mail:
                                if i.view:
                                    if not i.read:
                                        textbutton ("*NEW* " + i.sender + " - " + i.subject) action [SetScreenVariable("current_message",i), i.mark_read] xfill True xalign 0.0
                                    else:
                                        textbutton (i.sender + " - " + i.subject) action SetScreenVariable("current_message",i) xfill True xalign 0.0
                    vbar value YScrollValue("message_list")
                side "c r":
                    xsize 1180 # this
                    ysize 600 # this
Thank you for your help, you saved me a lot of time here.
"There are two types of lies: Lies that hurt, and lies that don't."

Post Reply

Who is online

Users browsing this forum: Google [Bot]