So this is a super basic version of the pizza thing (not assuming you're actually doing a pizza screen but here is the concept)
So these are the default values of the variables:
Code: Select all
default pizza_size = 1
default meat_topping = 0
default extra_topping = 0
I made the pizza size 1, because we want one of the sizes to be selected already on the screen, it's a mandatory option. The other ones are at 0 because they are optional.
Then here's a really basic screen but the buttons do exactly what they should (the current value stands out):
Code: Select all
screen make_a_pizza():
frame:
xalign 0.5
yalign 0.2
vbox:
text "Pick a size!"
hbox:
textbutton "Small" action SetVariable("pizza_size",1)
textbutton "Medium" action SetVariable("pizza_size",2)
textbutton "Large" action SetVariable("pizza_size",3)
text "Pick a meat topping!"
hbox:
textbutton "Pepperoni" action SetVariable("meat_topping", 1)
textbutton "Ham" action SetVariable("meat_topping", 2)
textbutton "Sausage" action SetVariable("meat_topping", 3)
text "Extra topping"
hbox:
textbutton "Onions" action SetVariable("extra_topping", 1)
textbutton "Peppers" action SetVariable("extra_topping", 2)
textbutton "Olives" action SetVariable("extra_topping", 3)
I forgot to add an option to have no toppings but you'd just add a SetVariable("extra_topping", 0) on there.
You could take a concept like this and make it tons better. Use imagebuttons or an imagemap etc. Maybe even have a live pizza showing on the screen. Depending on what your plan is, I might already have an idea of how to achieve it.
Now for them selecting more than one thing on one variable..it would then have to turn into a list probably and have to deal with some screen variables and if statements. (I think) which, if you don't want to deal with that, each topping could be it's own variable. pepperoni = true, etc. So whenever you click on each button, it will light up even if other toppings are selected too. But you'd also have to create an if statement or something to have a second button take over if pepperoni is true, so that you can now have a button that turns it false, instead of you being forced to stick with your choice. If that makes sense