[ONGOING] Interface woes

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
JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

[ONGOING] Interface woes

#1 Post by JinzouTamashii »

Basically, I want to do this.

A picture should be good enough to show what I'm visualizing.

example.GIF
example.GIF (7.3 KiB) Viewed 988 times
Last edited by JinzouTamashii on Sat Oct 03, 2009 2:55 pm, edited 2 times in total.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

rimir
Regular
Posts: 52
Joined: Mon Jul 06, 2009 12:30 pm
Projects: Only test projects
Contact:

Re: Text window at top of screen and centered text (in window)

#2 Post by rimir »

*ve-ery tired after re-ally long day so forgive if post not helpful*

For the textbox...
You can create a custom textbox and place it at the top.(There's a thread here somewhere that tells you how to do ; search for it.For placing it at top I think you should check the documentation for displayables)

You'll also need to hide the default textbox.(I don't know how to do that ;ask around the forum)

For centering...you could write a custom function that calculates the length of the string in question and appends the appropriate number of blanks at the front and then returns as string.
I don't know if there's a more elegant way (though there probably should be ; again ask around the forums)

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Text window at top of screen and centered text (in window)

#3 Post by Aleema »

There's a default character called "centered" that you can use.

Code: Select all

centered "This text is in the middle of the screen."
You can also define your own character and customize the style so that it does whatever you want.

You can rearrange the main text window by fiddling with the style's properties (style.window).
Some of properties are already in your options.rpy file.

I don't have Ren'Py in front of me, but you can try adding this line to options.rpy:

Code: Select all

style.window.yalign = 0.0
And if that doesn't work, try messing with the window's margins.

Keep in mind that if you have the character names above the text box, you'll either bounce up and down when the narrator speaks, or you'll have a margin of blank space to accomadate it.

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Various interface woes

#4 Post by JinzouTamashii »

Alright, well I've almost given up having a frame at the top. I had to turn off two windows anyway, since it was just making a mini version of the big frame and I don't know how to make it stop doing that.

Code: Select all

label loadmessages:
$ show_button_game_menu = False
$ ui.image(Solid('#000'))
$ loadmessage = renpy.random.choice(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'])
Also, I used $ show_button_game_menu = False when I want the button menu to disappear and long story short ... it's not happening. Is there another way to hide the entire UI?
sum1.PNG
I sort of got my game menu buttons working. But my "Auto" read toggle button just flat out breaks when I click it and gives a bizarre error message.
sum2.PNG
error.PNG
code.PNG

Code: Select all

init:
    
    $ autoread = True
    
    #$ style.window.right_margin = 100

    python:

        def toggle_skipping():
            config.skipping = not config.skipping
            
        def button_game_menu():

            # to save typing
            ccinc = renpy.curried_call_in_new_context

            ui.vbox(xpos=0.98, ypos=0.93, xanchor='right', yanchor='bottom')
            ui.textbutton("Skip", clicked=toggle_skipping)
            ui.textbutton("Save", clicked=ccinc("_game_menu_save"))
            ui.textbutton("Load", clicked=ccinc("_game_menu_load"))
            ui.textbutton("Menu", clicked=ccinc("_game_menu_preferences"))
            ui.close()

        config.overlay_functions.append(button_game_menu)
        
        afmbutton = True 
        #or False depending on your decision

        def afmbutton():
            if afmbutton:
                ui.vbox(xpos=0.98, ypos=0.98, xanchor='right', yanchor='bottom')
                ui.textbutton("Auto", clicked=toggle_autoread, xminimum=80)
                ui.close()
        
        def toggle_autoread():
            if autoread:
                autoread = False
                _preferences.afm_time = 0
            if not autoread:
                autoread = True
                _preferences.afm_time = 10
        
        config.overlay_functions.append(afmbutton)

I also found the code for making an image button but I don't know how to use that with the frame set-up I've already got ... basically, this is the first time I've ever tried to program User Interface functions and I'm flabbergasted. Maybe I should ask for a one-off programmer in the GameMaker forums...
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Various interface woes

#5 Post by JQuartz »

JinzouTamashii wrote:I had to turn off two windows anyway, since it was just making a mini version of the big frame and I don't know how to make it stop doing that.
Use show_who_window_properties like so:

Code: Select all

init:
    $ J =Character("JinzouTamashii", show_two_window=True,show_who_window_properties={ "background" :  "JinzouTamashii.png" } )
JinzouTamashii wrote:I used $ show_button_game_menu = False when I want the button menu to disappear and long story short ... it's not happening. Is there another way to hide the entire UI?
You need to put if in your overlay like so:

Code: Select all

init:
    python:
        def button_game_menu():

            # to save typing
            ccinc = ui.callsinnewcontext
            if show_button_game_menu:
                ui.vbox(xpos=0.98, ypos=0.93, xanchor='right', yanchor='bottom')
                ui.textbutton("Skip", clicked=toggle_skipping)
                ui.textbutton("Save", clicked=ccinc("_game_menu_save"))
                ui.textbutton("Load", clicked=ccinc("_game_menu_load"))
                ui.textbutton("Menu", clicked=ccinc("_game_menu_preferences"))
                ui.close()

        config.overlay_functions.append(button_game_menu)
JinzouTamashii wrote:But my "Auto" read toggle button just flat out breaks when I click it and gives a bizarre error message.
You need to use global for the autoread variable. Also you need to use elif instead of if for the second choice otherwise it'll always be True:

Code: Select all

init python:
    def toggle_autoread():
        global autoread
        if autoread:
            autoread = False
            _preferences.afm_time = 0
        elif not autoread:
            autoread = True
            _preferences.afm_time = 10
   
    config.overlay_functions.append(afmbutton)
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Various interface woes

#6 Post by JinzouTamashii »

(*´ο`*)=3 That did not work as anticipated ... .

[/edit] I fixed it by declaring

Code: Select all

$ show_button_game_menu = False
$ afmbutton = False
and
$ show_button_game_menu = True
$ afmbutton = True
I declared:

Code: Select all

$ show_button_game_menu = True

   python:

        def toggle_skipping():
            config.skipping = not config.skipping
            
        def button_game_menu():

            # to save typing
            ccinc = renpy.curried_call_in_new_context
            if show_button_game_menu:
                ui.vbox(xpos=0.98, ypos=0.93, xanchor='right', yanchor='bottom')
                ui.textbutton("Skip", clicked=toggle_skipping)
                ui.textbutton("Save", clicked=ccinc("_game_menu_save"))
                ui.textbutton("Load", clicked=ccinc("_game_menu_load"))
                ui.textbutton("Menu", clicked=ccinc("_game_menu_preferences"))
                ui.close()
This is what I got:
error1.GIF
Basically, it still shows up without even a minor change.

The menu also does not come back, even though I declare it below ...
error2.PNG
As for the two window say, it is applying my margin tweakings to get my frame working to the namebox as well. Is there some way to disable it for the child window? ☆⌒(>。≪)
error3.PNG
[/edit] I fixed this with this sort of code:

Code: Select all

    #namebox
    style.say_who_window.bottom_margin = 0
    style.say_who_window.left_padding = 20
    style.say_who_window.right_padding = 20
    style.say_who_window.top_padding = 15
    style.say_who_window.yminimum = 60
    style.say_who_window.xminimum = 300
    style.say_who_window.left_margin = 10
Last edited by JinzouTamashii on Sat Oct 03, 2009 4:58 pm, edited 5 times in total.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Various interface woes

#7 Post by JinzouTamashii »

Additionally, playing through, sometimes the textbox dissolves in and out but the game button menu just shows up with None. Is there some way to make it mimic the behavior of the textbox?

I also get this error now when I close the game out.

Code: Select all

Exception in thread Thread-2:
Traceback (most recent call last):
  File "threading.pyo", line 460, in __bootstrap
  File "threading.pyo", line 440, in run
  File "O:\Renpy\renpy\loadsave.py", line 313, in autosave_thread
  File "O:\Renpy\renpy\loadsave.py", line 154, in save
  File "O:\Renpy\renpy\loadsave.py", line 45, in dump
PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
error.PNG
error.PNG (7.81 KiB) Viewed 1376 times
I guess I could always ask for a bandage solution from PyTom to hexedit it to read "Thanks for playing!" but ...
Back on Wing Commander 1 we were getting an exception from our EMM386 memory manager when we exited the game. We'd clear the screen and a single line would print out, something like "EMM386 Memory manager error. Blah blah blah." We had to ship ASAP. So I hex edited the error in the memory manager itself to read "Thank you for playing Wing Commander."
I don't know what to do with it, but it's only begun since I started turning the button game menu on and off.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: [ONGOING] Interface woes

#8 Post by JQuartz »

JinzouTamashii wrote:Basically, it still shows up without even a minor change.
Setting show_button_game_menu = False hides the menu, while show_button_game_menu = True shows it. Since you set show_button_game_menu = True, it'll show the menu.
JinzouTamashii wrote:The menu also does not come back, even though I declare it below ...
Set show_button_game_menu = True like so:

Code: Select all

label start:
    $ show_button_game_menu=False
    centered "An external thought intrudes---"
    $ show_button_game_menu=True
    "The amnesiac Departed milled around the Nexus aimlessly..."
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: [ONGOING] Interface woes

#9 Post by JinzouTamashii »

Yeah, I was in the chat with everyone and renpytom and I fixed it. I just don't know what's going on with renpy.exe.log crashing upon exit, whatever it is... my game compiles, but will crash if you hit "X".

Bizarre.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: [ONGOING] Interface woes

#10 Post by JinzouTamashii »

Sum of the Parts also crashes when I attempt to load or save a game.

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed

While running game code:
 - script at line 25 of E:\Renpy\SumoftheParts/game/1stcomplex.rpy
 - script at line 195 of C:\Program Files\Common Files\data\Renpy/common/_layout/scrolling_load_save.rpym

-- Full Traceback ------------------------------------------------------------

  File "E:\Renpy\renpy\bootstrap.py", line 260, in bootstrap
  File "E:\Renpy\renpy\main.py", line 308, in main
  File "E:\Renpy\renpy\main.py", line 92, in run
  File "E:\Renpy\renpy\execution.py", line 230, in run
  File "E:\Renpy\renpy\ast.py", line 341, in execute
  File "E:\Renpy\renpy\exports.py", line 507, in say
  File "E:\Renpy\renpy\character.py", line 546, in __call__
  File "E:\Renpy\renpy\character.py", line 505, in do_display
  File "E:\Renpy\renpy\character.py", line 320, in display_say
  File "E:\Renpy\renpy\ui.py", line 69, in interact
  File "E:\Renpy\renpy\display\core.py", line 1364, in interact
  File "E:\Renpy\renpy\display\core.py", line 1858, in interact_core
  File "E:\Renpy\renpy\display\layout.py", line 628, in event
  File "E:\Renpy\renpy\display\layout.py", line 628, in event
  File "E:\Renpy\renpy\display\layout.py", line 628, in event
  File "E:\Renpy\renpy\display\layout.py", line 628, in event
  File "E:\Renpy\renpy\display\behavior.py", line 430, in event
  File "E:\Renpy\renpy\curry.py", line 38, in __call__
  File "E:\Renpy\renpy\game.py", line 285, in call_in_new_context
  File "E:\Renpy\renpy\execution.py", line 230, in run
  File "E:\Renpy\renpy\ast.py", line 558, in execute
  File "E:\Renpy\renpy\python.py", line 921, in py_exec_bytecode
  File "C:\Program Files\Common Files\data\Renpy/common/_layout/scrolling_load_save.rpym", line 203, in <module>
  File "E:\Renpy\renpy\loadsave.py", line 154, in save
  File "E:\Renpy\renpy\loadsave.py", line 45, in dump
PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed

While running game code:
 - script at line 25 of E:\Renpy\SumoftheParts/game/1stcomplex.rpy
 - script at line 195 of C:\Program Files\Common Files\data\Renpy/common/_layout/scrolling_load_save.rpym

Ren'Py Version: Ren'Py 6.9.3c

I am certain that it has to do with the game menu buttons somehow ... but I can't figure out where the problem lies ...
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Post Reply

Who is online

Users browsing this forum: No registered users