Files
IWaniHugThatGator-Demo-Public/game/utility.rpy
2024-03-06 19:57:33 -06:00

71 lines
2.1 KiB
Plaintext

## Utility functions for game setup, debugging etc.
init python:
import time
import hashlib
from os import path
## Keeps track of what the player's seen in wani.
waniWhatSeen = MultiPersistent("hugthegator.xyz")
waniDemoCarryover = MultiPersistent("hugthegator.xyz")
def monitor_story_variables(toggle=True):
var_list = [
"score_inco",
"score_olivia",
"ben_story",
"ending",
"score_inco_support"
]
for item in var_list:
if toggle:
renpy.watch(item)
else:
renpy.unwatch(item)
#This segment onward lets the player pick whichever item Olivia has in her lockbox, and ends when the player has exhausted all available options
def kill_choices(key):
global olivia_chest_choices_flag
# if (key is not None):
# oliviachest_choices.remove(key)
olivia_chest_choices_flag |= olivia_chest_choices[key]
renpy.jump("olivia_chest") #could simplifiy&glue kill_choices & olivia_chest but can't be bothered and/or not a big deal
label initstats(inco=0, olivia=0, benstory=False):
# Sets various game-related global variables
# :param int: Inco's score
# :param int: Olivia's score
$ score_inco = inco
$ score_olivia = olivia
$ ben_story = benstory
$ ending = None
$ score_inco_support = False
python:
from enum import Enum
global drawings_seed
drawings_seed = time.time_ns() #timestamp
persistent.drawn = 0
if persistent.enable_debug_scores:
$ monitor_story_variables(False)
$ monitor_story_variables(True)
return
label get_ending:
# To check what ending we're getting, call this label and then check the value of _return
# Sensible to have this logic defined in only one place for consistency
if (score_inco <= 2 and score_olivia <= 2):
return(1)
elif (score_olivia <= 3 and score_inco >= 3):
return(3)
elif (score_olivia >= 4 and score_inco >= 4):
if ben_story:
return(4)
else:
return(3)
else:
return(2)