huderlem / poryscript

High-level scripting language for gen 3 pokemon decompilation projects
https://www.huderlem.com/poryscript-playground/
MIT License
197 stars 22 forks source link

[Feature Request] Introduce new conditional operators #58

Closed LOuroboros closed 1 year ago

LOuroboros commented 1 year ago

Title.

On top of flag(INSERT_FLAG_LABEL_HERE), var(INSERT_VARIABLE_LABEL_HERE) and defeated(INSERT_TRAINER_LABEL_HERE) I think it would be useful for users of Poryscript to have some extra operators in order to make the scripts written in Poryscript's syntax even cleaner than they are right now.

A few examples I can think of would be gender(INSERT_GENDER_LABEL_HERE), hour(INSERT_HOUR_OF_DAY_HERE) and partysize(INSERT_NUMBER_OF_MONS_IN_PARTY_HERE), which would take advantage of the checkplayergender, gettime and getpartysize overworld scripting commands.

I don't know how does Poryscript handle its conditionals so I don't know if it'd be easy to incorporate these. Feel free to close the ticket if they're not viable.

LOuroboros commented 1 year ago

I thought a few more that would be pretty dope to have.

if (hasItem(INSERT_ITEM_LABEL_HERE)) and if (hasItemOnPC(INSERT_ITEM_LABEL_HERE)), i.e. conditionals that would use the checkitem and checkpcitem scripting commands.

LOuroboros commented 1 year ago

I clicked the Close Issue button and forgot to write a comment 😆

For the posterity; this issue ticket has been closed after discussing inside Pret's Discord server the caveats of implementing these statements.

Some of these statements like hasItem would modify the value of certain variables like VAR_RESULT at the time of their hypothetical usage, which could in turn cause unforseen consequences if the user is not careful enough, or if they're not aware of the fact.