-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arbitrary trainer scripts + on frame/trigger softlock prevention #5033
base: upcoming
Are you sure you want to change the base?
Conversation
There's obviously a comparison to be drawn between point 3 and ghoulslash's The small difference is that this PR puts the check to see if the script should run inside the script (via A consequence of punning the flag is iiuc that flags 1-3 are treated as trainer types, meaning that I personally prefer the design in this branch—if a user has a script that doesn't start with |
Script_HasNoEffect returns TRUE if the script definitely has no player- visible effect, or FALSE if it may/does have a player-visible effect. Opcodes have been manually tagged with whether they abort if they would have a player-visible effect, and the natives and specials have been manually tagged with whether they definitely have no player-visible effect or not. Using these, we're able to execute scripts until they either exit with no effect, or would possibly have an effect. This allows us to: 1. Not run on frame map scripts or triggers if they would have no effect. 2. Support arbitrary control flow in trainer scripts. The trainer does not see the player if the script has no effect, and the trainer will use whichever trainerbattle command is branched to. 3. Support arbitrary scripts in trainer scripts. cant_see and cant_see_if_* commands have been introduced so that scripts are able to do something when the player interacts with the trainer even if that trainer wouldn't see them.
2c04041
to
1eb51c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite a bit of this is out of my league, but some preliminary thoughts before other people review this
EDIT: special flags are no longer supported due to the issue mentioned at the bottom of this message. Oh, to quickly justify why I think that special vars, special flags, and string buffers do not count as player-visible but everything else does:
I think you could argue that special flags shouldn't be counted as non-visible, e.g. |
Temporarily marked as draft to give myself time to think about Deokishisu's comments on Discord. |
Script_HasNoEffect
returnsTRUE
if the script definitely has no player-visible effect, orFALSE
if it may/does have a player-visible effect.Opcodes have been manually tagged with whether they abort if they would have a player-visible effect, and the natives and specials have been manually tagged with whether they definitely have no player-visible effect or not.
Using these, we're able to execute scripts until they either exit with no effect, or would possibly have an effect. This allows us to:
trainerbattle
command is branched to.cant_see
andcant_see_if_*
commands have been introduced so that scripts are able to do something when the player interacts with the trainer even if that trainer wouldn't see them.