Skip to content

Adding the YamlCompare req function#130

Merged
silasary merged 16 commits intomainfrom
YamlCompare-req-function
Apr 20, 2025
Merged

Adding the YamlCompare req function#130
silasary merged 16 commits intomainfrom
YamlCompare-req-function

Conversation

@nicopop
Copy link
Contributor

@nicopop nicopop commented Jan 17, 2025

This Pr adds a require function that let the dev compare the yaml value of an option using any of the following:
==/= != > < >= <=
and a value that get converted to wathever the compared option type support

in the format {YamlCompare(OptionName, Symbol, value to compare against)}
ex: {YamlCompare(Example_Range > 5)}

it works like this:

  1. checks the type of the compared option
  2. run the requested value in the new convert_string_to_type using whatever type that option supports
  3. ask the option itself to try and convert the value to an int value
  4. compare the converted requested value vs yaml value
    • done by calling the comparison directly using the Comparison dict that somehow work

I might try and do some trickery to let user forget the , in the function aka have only one argument but that would require some regex that ill only create if we would prefer it that way added jan 25

@nicopop nicopop self-assigned this Jan 17, 2025
@FuzzyGamesOn
Copy link
Contributor

FuzzyGamesOn commented Jan 23, 2025

Seems like there's some overlap in what this and #126 are trying to solve. For consistency, feels like it would be best to have the single string argument like 126's yaml_option is using. Doesn't have to support that and the multiple args, either; just the single arg would work.

have only one argument but that would require some regex that ill only create if we would prefer it that way

Shouldn't require regex. Can probably just split on operator and trim both sides, or something like that. 😄

@nicopop
Copy link
Contributor Author

nicopop commented Jan 25, 2025

if #133 get merged before this ill add a commit to remove the unused arguments (multiworld, state, player)
otherwise if this merge before 133 ill add it in there

@nicopop nicopop mentioned this pull request Jan 25, 2025
@nicopop
Copy link
Contributor Author

nicopop commented Jan 25, 2025

currently working on adding the = and !reverse from #126
I also reworked the cache so ==, !=, = saves in the same cache index

Done, in 094531a
I might do the same cache thing with >= being the reverse of < and <= reverse of <

axxroytovu added a commit to axxroytovu/AP_Manual_world that referenced this pull request Apr 4, 2025
Fixed hook type hints
Added `==` as valid option to match ManualForArchipelago#130 syntax
@silasary silasary merged commit fb5bd79 into main Apr 20, 2025
@silasary silasary deleted the YamlCompare-req-function branch April 20, 2025 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants