# +------------------------- # | # | M a g i c S i d e b a r # | # | Provides a working live-updating per-player sidebar! # # @author mcmonkey # @date 2019/03/01 # @denizen-build DEV-670 # @script-version 1.0 # # Installation: # 1. Put the script in your scripts folder. # 2. Edit the config script below to your liking. # 3. Reload # # Usage: # Type "/sidebar" in-game to toggle the sidebar on or off. # # ---------------------------- END HEADER ---------------------------- # ------------------------- Begin configuration ------------------------- magic_sidebar_config: type: yaml data # How many updates per second (acceptable values: 1, 2, 4, 5, 10) per_second: 5 # Set this to your sidebar title. title: <&b><&l>Player Info # Set this to the list of sidebar lines you want to display. # Start a line with "[scroll:#/#]" to make it automatically scroll # with a specified width and scroll speed (characters shifted per second). # Note that width must always be less than the line's actual length. # There should also be at least one normal line that's as wide as the width, to prevent the sidebar resizing constantly. lines: - "[scroll:20/5]<&a>Welcome to <&6>my server<&a>, <&b><&a>!" - "<&8>-----------------------" - "Ping: <&b>" - "Location: <&b>,<&b>]>" - "Online Players: <&b><&f>/<&b>" # ------------------------- End of configuration ------------------------- magic_sidebar_world: type: world debug: false events: on delta time secondly: - define per_second - define wait_time ]>s - define players - define title - repeat : - sidebar title:> values: players: per_player - wait magic_sidebar_lines_proc: type: procedure debug: false script: - define list - foreach as:line: - define list_index - define line > - if scroll<&co>]>: - define width ].before[/]> - define rate ]> - define line ]> - define index ].round.mod[].add[1]> - define end ]> - repeat as:charpos: - if ]> == <&ss>: - define index - if <= : - repeat stop - define start_color ].last_color> - if > : - define end ]> - repeat as:charpos: - if ]> == <&ss>: - define end - if < : - repeat stop - define line "]> <&f>]>" - else: - repeat as:charpos: - if ]> == <&ss>: - define end - if < : - repeat stop - define line ",]>" - define list ].at[]> - determine magic_sidebar_command: type: command name: sidebar usage: /sidebar description: Toggles your sidebar on or off. script: - if : - flag player sidebar_disabled:! - narrate "<&b>Sidebar enabled." - else: - flag player sidebar_disabled - narrate "<&b>Sidebar disabled." - wait 1 - sidebar remove players: