Currently, no syntax exists for specifying item_types to the HasItem, ItemDropped, and OwnsItem tests. However, when using arbitrary item_types (ie, when the item type is passed into an event via argument), the more specific tests like HasWeapon, HasGood, etc. cannot be used either:
I can think of two ways to circumvent this already. One alternative is to create identical events that have the different item types hardcoded into them, and call these different events depending on the desired item_type. This is undesirable, especially if the event is already complex - at worst this approach requires four different events that are syntactically identical except for one constant. The other alternative is to use the IfPlayerHasItem, IfPlayerOwnsItem, or IfItemDropped instructions directly, which makes using explicit condition groups necessary - and to quote example_with_comments.py, "The whole point is that you never have to manually build a condition or calculate a line skip again."
Using the changes I'm requesting, Soulstruct is able to successfully compile and decompile the desired syntax into logically equivalent instructions, as shown below (the desired syntax version uses condition group 7, and the original syntax uses condition group 2):
There seems to be some logic for extracting the item_type from the item argument within the tests. However, I couldn't figure out how to make use of this myself, considering that the item argument being passed in is also arbitrary (passed into the event via argument). I also couldn't find any examples of this being used, in the provided example file nor in the StJudeSouls repo - I'm not sure where to look besides these places.
I could be missing something obvious as to why this syntax was written as it is now - please let me know if this is the case. Thank you!
sidenote - I'm not sure what the desired format for contributions is - consider adding contributor guidelines to the repo!
(duplicate of #12 , moved to different branch)
Currently, no syntax exists for specifying
item_type
s to theHasItem
,ItemDropped
, andOwnsItem
tests. However, when using arbitraryitem_type
s (ie, when the item type is passed into an event via argument), the more specific tests likeHasWeapon
,HasGood
, etc. cannot be used either:I can think of two ways to circumvent this already. One alternative is to create identical events that have the different item types hardcoded into them, and call these different events depending on the desired
item_type
. This is undesirable, especially if the event is already complex - at worst this approach requires four different events that are syntactically identical except for one constant. The other alternative is to use theIfPlayerHasItem
,IfPlayerOwnsItem
, orIfItemDropped
instructions directly, which makes using explicit condition groups necessary - and to quote example_with_comments.py, "The whole point is that you never have to manually build a condition or calculate a line skip again."Using the changes I'm requesting, Soulstruct is able to successfully compile and decompile the desired syntax into logically equivalent instructions, as shown below (the desired syntax version uses condition group 7, and the original syntax uses condition group 2):
There seems to be some logic for extracting the
item_type
from theitem
argument within the tests. However, I couldn't figure out how to make use of this myself, considering that theitem
argument being passed in is also arbitrary (passed into the event via argument). I also couldn't find any examples of this being used, in the provided example file nor in the StJudeSouls repo - I'm not sure where to look besides these places.I could be missing something obvious as to why this syntax was written as it is now - please let me know if this is the case. Thank you!
sidenote - I'm not sure what the desired format for contributions is - consider adding contributor guidelines to the repo!