JIST - JavaScript Interpreted Scripting for TShock 1.0.23

Adds server-sided Javascripting support for TShock servers

  1. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Javascript Interpreted Scripting for TShock

    Jist (JavaScript interpreted scripting for Terraria) is a plugin for TSAPI that allows you to make scripts for your server in javascript.

    Jist is based on the Jint (https://github.com/sebastienros/jint) engine and carries many of its benefits. The main advantage scripts have over plugins is the fact that they can be unloaded, and reloaded at any point in time without impacting the server. Jist uses a very smart interpreter that is entirely built inside the .NET framework which means unlike other scripting language implementations in .net, it does not attempt to compile and load scripts or use an external library to run. Jist is very powerful, and allows you to extend functionality of your server quickly and easily without having to write and compile a plugin in C#, and then restart your server.

    Features
    • Does not require external scripting libraries to run
    • Fully interpreted
    • Scripts may interact with each other, allowing you to split common functions into their own separate files
    • Supports dynamic loading and unloading of scripts
    • Comprehensive API covering SEconomy and AliasCmd, TShock, and TSAPI
    Commands
    /jist reload Reloads the JIST runtime
    /jist ev "<snippet>" Executes the Javascript snippet and prints the result to the console
    /jist dumpenv Dumps a list of all javascript functions registered in the JS engine
    /jist dumptasks Dumps all Jist recurring tasks, with their ID and the time until they run again

    Permissions
    jist.cmd Has permission to execute the /jist command

    Installation
    • Install .net 4.5.2
    • Download the file from this post.
    • Extract Wolfje.Plugins.Jist.dll to your ServerPlugins directory in your TShock installation
    • On first run, a serverscripts directory will be created for scripts to go into
    Creating scripts
    Insert files ending in .js into your serverscripts directory and /jist reload. Please check out the wiki for the scripter's reference, it has all the functions you can use and basic examples on their usage.

    Plugin Developers
    More info coming soon

    Download
    Download | Source
     
    • Like Like x 2
  2. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Recipes

    Recipes are designed to show you the power and functionality of JIST and scripting for TShock. Included here are some easy to follow examples of scripts you can use to enhance your server as well as teach you the basics of scripting in Javascript.

    Click on the links below to learn more about doing cool stuff in your server!
     
    • Like Like x 1
  3. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Reserved
     
  4. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,597
    Good job man! You even manage to be classy with JS... :cool:
     
    • Like Like x 1
  5. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191

    Haha I have had some good experience with C on Linux and the concepts are very similar. JS is actually really easy to understand, just people tend to make it a mess. :s
     
    • Like Like x 1
  6. Strinkor

    Plugin Developer Zero Day Plugin Author

    Joined:
    Jun 4, 2014
    Messages:
    64
    Good work. Wolfje! When you release your SEconomy? I saw it only on your web-site.
     
  7. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,597
    Check plugin releases/submissions please ^^
     
  8. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Users of this plugin, remember if there's any API that you would like to request, let's hear it!
     
  9. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Changes:
    • New script recipe: Create a simple task that loops through all players in the server and heals them every five seconds
     
  10. pink_panther

    pink_panther Level 9

    Joined:
    Oct 14, 2013
    Messages:
    370
    Code:
    create_alias("lol", "", 0, "", function(player, parameters) {
        jist_for_each_player(function(player) {
            execute_command(player, "/kill \"" + player.Name + "\"");
        });
    });
    
    /lol
     
  11. Ijwu

    Ijwu Level 11

    Joined:
    Apr 4, 2012
    Messages:
    647
    Approved.


    This command used to exist in a mod for Wolfenstein: ET. It would spawn grenades near the targetted player. Needless to say, it was a blast. huehuehue
     
  12. pink_panther

    pink_panther Level 9

    Joined:
    Oct 14, 2013
    Messages:
    370
    aUEhUaeuHaUEhuaehuahUaehUh

    I'm trying to get wolfje to code in some more hooks so you can also spawn projectiles on players too.
     
    • Like Like x 1
  13. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Hooks are coming soon as I write the JS event hooking system. Also yay, approval!
     
    • Like Like x 1
  14. Ijwu

    Ijwu Level 11

    Joined:
    Apr 4, 2012
    Messages:
    647
    What is this? Celebration?! Unapproved!

    Make the event hooking system not just work with TSAPI/TShock events, but also custom events. So plugins can hook into that melon. For example: a PvP plugin registers "playerkill" event for any player who killed an enemy player in a deathmatch. Jist has a recipe that rewards 20 SEc gold to the killer.

    Would be mega-sweet.
     
    • Like Like x 1
  15. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Well the thing is, I can't just hook onto any non-static .net event because the jist runtime would require an object instance for the *this pointer.

    What you can do though, is easily submit functions to javascript, I can have it so plugin devs can also submit events to the event mechanism. Not sure yet though. "custom" events are a very broad subject.
     
    • Like Like x 1
  16. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    Jist has been updated

    Jist has been updated with a few more standard tshock functions to do with regions. You can determine if a player is standing inside a region inside a script now, and manipulate tshock regions.
    • New function: tshock_player_in_region(player, region): Determines if a player specified by `player` is in the region named `region`
    • New function: tshock_player_regions(player): Returns an array of all regions that `player` is standing inside of
    • New function: tshock_get_region(region): Retrieves a region object based on the name provided by `region`
     
    • Like Like x 4
  17. Wolfje

    TShock Admin TShock Mod Zero Day Plugin Author

    Joined:
    Jul 2, 2013
    Messages:
    191
    [This post was whiney bullmelon]
     
  18. pink_panther

    pink_panther Level 9

    Joined:
    Oct 14, 2013
    Messages:
    370
    I'd also like to add that you're a bananaing sad loser to bother DDOSing a Terraria server, lol.
     
    • Like Like x 3
  19. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,597

    This is really unfortunate hear.
    SEconomy was, is, an amazing plugin that brought an entirely new experience to Terraria servers and all of the community members who play on them. It's just a shame that some moron feels the need to prove his skiddie skills like this and take such an experience away.

    On behalf of the TShock administration I'd like to wish you all the best with future ventures, and you'll always be more than welcome to pop back around here and say hi if you ever want to.
    If there's anything we can do to help, with this or other matters, send me a PM.

    All the best in the future
     
    • Like Like x 3
  20. Tauriel

    Tauriel Level 4

    Joined:
    Apr 30, 2014
    Messages:
    67
    Once again, thanks a lot for sharing your plugin with us (The TShock Community).

    I hope to see you back in the future.