First of all, sorry if I have the terminologies wrong and I don't mind being corrected.
This may be a very simple thing to solve, but I don't have 200 IQ.
I am stuck on how to utilize an "action" to edit a "variable". I think the correct thing to call it is a dictionary key?
What I am attempting to achieve is to increase / decrease the value of a dictionary key called "Foreplay" in mc.sex_skills by left click and right clicking a textbutton.
This is how MC is setup by the game creator in script.rpy.
To edit other variables, e.g stamina, arousal, intelligence I do the following:
SetField works fine for normal variables, but sex_skills seems to be a list or dictionary? And I can't get it to set the values by using actions.
i've been trying SetField, SetVariable and SetDict, but I can't get it to work.
What I want the outcome to be is the same as when I use SetField, but replace SetField with whatever is necessary for it to work (e.g SetVariable, SetDict or anything else I am unaware of).
When it comes to SetDict I'm thinking it should be something like:
Thanks for any help, and do ask questions if it's unclear.
A possible workaround would be to Call a label that takes care of it using $ mc.sex_skills["Foreplay"] += 1, but I would have to make a new label for every skill, so I would prefer understanding how this works instead.
This may be a very simple thing to solve, but I don't have 200 IQ.
I am stuck on how to utilize an "action" to edit a "variable". I think the correct thing to call it is a dictionary key?
What I am attempting to achieve is to increase / decrease the value of a dictionary key called "Foreplay" in mc.sex_skills by left click and right clicking a textbutton.
This is how MC is setup by the game creator in script.rpy.
Code:
## shortname for class is mc
class MainCharacter(renpy.store.object):
def __init__(self, location, name, last_name, business, stat_array, skill_array, sex_array):
# [...] variables
##Sex Skills##
# These skill represent your knowledge and experience with different types of intimacy. Useful for raising a girls arousal faster than your own.
self.sex_skills = {}
self.sex_skills["Foreplay"] = sex_array[0] # A catch all for everything that goes on before blowjobs, sex, etc. Includes things like kissing, massages, etc.
self.sex_skills["Oral"] = sex_array[1] # Your skill at eating a girl out.
self.sex_skills["Vaginal"] = sex_array[2] # Your skill at different positions that involve vaginal sex.
self.sex_skills["Anal"] = sex_array[3] # Your skill skill at different positions that involve anal sex.
Code:
vbox:
textbutton "Main Stats" action NullAction() style "cheatbutton_style" text_style "textbutton_text_style" xsize 220 # Handles the player's main stats
textbutton "Charisma: [mc.charisma]" action SetField(mc,"charisma", mc.charisma + 1) alternate SetField(mc,"charisma", mc.charisma - 1) style "cheatbutton_style" text_style "cheattext_style" xsize 220
textbutton "Intelligence: [mc.int]" action SetField(mc,"int", mc.int + 1) alternate SetField(mc,"int", mc.int - 1) style "cheatbutton_style" text_style "cheattext_style" xsize 220
textbutton "Focus: [mc.focus]" action SetField(mc,"focus", mc.focus + 1) alternate SetField(mc,"focus", mc.focus - 1) style "cheatbutton_style" text_style "cheattext_style" xsize 220
textbutton "Stamina: [mc.current_stamina]" action [SetField(mc,"max_stamina", mc.max_stamina + 1), SetField(mc,"current_stamina", mc.max_stamina + 1)] alternate [SetField(mc,"max_stamina", mc.max_stamina - 1), SetField(mc,"current_stamina", mc.max_stamina - 1)] style "cheatbutton_style" text_style "cheattext_style" xsize 220 # Updates the current stamina to match the maximum stamina that the player has.
i've been trying SetField, SetVariable and SetDict, but I can't get it to work.
What I want the outcome to be is the same as when I use SetField, but replace SetField with whatever is necessary for it to work (e.g SetVariable, SetDict or anything else I am unaware of).
When it comes to SetDict I'm thinking it should be something like:
Code:
action SetDict (mc.sex_skills, Foreplay, +1)
#or
action SetDict (mc.sex_skills, ["Foreplay"], +1)
# I want the value it increases / decreases by to be +1 or -1 of whatever "Foreplay" currently is at
# +=1 or mc.sex_skills["Foreplay"] +=1, but I can't get it to work.
A possible workaround would be to Call a label that takes care of it using $ mc.sex_skills["Foreplay"] += 1, but I would have to make a new label for every skill, so I would prefer understanding how this works instead.