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

Update old scripts examples #2559

Merged
merged 13 commits into from
Mar 7, 2020
Merged

Update old scripts examples #2559

merged 13 commits into from
Mar 7, 2020

Conversation

Olyno
Copy link
Contributor

@Olyno Olyno commented Oct 13, 2019

Description

Update old examples of Skript.


Target Minecraft Versions: /
Requirements: /
Related Issues: #2252

src/main/resources/scripts/vanilla gui.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/simple motd.sk Show resolved Hide resolved
src/main/resources/scripts/realistic drops.sk Outdated Show resolved Hide resolved
Comment on lines -1 to -32
#
# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Contributor Author

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.

Copy link
Contributor

@Blueyescat Blueyescat Oct 13, 2019

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.

Copy link
Contributor

@bluelhf bluelhf left a 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.

Copy link
Contributor

@bluelhf bluelhf left a 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.

@Olyno
Copy link
Contributor Author

Olyno commented Oct 13, 2019

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.

@bluelhf
Copy link
Contributor

bluelhf commented Oct 13, 2019

@Olyno Believe me, I am trying.

@ShaneBeee
Copy link
Contributor

@Olyno Believe me, I am trying.

Go to the code (by clicking files changed at the top)
Scroll to the line you think needs to be changed, and a little button should pop up, click it, and you can comment
Screen Shot 2019-10-13 at 3 22 29 PM
:

@Whimsyturtle Whimsyturtle added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Oct 14, 2019
Copy link
Member

@Whimsyturtle Whimsyturtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar nitpicks

src/main/resources/scripts/homes.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/homes.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/homes.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/furnace automatisation.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/homes.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/realistic drops.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/simple motd.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/vanilla gui.sk Show resolved Hide resolved
Copy link
Contributor

@bluelhf bluelhf left a 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."```

@Matocolotoe
Copy link
Contributor

An UUID lol

@Nicofisi
Copy link
Member

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...

@Olyno
Copy link
Contributor Author

Olyno commented Feb 24, 2020

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 plant with hoe.sk, except that, everything should be ok in this pull request

Copy link
Contributor

@ShaneBeee ShaneBeee left a 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...

@ShaneBeee ShaneBeee merged commit f5fef2c into SkriptLang:master Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants