screen:
.#for each button
if full version:
use full button
else
use disabled button
action
and the disabled button uses a different picture (maybe gray?) and uses action NullAction()
and so it does nothing - while at the same time behaving like a normal button.patreon
status flag.menu:
choice?{image=filename}
tag within the text. Same way you'd use {b} {/b}
for bold or {i} {/i}
for italics.label start:
scene black with fade
menu:
"{image=analfuck_icon.png} ANAL FUCK"
jump ch02_anal_fuck
"{image=pussyfuck_icon.png} PUSSY FUCK"
jump ch02_pussy_fuck
# etc.
label start:
scene black with fade
menu:
"{image=analfuck_icon.png} ANAL FUCK":
jump ch02_anal_fuck
"{image=pussyfuck_icon.png} PUSSY FUCK":
jump ch02_pussy_fuck
"{image=blowjob_icon.png} BLOWJOB":
jump ch02_blowjob
"{image=thighfuck_icon.png} THIGH FUCK" if patreon_version == True:
jump ch02_thigh_fuck
"{image=thighfuck_icon.png} THIGH FUCK {image=patreon_icon.png}" if patreon_version == False:
jump ch02_thigh_fuck_not_available
"{image=footjob_icon.png} FOOTJOB" if patreon_version == True:
jump ch02_footjob
"{image=footjob_icon.png} FOOTJOB {image=patreon_icon.png}" if patreon_version == False:
jump ch02_footjob_not_available
# --- file screens.rpy ---
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
if i.action:
if i.kwargs and i.kwargs.get( "enabled" ) is False:
textbutton i.caption action NullAction() sensitive False
else:
textbutton i.caption action i.action
else:
textbutton i.caption
label start:
scene black with fade
menu:
"{image=analfuck_icon.png} ANAL FUCK":
jump ch02_anal_fuck
"{image=pussyfuck_icon.png} PUSSY FUCK":
jump ch02_pussy_fuck
"{image=blowjob_icon.png} BLOWJOB":
jump ch02_blowjob
"{image=thighfuck_icon.png} THIGH FUCK" (enabled=patreon_version):
jump ch02_thigh_fuck
"{image=footjob_icon.png} FOOTJOB" (enabled=patreon_version):
jump ch02_footjob
patreon_version
is set to True
- then that's effectively the same as (enabled=True)
. Likewise False
. When the menu choice is disabled, it uses a different style
- which can be recolored or styled however you like.Thank you very much!!Keep in mind, this is RenPy... so pretty much anything is possible.
And yes, the original you are looking at is using a custom screen and only images. No text and no menus. (But keep in mind that menus are just screens too).
I would code a custom screen too.
But if you do still want to consider using menus...
Last time we played with something like this, we ended up with this:
Python:# --- file screens.rpy --- screen choice(items): style_prefix "choice" vbox: for i in items: if i.action: if i.kwargs and i.kwargs.get( "enabled" ) is False: textbutton i.caption action NullAction() sensitive False else: textbutton i.caption action i.action else: textbutton i.caption
By altering the menu/choices screen this way... you will then be able to code something like:
Python:label start: scene black with fade menu: "{image=analfuck_icon.png} ANAL FUCK": jump ch02_anal_fuck "{image=pussyfuck_icon.png} PUSSY FUCK": jump ch02_pussy_fuck "{image=blowjob_icon.png} BLOWJOB": jump ch02_blowjob "{image=thighfuck_icon.png} THIGH FUCK" (enabled=patreon_version): jump ch02_thigh_fuck "{image=footjob_icon.png} FOOTJOB" (enabled=patreon_version): jump ch02_footjob
The ability to add parameters to the menu choices wasn't always part of RenPy. But it exists now, so can be used to pass information by putting it within parenthesis before the colon.
Hmm, I guess I was the one coming to this solution because I see a flaw in itPython:if i.kwargs and i.kwargs.get( "enabled" ) is False:
i.kwargs
exist ; when the "enabled" optional argument is given. But if you extend the use of i.kwargs
, defining more optional arguments, then you'll trigger a KeyError exception every time the kwargs exist, but not the "enabled" key.get
should be used in its get( Key, Default )
extended syntax. The second value being the one returned if the keyword isn't in the dictionary ; what prevent the KeyError exception.True
as default value, what lead to i.kwargs.get( "enabled", True )
.None
is to avoid, since some would want to reduce the condition to if ikwargs and i.kwargs.get( "enabled", None ):
, that would match both False
and None
.Hmm, I guess I was the one coming to this solution [...]
Since a choice that don't have the "enabled" optional argument is to be shown normally, I would use True as default value, what lead to i.kwargs.get( "enabled", True ).
Anyway, the use of None is to avoid, since some would want to reduce the condition to if ikwargs and i.kwargs.get( "enabled", None ):, that would match both False and None.
It's not too difficult. It's just an extension of the anonymous parameters/arguments already used with functions/methods ; namedYup. That's all you. I barely understand how it works
args
(as in "arguments") and kwargs
(as in "keyword arguments") by convention.def myFunction( text, enabled=True ):
.myFunction( "choice 1", enabled=False )
will assign choice 1
to the variable named text, and the value False
to the variable named enabled.def myFunction( text, enabled=False ):
if enabled is True:
renpy.notify( text )
def myFunction( text, enabled=True, hint="No hint" ):
; if you don't do it, Ren'py/Python will complain that there's too many arguments.def myAnonFunction( *args, **kwargs ):
. All the "regular arguments" will be stored into a list named args
, in their order or appearance, while all the "keyword arguments" will be stored into a dict named kwargs
. You call the function in the exact same way, but now the code of your function would looks like that:def myAnonFunction( *args, **kwargs ):
if "enabled" in kwargs and kwargs["enabled"] is True:
renpy.notify( args[0] )
Character
object, where you can redefine part of the "say" style when you create the object. It would be a pain in the ass to declare a parameter/argument for "who_color", "who_size", "what_color", "what_size", and all the other possibilities. Instead, the class __int__
method is declared with :def __init__( self, name=NotSet, kind=None, **properties):
; note that, as I said, args
and kwargs
are just convention, you can use more explicit names, like it's the case here.menu
syntax should be seen as (with bracket marking the "optionality":menu [label][(named_parameters)]:
choice [(*args, **kwargs)][condition]:
statements
i
in your example) is used to carry the args
list and kwargs
dict. This exactly like it already carry the text of the choice in text
, and what have to be done if the choice is selected in action
.Avoid this.Are you saying "avoid this" or "this would be better"?
is True
/is False
part. It's bad, but not totally wrong.False
and None
:label whatever:
$ myVar = False
if not myVar:
"myVar value is False"
$ myVar = None
if not myVar:
"myVar value is... er, False ?"