Re: Basic Message System
Posted: Sun Aug 20, 2017 11:28 am
[Resolved, deleted because unanswered and largely unimportant, stupid mistake on my part.]
Supporting creators of visual novels and story-based games since 2003.
https://lemmasoft.renai.us/forums/
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
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
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
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.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:
.
Without the message framework, it looks like this:
The beginning of my script code is like this while using the messages.rpy framework:Any ideas what the issue could be?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
Code: Select all
While running game code:
File "game/script.rpy", line 43, in <module>
$ deliver_all()
File "game/messages.rpy", line 82, in deliver_all
mail.extend(mail_queue)
UnboundLocalError: local variable 'mail_queue' referenced before assignment
Windows-8-6.2.9200
Ren'Py 7.0.0.196
Code: Select all
# else:
# this is the default choice menu
# screen choice(items):
# style_prefix "choice"
# vbox:
# for i in items:
# textbutton i.caption action i.action
# window:
# style "menu_window"
# xalign 0.5
# ypos 405
# yanchor 0.5
# vbox:
# style "menu"
# spacin 2
# for caption, action, chosen in items:
# if action:
# button:
# action action
# style "choice_button"
# text caption style "menu_choice"
# else:
# text caption style "menu_caption"
# for i in items:
# textbutton i.caption action i.action
Code: Select all
call message_img("nadia", "it works with images too!","images/pic1.png") # Message with picture included
call message("nadia", "the text box changes depending on how much content there is. dont put too big images or its gonna look weeeeiiiird") # Message without picture
call message("nadia", "you can also do menus here")
Code: Select all
screen choice:
if reply_screen or draft_screen:
# this is the menu for message replies and drafts
frame:
style_group "mailbox"
vbox:
label "Draft"
if reply_screen:
text ("To: " + current_message.sender)
text ("Subject: Re: " + current_message.subject)
else:
text ("To: " + contact.name)
text ("Subject: " + message_title)
null height 30
for caption, action, chosen in items:
if action:
button:
action action
style "menu_choice_button" xalign 0.5
text caption text_align 0.5
else:
text caption style "menu_caption"
else:
# this is the default choice menu
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action
window:
style "menu_window"
xalign 0.5
ypos 405
yanchor 0.5
vbox:
style "menu"
spacin 2
for caption, action, chosen in items:
if action:
button:
action action
style "choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
for i in items:
textbutton i.caption action i.action
wyverngem wrote: ↑Mon Aug 13, 2018 2:55 pmAnyone else getting this error?Code: Select all
While running game code: File "game/script.rpy", line 43, in <module> $ deliver_all() File "game/messages.rpy", line 82, in deliver_all mail.extend(mail_queue) UnboundLocalError: local variable 'mail_queue' referenced before assignment Windows-8-6.2.9200 Ren'Py 7.0.0.196
Code: Select all
def deliver_all():
global mail_queue
mail.extend(mail_queue)
mail_queue = list()
Code: Select all
$ add_message("Message Delay!", "Eileen", "This is a delayed message.", delay=True)
Code: Select all
if check("TPS Reports"):
$ deliver_next()
Code: Select all
def delcheck(subject):
for item in mail:
if item.subject == subject:
if item.view:
return False
else:
return True
Code: Select all
e "Did you read the first Test Message?"
if check("TPS Reports"):
e "Yep!"
else:
e "Nope!"
e "Did you also delete it?"
if delcheck("TPS Reports"):
e "Yep!"
else:
e "Nope!"