Basic Message System

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
TheChatotMaestro
Regular
Posts: 43
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Basic Message System

#76 Post by TheChatotMaestro » Sun Aug 20, 2017 11:28 am

[Resolved, deleted because unanswered and largely unimportant, stupid mistake on my part.]
Last edited by TheChatotMaestro on Mon Sep 11, 2017 9:59 pm, edited 1 time in total.

TheChatotMaestro
Regular
Posts: 43
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Basic Message System

#77 Post by TheChatotMaestro » Wed Aug 23, 2017 8:33 pm

I kept trying, and nothing fixed it... I'm so sorry if repeated posting is annoying, I just really like the idea of this system, and really want to try it out in my game. Anyone ever had this issue? (Using latest version of Ren'Py, so that's probably the source of a lot of problems since this code's kinda old.)

TheChatotMaestro
Regular
Posts: 43
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Basic Message System

#78 Post by TheChatotMaestro » Mon Sep 11, 2017 9:59 pm

Fixed my earlier problem lol, revisited this after ages, but now I'm getting this...

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/messages.rpy", line 148: u'text' is not a keyword argument or valid child for the label statement.
    text ("Messages: %d (%d unread)") % (message_count(), new_message_count())
        ^

Ren'Py Version: Ren'Py 6.99.12.4.2187
The block in question:

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:
        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()
                side "c r":
                    area (0,0,800,93)
                    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
                                    else:
                                        textbutton (i.sender + " - " + i.subject) action SetScreenVariable("current_message",i) xfill True
                    vbar value YScrollValue("message_list")
            hbox:
                null height 20
            side "c r":
                area (0,0,800,380)
                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
Anyone understand?
(Deleting previous messages so as not to be spammy. :( )

TheChatotMaestro
Regular
Posts: 43
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Basic Message System

#79 Post by TheChatotMaestro » Mon Sep 11, 2017 10:27 pm

And like magic, I complain about my problems on the forum and fix them 20 minutes later.
This was kinda tricky, though, so here's what I changed it to:

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:
        style_group "mailbox"
        vbox:
            label "Inbox"
            if new_message_count() > 0:
                text "New Messages: [new_messages]"
            else:
                text "No New Messages"
            side "c r":
                area (0,0,800,93)
                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
                                else:
                                    textbutton (i.sender + " - " + i.subject) action SetScreenVariable("current_message",i) xfill True
                    vbar value YScrollValue("message_list")
            hbox:
                null height 20
            side "c r":
                area (0,0,800,380)
                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
Dunno if it does exactly the same thing, but I'm not getting an error message anymore!

vonhardenberg
Newbie
Posts: 1
Joined: Tue Sep 19, 2017 8:57 am
Contact:

Re: Basic Message System

#80 Post by vonhardenberg » Tue Sep 19, 2017 10:06 am

LyannaCore wrote:
Wed Jun 21, 2017 2:03 pm
I realize this systems is a bit old now, so it's probably just something that has changed with Renpy updates, but trying to use it messes up my existing menus.

With the messages.rpy included and integrated as required, they are aligned to the left and have no change when moused over:
Image.

Without the message framework, it looks like this:
Image

The beginning of my script code is like this while using the messages.rpy framework:

Code: Select all

label start: 

## Message Stuff ##
    $ mail = []
    $ mail_queue = [] # for message delay
    $ contacts = []  # for draft feature

    scene black
    with fade
    
    show screen mailbox_overlay
    
    "Where would you like to start?"
    menu:
        "Intro":
            jump start1
        "Waking up":
            jump wake1
        "Laundry":
            $ pcfirstname = "Lyanna"
            $ pclastname = "Core"
            jump laundryservice
        "Ship Paperwork":
            $ pcfirstname = "Lyanna"
            $ pclastname = "Core"
            $ laundrychoice = 1
            jump creation1
        "Ship Start":
            $ pcfirstname = "Lyanna"
            $ pclastname = "Core"
            jump shipstart1
        "System Map":
            $ pcfirstname = "Lyanna"
            $ pclastname = "Core"
            jump system_map
Any ideas what the issue could be?
Is there a more permanent solution to this? I've got the code working as a receive only system, but this reply system looks really cool, and I'd love to be able to use it. But I can't figure out what's wrong to create the issue in the post quoted.

Post Reply

Who is online

Users browsing this forum: No registered users