[Challenge] Convert Denizen to Skript

  • 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 comminuty!

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

Rezz

Addon Developer
Jan 24, 2017
80
37
18
O7BN1Ct.png

Some people are reluctant to try Skript because they don't believe it's as capable as Denizen.
Let's help them out by converting Denizen scripts to Skript!


The goal:
  • Rewrite Denizen scripts in Skript, mirroring functionality as best as possible.
It'll be tricky since Denizen's terse syntax is fairly arbitrary and confusing, but anyone well-versed in reading code should be able to decipher it... in theory.​
  • Use as few addons as possible (preferably none!)
A lot can be achieved in vanilla Skript (especially Bensku's fork). If you decide on requiring an addon, make it count!
How to:

A public Denizen Script Repository exists and several Denizen scripts are released on Spigot (you just have to search for them).
Pick one, implement it in Skript, and post it here!

Example:

Here is a Skript implementation of 'Marriage Script' by Gershon12.

code_language.skript:
#
#   -----------------
#   Denizen to Skript
#   -----------------
#
#   A Skript implementation of 'Marriage Script' by Gershon12
#   https://one.denizenscript.com/denizen/repo/entry/127
#
#   -----------------
#   Requires no addons.
#

command /marry <text="?"> [<player>]:
    executable by: players
    description: Marriage
    trigger:
 
        set {_uuid} to player's uuid
     
        if arg-1 is "help" or "?":
     
            #
            #   Display help.
            #
         
            send "&a&l------------- Marriage Help -------------"
            send "&a/marry (player) &r- &7 Request a player to marry you"
            send "&a/marry divorce &r- &7 Divorce the person you are married to"
            send "&a/marry tp &r- &7 Teleport to your partner"
            send "&a/marry info &r- &7 Information about your marriage"
            send "&a/marry info (player) &r- &7 Marriage information about another player"
            send "&a&l-----------------------------------------"
         
        else if arg-1 is "accept":
     
            #
            #   Accept marriage request.
            #
         
            if {marriage::%{_uuid}%::request} is not set:
             
                send "&cYou do not have any marriage requests!"
                stop
             
            set {_target} to {marriage::%{_uuid}%::request} parsed as player
         
            if {_target} is not set:
             
                send "&cThat person is not online!"
                stop
             
            set {_target-uuid} to {_target}'s uuid
         
            if {marriage::%{_target-uuid}%::partner} is set:
             
                send "&cThat person is already married!"
                stop
             
            set {marriage::%{_uuid}%::partner} to {_target-uuid}
            set {marriage::%{_uuid}%::partner::date} to now
            set {marriage::%{_uuid}%::partner::points} to 0
         
            send "&aYou are now married to %{_target}%."
         
            set {marriage::%{_target-uuid}%::partner} to {_uuid}
            set {marriage::%{_target-uuid}%::partner::date} to now
            set {marriage::%{_target-uuid}%::partner::points} to 0
         
            send "&aYou are now married to %player%" to {_target}
         
            broadcast "&a&l%{_target}% and %player% are now married!"
         
        else if arg-1 is "deny":
         
            #
            #   Deny marriage request
            #
         
            if {marriage::%{_uuid}%::request} is not set:
             
                send "&cYou do not have any marriage requests!"
                stop
             
            set {_target} to {marriage::%{_uuid}%::request} parsed as offline player
            delete {marriage::%{_uuid}%::request}
         
            send "&aYou have declined the marriage request from %{_target}%."
         
            if {_target} is online:
             
                send "&a%player% has declined your marriage request." to {_target}
             
        else if arg-1 is "divorce":
     
            #
            #   Divorce an existing marriage.
            #
         
            if {marriage::%{_uuid}%::partner} is not set:
         
                send "&cYou are not married!"
                stop
             
            set {_partner-uuid} to {marriage::%{_uuid}%::partner}
            set {_partner} to {_partner-uuid} parsed as offline player
         
            clear {marriage::%{_uuid}%::partner::*}
            delete {marriage::%{_uuid}%::partner}
         
            send "&aYou have divorced from %{_partner}%."
         
            clear {marriage::%{_partner-uuid}%::partner::*}
            delete {marriage::%{_partner-uuid}%::partner}
         
            if {_partner} is online:
         
                send "&a%player% has divorced from you!" to {_partner}
             
        else if arg-1 is "info":
         
            #
            #   Display marriage info.
            #
         
            send "&a&l------------- Marriage Info -------------"
         
            if arg-2 is set:
             
                set {_target-name} to arg-2's name
                set {_target-state} to "is"
                set {_target-uuid} to arg-2's uuid
             
            else:
             
                set {_target-name} to "You"
                set {_target-state} to "are"
                set {_target-uuid} to {_uuid}
             
            set {_partner} to {marriage::%{_target-uuid}%::partner} parsed as offline player
         
            if {_partner} is set:
             
                send "&a%{_target-name}% %{_target-state}% married to: &e%{_partner}%"
                send "&aDate married: &e%{marriage::%{_target-uuid}%::partner::date}%"
                send "&aMarriage points: &e%{marriage::%{_target-uuid}%::partner::points}%"
             
            else:
             
                send "&a%{_target-name}% %{_target-state}% married to: &eno one :("
         
            send "&a&l------------- Marriage Info -------------"
     
        else if arg-1 is "tp" or "teleport":
         
            #
            #   Teleport to partner.
            #
         
            if {marriage::%{_uuid}%::partner} is not set:
         
                send "&cYou are not married!"
                stop
             
            set {_partner} to {marriage::%{_uuid}%::partner} parsed as offline player
         
            if {_partner} is online:
             
                teleport player to {_partner}
             
                send "&aYou have teleported to %{_partner}%"
                send "&a%player% has teleported to you!" to {_partner}
             
            else:
             
                send "&c%{_partner}% is not online!"
         
        else:
         
            #
            #   Send a request to an online player.
            #
         
            if {marriage::%{_uuid}%::partner} is set:
             
                send "&cYou are already married!"
                stop
             
            set {_target} to arg-1 parsed as player
         
            if {_target} is not set:
             
                send "&cThat player is not online!"
                stop
             
            set {_target-uuid} to {_target}'s uuid
         
            if {marriage::%{_target-uuid}%::partner} is set:
             
                send "&cThat person is already married!"
                stop
             
            set {marriage::%{_target-uuid}%::request} to {_uuid}
            send "&aYou have requested %{_target}% to marry you!"
         
            send "&a%player% has requested to marry you!" to {_target}
            send "&aUse &e/marry accept &aor &c/marry deny" to {_target}