-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
Update old scripts examples #2559
Conversation
# | ||
# Plants seeds when you right click dirt, grass or farmland with a hoe, using seeds from the inventory. | ||
# it will also plant cacti on sand if there's space for it. | ||
# The hoe used will be damaged by 1 point for planting the seeds/cactus. | ||
# | ||
|
||
aliases: | ||
# all blocks which are allowed next to a cactus. If any block which is not in this list is placed next to a cactus the cactus breaks. | ||
# please note that changing this list won't affect which blocks actually break a cactus. | ||
allowed next to cactus = 0, 6, 9, 10, 11, 27, 28, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 65, 66, 75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119 | ||
|
||
on rightclick on grass, dirt or soil with any hoe: | ||
block above is air | ||
player has seeds | ||
|
||
set block above to crops | ||
remove seeds from player | ||
damage tool by 1 | ||
|
||
block is not soil: | ||
set block to soil | ||
damage tool by 1 # damages the hoe a second time if the ground was not soil before | ||
|
||
# right click sand to plant a cactus | ||
on rightclick on sand with any hoe: | ||
player has a cactus | ||
block above is air | ||
blocks north above, east above, south above and west above are allowed next to cactus | ||
|
||
damage tool by 1 | ||
set block above to cactus | ||
remove a cactus from player |
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.
Why was this removed?
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.
In my opinion, it's a unecessary example, so I removed it.
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.
or you were lazy to fix the code
Like i said above, examples are to teach users something.
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.
This comment has been deleted.
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.
Preferably have the inventory set to a variable, modify it there, then open it to the player. Optionally use metadata for verifying the inventory instead of names.
Can you quote lines about what are you talking please? Should be mroe easily to fix/add this suggestion. |
@Olyno Believe me, I am trying. |
Go to the code (by clicking |
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.
Grammar nitpicks
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.
Change code to use UUIDs and Default Value expression instead of Variables
#
# Counts kills per life, in total, and the highest kill streak.
#
# We're using the UUID expression inside variables here.
# An UUID is a player's Universally Unique Identifier
# It doesn't change when a player's name changes, which is why it should be used instead of names
# when storing player-specific values for a long time.
# Note that all entities have an UUID, but different servers might have duplicate UUIDs for entities,
# whereas the UUIDs of players are always unique, on all servers.
on death:
attacker is a player
# Here, we're using the "Default Value" expression to set the kill counter variable to 1 if it is not already set.
# If it is, we add 1 to it.
set {kill counter::%attacker's uuid%::kills_total} to ({kill counter::%attacker's uuid%::kills_total} + 1) ? 1
set {kill counter::%attacker's uuid%::kills_session} to ({kill counter::%attacker's uuid%::kills_session} + 1) ? 1
if {kill counter::%attacker's uuid%::kills_session} > {kill counter::%attacker's uuid%::kills_session_max}:
set {kill counter::%attacker's uuid%::kills_session_max} to {kill counter::%attacker's uuid%::kills_session}
on death of player:
set {kill counter::%player's uuid%::kills_session} to 0
command /kills:
executable by: players
trigger:
message "You have killed %{kill counter::%player's uuid%::kills_session}% mobs and players in this life out of %{kill counter::%player's uuid%::kills_total}% kills in total."
message "Your maximum kill streak is %{kill counter::%player's uuid%::kills_session_max}% kills in one life."```
An UUID lol |
Is it now okay to merge this? Everything of importance seems to have been resolved, and this is better than what we present to new users now, looks like quality work. People could pull request additional suggestions separately, because otherwise this is never getting merged... |
I didn't have the time to readd and fix |
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.
Looks good to me
As Nicofisi said:
Everything of importance seems to have been resolved, and this is better than what we present to new users now, looks like quality work.
People could pull request additional suggestions separately, because otherwise this is never getting merged...
Description
Update old examples of Skript.
Target Minecraft Versions: /
Requirements: /
Related Issues: #2252