# Dear Irony please fallback to simple parser

# Toggled code script
# Includes a generic code block if the toggle value is NOT zero

inline_script = {
    script = merger_of_rules/parts/switch
    file = merger_of_rules/parts/toggled_code_case_

    # this is equal to ceil( x^2 / (x^2+1) ), which returns 0 for a 0 input and 1 for anything else
    # used to choose between toggled_code_case_0 (empty) and
    # toggled_code_case_1 (returns the passed code) to omit the entire block if count is 0
    value = @[ (-1 * ((-1 * (($toggle$*$toggle$) / (($toggle$*$toggle$)+1))) - ((((-1 * (($toggle$*$toggle$) / (($toggle$*$toggle$)+1))) % 1) + 1) % 1))) ]

    params = "code = \"$code$\"" # this is fine don't worry about it :)
}

# example use:

# inline_script = {
#   script = merger_of_rules/toggled_code
#   code = "
#       # code here will only be included if the toggle value below is != 0
#   "
#   toggle = @some_mod_presence_scripted_variable
# }

# to AND two values:
# toggle = @[ variable_1 * variable_2 ]
# to OR two values, assuming they're 0/1, negatives would potentially break this, but we recommend a 1 for flag variables:
# toggle = @[ variable_1 + variable_2 ]
