Skip to content

Commit 27ece54

Browse files
committed
More documentation
1 parent 5f1c595 commit 27ece54

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

docs/syntax/requires.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,27 @@ Additionally, those functions can themselves return a dynamically-created requir
115115
116116
- Example of a returned requires string: https://github.com/ManualForArchipelago/Manual/blob/main/src/hooks/Rules.py#L26-L29
117117
118-
\* By default, the only two generic requirement functions that we provide are the OptOne and OptAll, which are both focused on allowing a required item or items to pass the requirement even if the item(s) have been disabled through defined category options. The rest of the functions in the Rules hook file are examples.
119-
120118
## Bundled functions
121119
122-
Manual comes with some helpful functions built in:
120+
In addition to writing your own Requirement Functions, Manual comes with some helpful functions built in:
121+
122+
### `ItemValue(ValueName:Count)`
123+
124+
Checks if you've collected the specificed value of a value-based item.
125+
126+
For Example, `{ItemValue(Coins:12)}` will check if the player has collect at least 12 coins worth of items
127+
123128
124129
### `OptOne(ItemName)`
125130
126131
Requires an item only if that item exists. Useful if an item might have been disabled by a yaml option.
127132
128133
### `OptAll(ItemName)`
129134
130-
I'm not sure how to document this function, nico pls help
135+
Takes an entire requires string, and applies the above check to each item inside it.
136+
137+
For example, `requires: "{OptAll(|DisabledItem| and |@CategoryWithModifedCount:10|)} and |other items|"` will be transformed into `"|DisabledItem:0| and |@CategoryWithModifedCount:2| and |other items|"`
138+
131139
132140
### `YamlEnabled(option_name)` and `YamlDisabled(option_name)`
133141

src/Rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def checkRequireStringForArea(state: CollectionState, area: dict):
8989
func = globals().get(func_name)
9090

9191
if func is None:
92-
func = getattr(Rules, func_name)
92+
func = getattr(Rules, func_name, None)
9393

9494
if not callable(func):
9595
raise ValueError(f"Invalid function `{func_name}` in {area}.")

0 commit comments

Comments
 (0)