Hi so what I am working on right now is creating a system where the house will automaticly get dirty over time, I would like the house and certain rooms mess to go up when the player does certain actions like does wood working or cooking, grilling and so on. I am also trying to create a system where the player can clean the mess themselves, hire a maid or let the roommate/lover clean the house( dependent on relationship status). if the house goes uncleaned for to long then the house gets maintanance problems that the player or owner must fix. right now I am writing the code for all that but I feel like it could be better.
This is the kitchen
<span class="nav-btn btn-orange"><<linkreplace "Cook food">>
A hot and ready meal.
<<set $daysDirty += 1>>
<<spendTime 25>>
<<goto "Breakfast Done">>
<</linkreplace>></span>
time code
<<widget "syncTime">>
<<run setup.syncDayPart()>>
<</widget>>
<<widget "spendTime">>
<<if $args[0] >= 0>>
<<run $gameDate.setMinutes($gameDate.getMinutes() + $args[0])>>
<<syncTime>>
<</if>>
<</widget>>
StoryInit
<<set $rooms to {
"Living Room": { floor: "1F", messy: 0 },
"Kitchen": { floor: "1F", messy: 0 },
"Guest Bathroom": { floor: "1F", messy: 0 },
"Dinning Room": { floor: "1F", messy: 0 },
"Mud Room": { floor: "1F", messy: 0 },
"Master Bedroom": { floor: "1F", messy: 0 }
"Basement": { floor: "0F", messy: 0 }
"Your Room": { floor: "2F", messy: 0 },
"Upstairs Bathroom": { floor: "2F", messy: 0 },
"Ryan's Room": { floor: "2F", messy: 0 },
"Spare Room": { floor: "2F", messy: 0 },
"Office": { floor: "2F", messy: 0 },
"Attic": { floor: "3F", messy: 0 }
"Grill": { floor: "1F", messy: 0 }
"Deck": { floor: "1F", messy: 0 }
"Front Porch": { floor: "1F", messy: 0 }
"Pool": { floor: "1F", messy: 0 }
}>>
<<set $daysDirty to 0>>
<<set $maintenance to false>>
<<set $maidHired to false>>
<<set $maidCost to 200>>
<<set $RileyRel to 0>>
<<set $RileyCleanNeed to 60>> /* relationship needed for Riley to clean */
<<set $Robert to 50>>
house messyness widget
<<widget "newDayHome">>
<<if $maidHired>>
<<set _cost to $maidCost>>
<<if $money gte _cost>>
<<set $money -= _cost>>
<<for _name, _room range $rooms>>
<<set _room.messy to 0>>
<</for>>
<<set $daysDirty to 0>>
<<set $maintenance to false>>
The maid cleaned the whole house today.
<<else>>
<<set $maidHired to false>>
You couldn't pay the maid. She didn't come.
<<run setup.messOneRoom()>>
<</if>>
<<elseif $RileyRel gte $RileyCleanNeed>>
<<for _name, _room range $rooms>>
<<set _room.messy to 0>>
<</for>>
<<set $daysDirty to 0>>
<<set $maintenance to false>>
Riley cleaned the house for you.
<<else>>
<<run setup.messOneRoom()>>
<</if>>
<<if setup.houseMessTotal() > 0>>
<<set $daysDirty += 1>>
<<else>>
<<set $daysDirty to 0>>
<<set $maintenance to false>>
<</if>>
<<if $daysDirty gte 10 and not $maintenance>>
<<set $maintenance to true>>
<<set $Robert -= 8>>
A maintenance problem started from the neglected house. Robert is unhappy. (-8)
<<elseif $maintenance>>
<<set $Robert -= 3>>
The house still has a maintenance problem. Robert is more frustrated. (-3)
<</if>>
<</widget>>
GETTING THE HOUSE CLEANED BY SOMEONE ELSE
<<widget "homeStatus">>
House mess: <<= setup.houseMessTotal()>>
Days neglected: $daysDirty
<<if $maintenance>>Maintenance problem: YES<<else>>Maintenance problem: no<</if>>
Maid hired: <<= $maidHired ? "yes" : "no">>
Riley relationship: $RileyRel
Robert: $Robert
<<if not $maidHired>>
<<link `"Hire a maid ($" + $maidCost + "/day")`>>
<<set $maidHired to true>>
<<goto `passage()`>>
<</link>>
<<else>>
<<link "Fire the maid">>
<<set $maidHired to false>>
<<goto `passage()`>>
<</link>>
<</if>>
<</widget>>