Page 1 of 1

Numerical choices in choices menu?

Posted: Wed Dec 27, 2017 6:52 am
by tohtamish
Like in rpg games - where you can press numbers on keyboard to answer. Is it possible to do someway?

Re: Numerical choices in choices menu?

Posted: Thu Dec 28, 2017 5:21 am
by philat
Choices are stored in a list (referenced as items in the choice screen). You can modify the choice screen to show numbers for each item and use the key statement (https://www.renpy.org/doc/html/screens.html#key ) to trigger choices.

Re: Numerical choices in choices menu?

Posted: Thu Dec 28, 2017 6:28 pm
by Alex
You need to modify the choice screen, smth like

Code: Select all

screen choice(items):
#    style_prefix "choice"
#
#    vbox:
#        for i in items:
#            textbutton i.caption action i.action
    style_prefix "choice"
    for n, i in enumerate(items, 1): # n would be the number starting from 1
        if n<10:
            key str(n) action i.action
        textbutton str(n) + ") " + i.caption action i.action