-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
Introduces toggle effect & expression #4154
base: dev/feature
Are you sure you want to change the base?
Conversation
I have the same question I had with Delta’s PR initially: why would you add a new ChangeMode value? Toggling a boolean is essentially equal to setting the boolean to its opposite value. If anyone can give me one type that could use toggling except booleans, then go ahead, but in my opinion this should just be added as a separate effect and use the set-operation to perform the action. |
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.
Expression's javadocs for change and acceptChange should be updated
src/main/java/ch/njol/skript/expressions/ExprEventCancelled.java
Outdated
Show resolved
Hide resolved
Co-authored-by: TPGamesNL <[email protected]>
…feature/toggleChanger
It's more intuitive and makes more sense than toggle the value manually. For example: set flight mode to false # Bruh
toggle flight mode # This is good
Yes it is, but what's the most intuitive for users? Having a boolean "state" expression, or use a simple toggle?
I did that in a first time, but try to reuse an effect in addons, this is just impossible or really tricky/hard to do. What we would like is a simple api for addons developers that anyone could use it easily. Adding a mode makes things easier than adding an effect, and trying to use this effect. |
You're understanding me wrong. What I'm saying is that the internal structure of this feature does not make sense to me.
|
Yeah, but here is the problem: how do you manage that with addons? |
Addons that register boolean expressions can just accept SET as a valid change mode? |
Hey, I don't really get what you mean, why shouldn't TOGGLE be a mode? |
Not really. I am advocating for the removal of this ChangeMode because toggling equals setting a value to its opposite. This means that all boolean expressions that accept 'set' as a valid ChangeMode, can be toggled, since, again, toggling equals setting a value to its opposite. |
I think both ways are useful as a GhangeMode and as an expression.
I don't think this is correct, it is technically setting to it's opposite but to do this manually you will need a work-around and it will be longer that just |
You are not understanding me correctly but at this point I think it doesn’t matter anymore. |
I would like to understand your opinion of course, let me know more. It does matter :) |
My point is that you can toggle using current SET mode like this set flight state of player to false if flight state of player is true else true
# OR
if flight state of player is true:
set flight state of player to false
else:
set flight state of player to true Which works perfectly but adding toggle flight state of player
send "Flight state has been set to %toggle flight state of player%"
# OR
set flight state toggled {Flight::%uuid of player%} Makes it easier in some cases if not many, Am I correct? |
@Mwexim's point is that |
But with that it won't be possible to do |
Yes that would be possible, TOGGLE is not a ChangeMode in that code: https://pastebin.com/mEvXw429 |
If that works well I think it is a better idea, because it will be easier and no need to add TOGGLE ChangeMode to all boolean type expressions manually. |
Oh okay, that's what I didn't understand, how we could do that without a mode. It seems to be a good way to do it. I'm gonna probably change for that (and adding a new expression if the community wants to) |
This pull request is not ready to be review due to some changes to do. I convert it to draft during this time. |
Co-authored-by: Patrick Miller <[email protected]>
Co-authored-by: Patrick Miller <[email protected]>
Co-authored-by: Patrick Miller <[email protected]>
Tests are not passing, please do not merge this pull request yet, while we don't find the issue. |
|
Description
This pull request introduces the toggle effect and expression.
Target Minecraft Versions: /
Requirements: /
Related Issues: /