Timed Scripts 1.0 b30

Execute commands correctly timed independently from server lag!

  1. Phoenix616
    [​IMG] Made in Germany with love (and beer)

    With TimedScripts you can set up different commands in a script to be executed in a correctly timed fashion, independently from the actual server performance in ticks. That means that commands set up to be executed after five minutes are not run ten minutes later when your server only runs with 10tps.

    This plugin also provides a variable system with which you can insert predefined and custom variables into your commands and specify them on script execution, allowing for some advanced effects and modularization that can be achieved when combining multiple scripts.

    It is being developed to allow for syncing particle and other animations to music without having to worry about server lag de-syncing the whole performance, the current set of features is therefore focussed on supporting this use case but you can already do some really nifty things with it.

    In the future there probably will be a release of a custom web interface to allow for easier editing of the scripts (currently you have to use ingame commands or directly edit the script files located in plugins/TimedScripts/scripts/), maybe a better per user script management and more features related to the execution of the scripts.

    Commands
    User commands (permission: timedscripts.command):
    /timedscripts (alias: /scripts) - Show a list with all scripts
    /timedscript (alias: /script) - Command to manage and edit single scripts
    /script info <name> - Gives you some information about a script like author and command count
    /script create <name> - Create a new script. Names have to be without spaces!
    /script view <name> [<time>] - Shows you all commands in a script. If you specify a number of seconds it will only show the commands configured for that time.
    /script edit <name> add <time> <command> - Add a command to a script at a certain time (in seconds).
    /script edit <name> set <time> <number> <command> - Set the n-th command at a time to the new command. The number of the command is the same as in /script view and starts at 0.
    /script edit <name> <remove> <time> [<number>] - Removes all or the n-th command at a certain time
    /script save <name> - Force the save of a script to its file
    /script delete <name> - Removes a script and stops all running instances of it

    /script run <name> [<var=value...>] - Execute a script. You can overwrite as many variables as you want. For example: /script run test day=13 month=April msg="My message".
    There are some special system variables that you can overwrite. (See below) The most important is the sender one, which you can use to execute the script for another player or the console by setting it to sender=<playername> or sender=console. (For entities use the vanilla execute command)

    Admin commands (permission: timedscripts.admin):
    /scripts reload [stop] - Reload all scripts from their files (and stops all currently running scripts if the stop parameter is added)
    /scripts stop - Stop all running scripts (per scripts execution stop will be added in the future)

    The specific permissions for all these (sub-) commands can be found in the plugin.yml available online in the TimedScripts GitHub repository.
    Variables
    Variables can be included into commands to allow for a more dynamic usage of the timed scripts. You insert them via %variablename% into your command and set their value either in the config.yml if you want them to work in every script or specify them in the /script run command. (See Commands section above)

    You also have the ability to define a default value of a variable that is used when the run command does not set it, otherwise you will get a warning when trying to run a script without setting all values. The default value is set via %variablename=defaultvalue% directy in your command string. %variablename= % results in the default being empty. (Take a look at the Example section below)

    There is also a number of dynamic variables that are automatically set when running the script to simplify some use cases (they can still be overwritten in /script run).
    • %sender% - The name of the sender that ran the command
    • %senderworld% - The name of the world the sender is in
    • %senderx% - The X-position of the sender, without numbers after the decimal point. Console executes at the world's spawnpoint
    • %sendery% - The Y-position
    • %senderz% - The Z-position
    • %senderyaw% - The yaw
    • %senderpitch% - The pitch
    • %senderlocation% - Combination of x, y and z into a single string "10 63 249"
    Examples
    Script to visualize the timed nature of the scripts and some dynamic variables. Remember that you can start scripts from inside other scripts ;)
    Code (Text):
    # ---------------------------------------------------------- #
    # TimedScript: test                                          #
    # Author: Phoenix616 (83688181-ce68-4136-918b-15e88ec2c705)  #
    # ---------------------------------------------------------- #
    0: say %sender% %senderworld% %senderlocation%
    1: say 1
    2: say 2
    2.5: say 2.5
    3:
    - say 3
    - say Test
    - say test1
    4: test
    A simple auto broadcast running every 5 minutes with the command /script run autobroadcast msg="Don't forget to vote!" (Paste it into plugins/TimedScripts/scripts/autobroadcast.txt)
    Code (Text):
    # ---------------------------------------------------------- #
    # TimedScript: autobroadcast                                 #
    # Author: Phoenix616 (83688181-ce68-4136-918b-15e88ec2c705)  #
    # ---------------------------------------------------------- #
    0: tellraw @a {"text":"%msg%","color":"red"}
    300: script run autobroadcast msg="%msg%"
    Untimed, one line title script. Uses ColorfulCommands. Execute with /script run title title=Title subtitle="My subtitle". (Paste it into plugins/TimedScripts/scripts/title.txt)
    Code (Text):
    # ---------------------------------------------------------- #
    # TimedScript: title                                         #
    # Author: Phoenix616 (83688181-ce68-4136-918b-15e88ec2c705)  #
    # ---------------------------------------------------------- #
    0:
    - title %[email protected]% times %fadein=20% %stay=60% %fadeout=20%
    - cc title %[email protected]% subtitle {"text":"%subtitle= %"}
    - cc title %[email protected]% title {"text":"%title= %"}
    Links

    Donations
    Programming is time intensive and I would really appreciate your support!
    So if you can afford it or make commercially use of this plugin feel free to buy me a beer.

    Patreon with rewards: [​IMG]
    Paypal: https://s.moep.tv/donate
    Ðoge: D7G4Svo7GTNHpuhjwUBj2k7qANnZHwYD4p
    BTC: 1EXMFRknc7kLwCmM1zf5LXNnPD4ihVCEhQ

    My Other Resources
    [​IMG]
    This resource is distributed without any warranty or liability by the author.
    TheNoise and Aoro like this.

Recent Reviews

  1. TheNoise
    TheNoise
    5/5,
    Version: 1.0 b30
    Works exactly as described, has helped me solve a huge issue! Many thanks Phoenix for a great plugin.