Change choice menu box after being selected

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
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Change choice menu box after being selected

#1 Post by CalixtheGreat »

First of all, sorry if some of my grammars are wrong. My english sucks. Haha.

Is there a way to change the choice menu box when that choice is already selected? Just like in Ace Attorney. When a specific choice is selected, a checkmark will be added beside that choice to let the players know that, that choice is already selected.
Image
FB PAGE:
CALIX THE GREAT

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Change choice menu box after being selected

#2 Post by Andredron »

The easiest way is to set the values ​​of the variable, if $ beerka == 0, there will be 1 button theme, when you click add the value 1 to the variable, we get $ beerka == 1 there will be another button theme. Do you know how to assign values ​​to a variable in buttons? (I clarify)

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Change choice menu box after being selected

#3 Post by Andredron »

Forgot to add, in persistent variables, prescribe

User avatar
CalixtheGreat
Regular
Posts: 72
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Change choice menu box after being selected

#4 Post by CalixtheGreat »

Andredron wrote: Thu Feb 15, 2018 12:50 am The easiest way is to set the values ​​of the variable, if $ beerka == 0, there will be 1 button theme, when you click add the value 1 to the variable, we get $ beerka == 1 there will be another button theme. Do you know how to assign values ​​to a variable in buttons? (I clarify)
Sorry if this is a dumb question but, I don't have any idea on how to implement two themes of choice box.
Image
FB PAGE:
CALIX THE GREAT

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Change choice menu box after being selected

#5 Post by Andredron »

CalixtheGreat wrote: Thu Feb 15, 2018 7:08 am
Andredron wrote: Thu Feb 15, 2018 12:50 am The easiest way is to set the values ​​of the variable, if $ beerka == 0, there will be 1 button theme, when you click add the value 1 to the variable, we get $ beerka == 1 there will be another button theme. Do you know how to assign values ​​to a variable in buttons? (I clarify)
Sorry if this is a dumb question but, I don't have any idea on how to implement two themes of choice box.

special for preschool children who do not know about Google:
1) variable-an empty plate, in which you can put the cutlets, you can call it and say that it is empty, it zero cutlets:
$ kotletki = 0
2) the operator of assignment (sign"=") - we put the right amount of cutlets in a bowl, for example, just 2 pieces:
$ kotletki = 2
3) operator increment (variable increase, the sign"+") - add to the plate the desired number of cutlets. for example, to two in a plate add another:
$ kotletki = kotletki + 1 # total their in plate now 3!
4) decrement (subtraction), read the previous paragraph. eat one cutlet:
$ kotletki = kotletki-1
5) condition - can be true or incorrect - "1==2" - because 1 is not equal to 2, the result will be a lie. "1 == 1" - because 1 is 1, the result is true. if you have your plate 2 cakes, and you'll tell the teacher that ate everything, you lie. "2 == 0" is a lie. "kotletki == 0" is a lie, because we have two cutlets left after eating one of the three. comparison operators are different, not only "equal" -"==", but also "unequal" -"!=", more, less, etc.
6) conditional statement - if is our educator who checks if you tell him the truth or lie. and accordingly reacts on your statements.
else: otherwise. the block after this statement is executed if the statement in the if statement is false. for kindergarten will be difficult. let me explain by example.
if you came to the teacher with an empty plate and said that it was empty (if really kotletki == 0), then you told the truth, all ate and generally well done! you can go play.
if you said that you ate "skazal == 0", and the cutlet is greater than 0 (kotletki > 0), i.e. you did not eat everything, then you have to put in a corner for lying, then the block" else: "(otherwise) works.
example:
if kotletki == 0:
....jump igrushki
else:
....jump ugol
7) the choice whether to eat burgers
$ kotletki = 1
# one left
menu:
...."no, not go":
........pass # do nothing, skip the selection unit
...."okay, finish and last":
........$ kotletki = kotletki-1
8) choosing what to say to the teacher after lunch
menu:
...."I ate it all!":
........$ skazal = 0
........pass
...."One chicken left. Never at a loss already":
........$ skazal = 1
9) and now programmable reaction of a caregiver
# if I said that everyone ate, we move on to the block where 0 is discussed cutlets
if skazal == 0:
....jump label 0
# otherwise, if there was no transition, the program will continue to run further
#f next we discuss 1 cutlet
if kotletki > 0:
...."boy, that is not lying. but the meatballs need to finish"
....jump start # starts all over again (instead of one of the endings)
else:
...."but you ate all the cutlets. why lie? boy, you moron? go to the doctor, check it out."
....jump doctor
# and here we discuss zero cutlets
label label0:
if kotletki == 0:
...."said he ate, really ate. muzhik! go ahead and play.":
....jump igrushki
else:
...."you said I ate, and then there are burgers! into a corner!"
....jump ugol
10) forks and variables, you can do all you want, and checks too. in short, sculpt so many endings, how many leftist heel pleases.
if after this you do not understand the basics of programming, then I highly recommend you go to the neighbor

More details I wrote in his textbook(written in Russian and has yet to be written)
https://yadi.sk/i/ps3F6blo3PZdRc

And now your case, that would you not be confused I write simple code.

init python:

# список возможных цветов

# (вместо цветов могут быть картинки фонов для кнопок)

# эти цвета для темной темы colorblind

....colors = ["#848", "#844", "#484", "#448"]

# поменять цвета или фоны кнопок главного меню

....def newcolors(index=-1):

........if index < 0 or index >= len(colors):

............color = renpy.random.choice(colors)

........else:

............color = colors[index]

....style.mm_button.background = color

....style.mm_button.hover_background = "#884"

....insensitive_background = "#444"

....style.rebuild()

....NewColors = renpy.curry(newcolors)

....# теперь это можно привязать к любой кнопке

....# textbutton _("Сменить цвета") action NewColors()

# или запускать при каждом запуске: newcolors()

label start:

....menu:

........"Можно даже так выбрать цвет..."

........"Цвет 1":

...........$ newcolors(0)

........"Цвет 2":

...........$ newcolors(1)

........"Цвет 3":

...........$ newcolors(2)

........."Цвет 4":

...........$ newcolors(3)

........."Случайный":

............$ newcolors()

....return


I'm sorry rush, you this example is altered to make for persistent variables

Post Reply

Who is online

Users browsing this forum: Google [Bot]