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

Rewrite the Default Examples #4605

Merged
merged 15 commits into from
Dec 27, 2022
Merged

Rewrite the Default Examples #4605

merged 15 commits into from
Dec 27, 2022

Conversation

Moderocky
Copy link
Member

@Moderocky Moderocky commented Feb 18, 2022

Description

This replaces all of the original examples.
Examples are moved to a (disabled) sub-folder -examples/ to avoid cluttering the main directory.

Note: others may wish to add more examples, in which case they are welcome to edit the PR directly. I wouldn't mind having examples for conditions (if/else) and the built-in functions, but didn't feel these were necessary.

Motivation

The original examples were very old and did not cover a lot of Skript's feature-set (e.g. functions, local variables.)
Personally, I felt they were also inappropriate as they encouraged users to simply use the example scripts rather than bothering to write their own.

We also needed examples to cover a range of features to test Skript Grammar and if we ever want to create a Language Tour.

Changes

The new examples are designed with three things in mind:

  1. To display most of Skript's feature set.
    New users should be able to 'explore' the language with the examples to see what's possible.
  2. To have a range of difficulties.
    I have tried to include a very simple, moderate and intermediate example for each core feature.
    New users shouldn't feel overwhelmed, but the examples aren't overly-simple and unhelpful.
  3. To make the examples more abstract and 'ideas' based.
    I'd rather encourage users to think and experiment rather than just copying and using the examples - I've tried to make them more focused on the idea.
    Users should understand how to use the feature, rather than just pasting what's given to them.

The current features with examples are:

  • Chest inventories
  • Commands
  • Events
  • Functions
  • Loops
  • Meta (options/aliases/variables section)
  • Text formatting
  • Timings
  • Variables

Some examples may need adjusting or replacing over time.


Target Minecraft Versions: any
Requirements: none
Related Issues: #2252

@TPGamesNL TPGamesNL added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Feb 18, 2022
Moderocky and others added 3 commits February 19, 2022 12:47
Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>
Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>
Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

Overall I think these are very good changes 🙂.

There are a couple things I'm still unsure about but I am going to test in-game before commenting on them. I also noticed that you used backticks in some places (e.g. `test`) but since it won't be highlighted in anyway maybe it would be better to use single quotes or something instead.

src/main/resources/scripts/-examples/variables.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/chest menus.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/loops.sk Outdated Show resolved Hide resolved
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

Additional comments from in-game testing

src/main/resources/scripts/-examples/chest menus.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/commands.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/commands.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/loops.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/options and meta.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/timings.sk Outdated Show resolved Hide resolved
src/main/resources/scripts/-examples/variables.sk Outdated Show resolved Hide resolved
@AyhamAl-Ali
Copy link
Member

This PR has a related issue #2252

@APickledWalrus APickledWalrus added the 2.7 Targeting a 2.7.X version release label Jun 4, 2022
@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Nov 29, 2022

There is a million nitpicking that we could do, but at the end of the day, they're the example scripts. This should get merged soon.

We should require example scripts from big additions, like the effect section for spawning entities or what I want to add is an example for my pull requests. When this gets merged I can start adding scripts into the folder.

@Fusezion
Copy link
Contributor

There is a million nitpicking that we could do, but at the end of the day, they're the example scripts. This should get merged soon.

We should require example scripts from big additions, like the effect section for spawning entities or what I want to add is an example for my pull requests. When this gets merged I can start adding scripts into the folder.

I think adding examples as skript grows would be something that's great to do and a great thing to encourage. The biggest issue with skript was how outdated/uninformed features/examples were and newer additions ended up overlooked or never even heard about. Sections especially were overlooked by the community with the fact most people I meet don't realize spawn is a section
or just don't even know what a section is. Tho partially due to the fact spawn section didn't keep temp variables.

@Moderocky Moderocky merged commit ce0bb43 into SkriptLang:master Dec 27, 2022
kiip1 pushed a commit to mlummh/mlum-skript that referenced this pull request Nov 11, 2023
* Replace examples.

* Add example for options and aliases.

* Update src/main/resources/scripts/-examples/commands.sk

Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>

* Update src/main/resources/scripts/-examples/events.sk

Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>

* Update src/main/resources/scripts/-examples/chest menus.sk

Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>

* Update src/main/resources/scripts/-examples/chest menus.sk

* Apply suggestions from code review

* Implement some suggested changes

* Correct some formatting and add better inventory example.

* Add text formatting example (sorbonbon)

* Fix small issue with destroy ore command

* Fix argument errors

Co-authored-by: Jake Ben-Tovim <jacobbentovim@gmail.com>
Co-authored-by: APickledWalrus <apickledwalrus@gmail.com>
(cherry picked from commit ce0bb43)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7 Targeting a 2.7.X version release 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.

7 participants