- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2018/11/30 10:30:47 UTC-08:00
ByGuest
Other
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
4700
WouCookieTrailParkour:
    type: world
    debug: true
    speed: 0
    events:
        on player enters CTPStart:
        - flag player CTPStart:1
        - flag player CTPStartTime:<server.current_time_millis>

        on player enters CTPFinish:
        - choose <player.flag[CTPStart]||null>:
            - case null:
                - narrate "This is the finish line for the parkour. You can start the parkour at the Christmas tree."

            - case 1:
                # Catch time.
                - define CTPFinishTime <server.current_time_millis.sub[<player.flag[CTPStartTime]>]>

                # Calculate time.
                - define Hour <def[CTPFinishTime].div[3600000].round_down>
                - define Remainder <def[CTPFinishTime].sub[<def[Hour].mul[3600000]>]>
                - define Minutes <def[Remainder].div[60000].round_down>
                - define Remainder <def[Remainder].sub[<def[Minutes].mul[60000]>]>
                - define Seconds <def[Remainder].div[1000].round_down>

                # Adjust for single-digit times.
                - if <def[Minutes]> <= 9:
                    - define Minutes "0<def[Minutes]>"
                - if <def[Seconds]> <= 9:
                    - define Seconds "0<def[Seconds]>"

                # Announce over the lobby.
                - announce "<&e>Lets congratulate <&6><player.name> <&e>for finishing the Cookie Trail Parkour in <&6><def[Hour]><&f>.<&6><def[Minutes]><&f>.<&6><def[Seconds]><&e>!" format:ChristmasLobby

                # Give the player a celebratory cookie trophy.
                - give i@cookie[display_name=<&6>Cookie<&sp>Trail<&sp>Parkour;lore=<&f>Victor<&co><&sp><&6><player.name>|<&f>Time<&sp>taken<&co><&sp><&6><def[Hour]><&f>.<&6><def[Minutes]><&f>.<&6><def[Seconds]>|<&e>|<&f>Congratulations!]

                # Clear flags.
                - flag player CTPStartTime:!
                - flag player CTPStart:!
                # Set a PB for ... momentum.
                - if <player.has_flag[CTPPB]>:
                    - if <player.flag[CTPPB]> < <def[CTPFinishTime]>:
                        - flag player CTPPB:<def[CTPFinishTime]>
                else:
                    - flag player CTPPB:<def[CTPFinishTime]>



RawRaw



Pastes made: 57257