Skip to content
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

Adds Clamp Function #5573

Merged
merged 6 commits into from Jun 25, 2023
Merged

Adds Clamp Function #5573

merged 6 commits into from Jun 25, 2023

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Mar 31, 2023

Description

Adds a clamp function to the default functions. This is essentially a shortcut for doing:

set {_value} to min(max({_value}, {_min}), {_max})

It returns the given value if it's between the min/max.
It returns the max if the given value is above the max.
It returns the min if the given value is below the min.

set {_value} to clamp({_value}, {_min}, {_max})

Also, no clue how the indentation is supposed to go, since the whole thing is just one long run-on line, so I just followed what all the other functions did.


Target Minecraft Versions:
Requirements:
Related Issues:

@TheLimeGlass TheLimeGlass added the feature Pull request adding a new feature. label Mar 31, 2023
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
@TheLimeGlass TheLimeGlass merged commit 302f8f9 into SkriptLang:master Jun 25, 2023
4 checks passed
Moderocky pushed a commit to Moderocky/Skript that referenced this pull request Sep 16, 2023
@sovdeeth sovdeeth deleted the ClampFunction branch September 26, 2023 17:14
NotSoDelayed pushed a commit to NotSoDelayed/Skript that referenced this pull request Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants