{<!--
Uninitialized variables default to 0.
OK, walking is step++
Running step += 2
Danger should prepare from time D0 and occur at D1.
Listening in [D0, D1] should unlock running.
27% of men, 45% of women do not feel safe.
http://www.gallup.com/poll/179558/not-feel-safe-walking-night-near-home.aspx
We'll approximate this to 25% for men and 50% for women.
2012 Population: 313,914,040; Violent crime rate per 100,000: 386.9
Therefore, ~0.004 (0.4%) chance of violent crime.
http://www.ucrdatatool.gov/Search/Crime/State/RunCrimeStatebyState.cfm
-->
(if: $initialized is 0)[
(set: $goal to 10)
(if: (random: 0, 999) < 1)[ <!-- Change to 999 -->
(set: $danger to 1)
(set: $d0 to (random: 1, $goal / 2) - 1)
(set: $d1 to (random: $d0 + 1, $goal - 2))
]
(else:)[
(set: $danger to 0)
(set: $d0 to 0)
(set: $d1 to 0)
]
(set: $sex to (either: "male", "female"))
(if: $sex is "male")[
(set: $feeling to (either: 0, 0, 0, 1))
]
(if: $sex is "female")[
(set: $feeling to (either: 0, 1))
]
(set: $heard to 0)
(set: $step to 0)
(set: $attacked to 0)
(set: $initialized to 1)
]
(if: $danger > 0 and $step >= $d1)[(set: $d1 to $d1 + 4)(set: $attacked to 1)(goto: "Fight")]
}=><=
{(if: $step is $goal)[[lock door]<actLockDoor|<br />]
(elseif: $step is $goal - 1)[[close door]<actCloseDoor|<br />]
(elseif: $step is $goal - 2)[[go inside]<actGoInside|<br />]
(elseif: $step is $goal - 3)[[open door]<actOpenDoor|<br />]
(else:)[
(if: $attacked is 0)[[walk]<actWalk|<br />]
(if: $feeling > 0 and $attacked is 0)[[listen]<actListen|<br />]
(if: $heard and $attacked is 0)[[walk quickly]<actWalkQuickly|<br />]
(if: $heard or $attacked)[[run]<actRun|<br />] ]}
{
(click: ?actWalk)[
(set: $step to $step + 1)
(goto: "Start")
]
(click: ?actOpenDoor)[
(set: $step to $step + 1)
(goto: "Start")
]
(click: ?actGoInside)[
(set: $step to $step + 1)
(goto: "Start")
]
(click: ?actCloseDoor)[
(set: $step to $step + 1)
(goto: "Start")
]
(click: ?actLockDoor)[
(goto: "End")
]
(click: ?actWalkQuickly)[
(set: $step to $step + 2)
(set: $d1 to $d1 + (random: -1, 1))
(goto: "Start")
]
(click: ?actRun)[
(set: $step to $step + 3)
(set: $d1 to $d1 + (random: -2, 2))
(goto: "Start")
]
(click: ?actListen)[
(if: $danger and $step >= $d0)[
(set: $heard to 1)
(set: $d1 to $d1 - 1)
]
(goto: "Start")
]}<br />
=><=
[resist]<actResist|
[submit]<actSubmit|
{(click: ?actResist)[
(goto: (either: "Dead", "Start", "Fight", "Fight"))
]
(click: ?actSubmit)[
(goto: "End")
]}=><=
City Simulator 2012
Kevin Harris
Inspired by (link: "When Acting As A")[(gotoURL: "http://davidtm.com.ar/acting/index.html")]
(link: "Restart")[
(set: $initialized to 0)
(goto: "Start")
]<br />
=><=
[expire]<actExpire|
(click: ?actExpire)[(goto: "End")]