skLambda

Addon skLambda 1.1.1

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

Supported Skript Version
  1. 2.15
Supported Minecraft Versions
  1. 1.21
  2. 26.1
32070cb0beb1772a327160cb7f52827138ae8c3b.png

This addon is no longer maintained. As of 1.1.1, skLambda will not receive further updates. The source stays available, but there are no planned releases, fixes, or support going forward. Feel free to fork it.


skLambda

A Skript addon that adds two things:

  1. Lambdas — small functions you can save in a variable and run later.
  2. The listen section — a short way to make a temporary event listener with a timer, a hit count, and what to do at the end.

Example: same task, two ways
The task: tell the player to mine 10 stone in 30 seconds. Give a diamond if they finish. Say "too slow" if they don't.

Without skLambda
Code:
on break of stone:
    if {challenge::%player%} is not set:
        stop
    add 1 to {challenge::progress::%player%}
    send "keep going..." to player
    if {challenge::progress::%player%} >= 10:
        send "you did it!" to player
        give 1 diamond to player
        delete {challenge::%player%}
        delete {challenge::progress::%player%}

command /challenge:
    trigger:
        set {challenge::%player%} to true
        set {challenge::progress::%player%} to 0
        send "mine 10 stone in 30s" to player
        wait 30 seconds
        if {challenge::%player%} is set:
            send "too slow" to player
            delete {challenge::%player%}
            delete {challenge::progress::%player%}

This works, but you have to do a lot by hand:

  • A global on break of stone that runs for every player on the server.
  • A flag variable to know which player is in the challenge.
  • A counter variable.
  • A separate wait 30 seconds to handle the timeout.
  • Lots of delete lines to clean up.

With skLambda
Code:
command /challenge:
    trigger:
        send "mine 10 stone in 30s" to player
        listen for block break where event-block is stone:
            countdown: 30 seconds
            triggers: 10
            on trigger:
                send "keep going... (%remaining triggers% left)" to event-player
            on completion:
                send "you did it!" to event-player
                give 1 diamond to event-player
            on timeout:
                send "too slow!" to event-player

That's it. The listener belongs to this one command run. The counter and the timer are built in. When it finishes or times out, it cleans up by itself.


Links



License
MIT


Notes
If you experience any problems, let me know on Discord — eult, or join the Discord server.
Author
eult
Downloads
52
Views
130
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from eult

Latest updates

  1. 1.1.1

    This addon is no longer maintained. As of 1.1.1, skLambda will not receive further updates. The...
  2. 1.1.0

    skLambda 1.1.0 Supports: Paper 1.21.1+ · Skript 2.15+ New expressions Highest / Lowest By...
  3. 1.0.0

    skLambda 1.0.0 Supports: Paper 1.21.1+ · Skript 2.15+ New expressions List loops can now be...