Hey there!
Thanks for the answers!
I've been working a bit to find solutions to that.
1) I started from the screen file_slots and thought about the button code to change the file page name. I've added the following code, but it still gives me an error that I cannot solve.
The first one allows me to write text in the slot, but it does not stay saved like the one in the file page name:
Code: Select all
button:
style "gui_label_text"
add Input(hover_color="#3399ff", size=12, color="#000", adjust_spacing=True, default="", changed=name_func, length=50)
key_events True
xalign 0.0
The second one gives me the following error when I click the save/load button:
Code: Select all
button:
style "gui_label_text"
## xmaximum 25
## ymaximum 15
add Input(hover_color="#3399ff", size=12, color="#000", adjust_spacing=True, default="", changed=name_func, length=50)
key_events True
xalign 0.0
##action name_slot.Toggle()
input:
style "page_label_text"
value VariableInputValue(name_slot, default=True, returnable=True)
The error:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/screens.rpy", line 666, in execute
screen load():
File "game/screens.rpy", line 666, in execute
screen load():
File "game/screens.rpy", line 670, in execute
use file_slots(_("Cargar"))
File "game/screens.rpy", line 673, in execute
screen file_slots(title):
File "game/screens.rpy", line 673, in execute
screen file_slots(title):
File "game/screens.rpy", line 678, in execute
use game_menu(title):
File "game/screens.rpy", line 464, in execute
screen game_menu(title, scroll=None, yinitial=0.0):
File "game/screens.rpy", line 464, in execute
screen game_menu(title, scroll=None, yinitial=0.0):
File "game/screens.rpy", line 473, in execute
frame:
File "game/screens.rpy", line 476, in execute
hbox:
File "game/screens.rpy", line 482, in execute
frame:
File "game/screens.rpy", line 485, in execute
if scroll == "viewport":
File "game/screens.rpy", line 516, in execute
transclude
File "game/screens.rpy", line 678, in execute
use game_menu(title):
File "game/screens.rpy", line 680, in execute
fixed:
File "game/screens.rpy", line 700, in execute
grid gui.file_slot_cols gui.file_slot_rows:
File "game/screens.rpy", line 708, in execute
for i in range(gui.file_slot_cols * gui.file_slot_rows):
File "game/screens.rpy", line 712, in execute
button:
File "game/screens.rpy", line 715, in execute
has vbox
File "game/screens.rpy", line 728, in execute
button:
File "game/screens.rpy", line 737, in execute
input:
File "renpy/common/00inputvalues.rpy", line 145, in get_text
return globals()[self.variable]
KeyError: u'a'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
python hide:
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\ast.py", line 862, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\python.py", line 1912, in py_exec_bytecode
exec bytecode in globals, locals
File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
python hide:
File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
ui.interact()
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\ui.py", line 287, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 2649, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 3033, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 511, in visit_all
d.visit_all(callback)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 511, in visit_all
d.visit_all(callback)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 511, in visit_all
d.visit_all(callback)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 511, in visit_all
d.visit_all(callback)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\screen.py", line 424, in visit_all
callback(self)
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\core.py", line 3033, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\screen.py", line 434, in per_interact
self.update()
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\screen.py", line 619, in update
self.screen.function(**self.scope)
File "game/screens.rpy", line 666, in execute
screen load():
File "game/screens.rpy", line 666, in execute
screen load():
File "game/screens.rpy", line 670, in execute
use file_slots(_("Cargar"))
File "game/screens.rpy", line 673, in execute
screen file_slots(title):
File "game/screens.rpy", line 673, in execute
screen file_slots(title):
File "game/screens.rpy", line 678, in execute
use game_menu(title):
File "game/screens.rpy", line 464, in execute
screen game_menu(title, scroll=None, yinitial=0.0):
File "game/screens.rpy", line 464, in execute
screen game_menu(title, scroll=None, yinitial=0.0):
File "game/screens.rpy", line 473, in execute
frame:
File "game/screens.rpy", line 476, in execute
hbox:
File "game/screens.rpy", line 482, in execute
frame:
File "game/screens.rpy", line 485, in execute
if scroll == "viewport":
File "game/screens.rpy", line 516, in execute
transclude
File "game/screens.rpy", line 678, in execute
use game_menu(title):
File "game/screens.rpy", line 680, in execute
fixed:
File "game/screens.rpy", line 700, in execute
grid gui.file_slot_cols gui.file_slot_rows:
File "game/screens.rpy", line 708, in execute
for i in range(gui.file_slot_cols * gui.file_slot_rows):
File "game/screens.rpy", line 712, in execute
button:
File "game/screens.rpy", line 715, in execute
has vbox
File "game/screens.rpy", line 728, in execute
button:
File "game/screens.rpy", line 737, in execute
input:
File "C:\Users\Aaron\Desktop\renpy-7.0.0-sdk\renpy\display\behavior.py", line 1094, in __init__
default = value.get_text()
File "renpy/common/00inputvalues.rpy", line 145, in get_text
return globals()[self.variable]
KeyError: u'a'
Windows-8-6.2.9200
Ren'Py 7.0.0.196
AROA 1.0
Thu Aug 23 21:06:47 2018
Any idea?
2) I've write the following code and it works good:
Code: Select all
if FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty")) <> "empty":
imagebutton:
idle "gui/icon_delete.png" hover "gui/icon_delete_hover.png" action FileDelete(slot)
xalign 1.0 ypos 1.0 xoffset 35
3) I've tried to find a way to copy the text, but I couldn't... However, I've put an imagebutton that copy to the clipboard the text in a variable so, when a screen shows that codes or phrases, I assign that string to the variable and the user can copy it.
Code: Select all
init python:
import pygame.scrap
def copytext(t):
pygame.scrap.put(pygame.scrap.SCRAP_TEXT, t.encode("utf-8"))
if pygame.scrap.contains(pygame.scrap.SCRAP_TEXT):
renpy.notify("Se ha copiado el texto en el portapapeles.")
def name_func(newstring):
store.name_slot = newstring
screen pop:
[...]
hbox xsize 200 xpos 1.0 xoffset -200 yalign 0.0 yoffset 10:
imagebutton idle "gui/icon_clipboard.png" hover "gui/icon_clipboard_hover.png" action Function(copytext, t=txt)
[...]
4) I've decided no to do this.
5) Thank you for the answer rames44.