Thorian Studios
Newbie
- Oct 11, 2020
- 68
- 65
- 153
I'm coding a walkthrough system to use within modding. The code works within multiple games across various versions. However within Being A DiK, the code simply doesn't work. Through my debugging, my main system which uses kwargs doesn't work because the choice menu refuses to pass kwargs. When comparing it to SanchoMod's code (which uses a similar method to mine), his kwargs get passed through fine. I simply cannot get i.kwargs to pass anywhere, no matter where I move the code around or try different methods of grabbing i.kwargs. Does anyone know how to fix, or what may be causing it. It's almost impossible to draw inspiration from SanchoMod since it's so obfuscated
Edit: Added the choice menu code.This is a working format in other projects
Edit Solution:BaD has a hidden menu_override function that simply removes the ability for choice menu arguments. Simply removing it fixes the problem.
Python:
init 0:
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
$ choicecaption = i.caption
$ guidecaption = format_guide(i.kwargs)
$ finalcaption = i.caption + guidecaption
textbutton finalcaption action i.action
init -999 python:
def format_guide(kwargs):
[kwargs.pop(e,None) for e in ["decision","fixed","disabled","persist"]]
# Safely get wt and wte values with proper defaults
wtcaptions = kwargs.get("pt", [])
wtecaptions = kwargs.get("var", [])
point_filter = kwargs.get("ptf", [])
variable_filter = kwargs.get("varf", [])
# Initialize guide strings
wtguide = wtglossary = wteguide = wteglossary = ""
# Ensure lists
wtcaptions = [wtcaptions] if not isinstance(wtcaptions, (list, tuple)) else wtcaptions
wtecaptions = [wtecaptions] if not isinstance(wtecaptions, (list, tuple)) else wtecaptions
point_filter = [point_filter] if not isinstance(point_filter, (list, tuple)) else point_filter
variable_filter = [variable_filter] if not isinstance(variable_filter, (list, tuple)) else variable_filter
# Process wtcaptions
if point_filter:
for index, arg in enumerate(point_filter):
if arg is not None:
result = filter_point(arg)
if result:
wtcaptions.append(result)
if variable_filter:
for index, arg in enumerate(variable_filter):
if arg is not None:
result = filter_variable(arg)
if result:
wtecaptions.append(result)
if wtcaptions:
for index, arg in enumerate(wtcaptions):
if arg is not None: # Add null check
wtguide += point_funct(arg, change=1, is_first=(index == 0))
wtglossary += wtglosformat(arg)
# Process wtecaptions
if wtecaptions:
for index, arg in enumerate(wtecaptions):
if arg is not None: # Add null check
wteguide += variable_funct(arg, flagtype=1, is_first=(index == 0))
wteglossary += wtglosformat(arg)
guidecaption = wtguide + wteguide
return guidecaption
Code:
menu:
"Get mady"(point=('dik', 1)) if True:
mc "(You fucking cunt...)"
$ dk(1)
"Shrug it off"(point=('dik', -1)) if True:
mc "(Typical Steve...)"
$ dk(-1)
Last edited: