How to modify screens keyboard focus behaviour?

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
sapiboonggames
Veteran
Posts: 298
Joined: Thu Jan 05, 2012 8:53 am
Completed: I Love You, Brother [BxB]
Contact:

How to modify screens keyboard focus behaviour?

#1 Post by sapiboonggames » Mon Jun 29, 2020 6:00 am

Hello there, I'm back with another question. Please bear with me :D

I'm making a turn-based RPG battle and the system itself works fine, however, the keyboard focus is a bit of a mess.

The battle commands are inside a vbox, which are: "Skills", "Guard", "Items", and "Escape". When arrow_down keyboard is pressed, from "Skills" textbutton it directly jumps to "Items" button.

So, the code is below:

Code: Select all

fixed:
        at battlescreendissolve(0.5)
        
        ### MAIN COMMAND ###
        frame:
            xpos 101 ypos 200
            
            background "battle/battlecommand_bg.png"
            xysize (301, 328)
            
            text "COMMANDS"
            
            vbox:
                xpos - 10
                yalign 0.2
                
                spacing - 10
                
                textbutton "Skills" style "battlecommandbutton_bg" text_style "battlecommandbutton_text" action SetVariable("selected_battle_command", "skills")
                textbutton "Guard" style "battlecommandbutton_bg" text_style "battlecommandbutton_text" action [SetVariable("selected_playeraction", playerskill_guard), Return()]
                textbutton "Items" style "battlecommandbutton_bg" text_style "battlecommandbutton_text" action SetVariable("selected_battle_command", "items")
                textbutton "Escape" style "battlecommandbutton_bg" text_style "battlecommandbutton_text" action [SetVariable("selected_playeraction", playerskill_escape), Return()]
        
        if selected_battle_command == "skills":
            use battle_command_skills
        if selected_battle_command == "items":
            use battle_command_items
So, the question is... How do I manually set the order of keyboard focus? (is that possible?)

Thank you for the help in advance!
Visit my website: http://www.sapiboong.com

Post Reply

Who is online

Users browsing this forum: Google [Bot]