Skip to content

Adds scripting support and other useful functionality to 7 Days To Die dedicated server

Notifications You must be signed in to change notification settings

djkrose/7DTD-ScriptingMod

Repository files navigation

djkrose's Scripting Mod

Adds scripting support and other useful functionality to 7 Days To Die dedicated server.

Download

Scripting Examples

Lua JavaScript
1. Create file example.lua
-- @commands    mylua
-- @description My first Lua command
-- @help        This example shows how easy it is
--              to add a new command in Lua script
print "Hello Lua World!"

2. Drop file into \Mods\ScriptingMod\scripts folder
3. Execute commands: help mylua and mylua
Example mylua
4. Profit!

1. Create file example.js
// @commands    myjavascript myjs
// @description My first JavaScript command
// @help        This example shows how easy it is
//              to add a new command in JavaScript
console.log("Hello JavaScript World!");

2. Drop file into \Mods\ScriptingMod\scripts folder
3. Execute commands: help myjsand myjs
Example mylua
4. Profit!

Why Scripting?

  • Quickly and easily modify commands to your own preference; changes are live instantly without server restart
  • Pick and choose commands from various online sources; write and share single command snippets with others
  • Implement new commands from simple to complex individual features; no need for third-party bots
  • React on new game events like level-up or geo-fencing that are not available by other means.
  • Full OS access, full file access, full network access: use web requests (REST/JSON), any database, send emails, ...
  • Two of the most flexible and easy to learn programming languages with lots of resources online
  • Full access to .Net Framework, all Unity objects, and all 7DTD game data
  • Full support of 7DTD command permission system: assign access levels to your commands just like any other

Built-in Commands

dj-versionShows djkrose's Scripting Mod version information.
dj-exportExports a prefab including all container content, sign texts, ownership, etc.
dj-importImports a prefab, optionally including all container content, sign texts, ownership, etc.
dj-log-eventsEnables or disables logging of events to the server console.
dj-regenRegenerates a chunk or custom area based on the world seed.
dj-repairRepairs server problems of various kinds.
dj-patchEnables or disables runtime server patches like the dupe exploit fix.
dj-posShows the current player's position in various units and formats.
dj-eac-whitelistAllows players to be exempt from EAC checks on an EAC-enabled server

Compatibility

Documentation

To get you started, the mod contains a couple of example scripts that you can inspect. They can be activated by removing the trailing underscore (_) from the file name.

Detailed documentation and API specification is just starting to grow: Documentation Wiki

Source Code

Since version 1.0 the source code is fully available and the releases are not obfuscated anymore. Feel free to look around and copy what you like, but please leave the author and link to this GitHub intact (see license).

Of course you are free to fork and continue with changes on your own, but you are also invited to contibute directly to the main release by submtting feature requests, bug reports, and pull requests.

Tipps for using the source code:

  • Open the solution in Visual Studio 2017
  • Adjust the GameFolder in Build.targets to install releases automatically as part of the build process.
  • Adjust broken project references to game files (Assembly-CSharp etc.) to match your own game installation directory.
  • For running and writing unit tests, install the NUnit 3 Test Adapter extension.
  • To enable debugging follow the instructions here:
    https://7daystodie.com/forums/showthread.php?70344-Debugging-Net-Server-API-Mods

Road Map

I want to add a lot more to it as time permits it. Here are some ideas:

  • Expose more game variables and functions to scripts through an easy ScriptingMod API with clear documentation
  • Many more example scripts in Lua and JavaScript to get you started quicker
  • Option to execute commands through chat messages rather than console commands, for instance /home or !home

See issues section for some individual features.

This is just a rough outline; everything is subject to change depending on your feedback, on feasibility, on my real life commitments, and simply on my pleasure to continue in any direction or at all.

Contact

Feedback is welcome! Please report specific suggestions and bugs here:

For questions and support you can use:

Just remember: This software is provided free of charge, as is, without any guarantee or support. You are not entitled to support, nor is anyone but you liable for data loss. If it doesn't work, that is just bad luck. If data is lost, you should've made a backup.

License

Creative Commons License djkrose's Scripting Mod is licensed under a CC BY-NC 4.0. That means, you are free to use the mod and the source code (once published) for non-commercial purposes; just leave the credit notes intact.

This mod is a private project and not affiliated with the official 7DTD game or with The Fun Pimps in any way.

About

Adds scripting support and other useful functionality to 7 Days To Die dedicated server

Resources

Stars

Watchers

Forks

Packages

No packages published