Just to do a bit of a formal announcement. I've started working on a Server Plugin that allows you to use the almost full might of IronPython to help you run your servers. Unlike most of the other mods this one is completely open source under the Apache 2.0 License. If anyone has additional information on the api, comments, or requests please feel free to file issues against the project. https://github.com/huhlig/empyrion-python-api
I added a set of installation instructions here 'https://github.com/huhlig/empyrion-python-api/blob/master/README.md' Make sure those are done. Also note this only works on 6.x at the moment. If something isn't working send me a log please. I havent fully debugged everything yet and it is very much a work in progress. Restarting the script can be accomplished by poking 'GET <host>:36000/script/execute/loader.py' with postman. Please be warned, I am not a seasoned C# or python veteran and things are prone to randomly breaking. I will have a release later this year that is nicely packaged. If you dont know python and C# your mileage will likely vary. Pull requests are welcome.
Hello! I found error in last release in file loader.py def playerConnected(playerInfo): empyrion.LogMessage("Player Connected to " + playerInfo.playfield + ": (" + str(playerInfo.entityId) + ") " + playerInfo.playerName ) time.sleep(20) # Long enough for them to actually connect empyrion.SendGlobalMessage("Hello " + senderInfo.playerName)
Whoops. I think I corrected that locally and forgot to commit changes to origin. I will fix that tonight. Thanks.
Hi! How to connect EmpyrionAPI.cs to edit loader.py in Visual Studio? (To make it easier to work with classes, procedures and functions)
I'm not really sure I understand the question. You can edit loader.py directly with a text editor. It does not require Visual Studio at all. IDLE or Pycharm are both good editors.
Help! How to use UTF-8 code in loader.py ? I try: write # -*- coding: utf-8 -*- in first line in loader.py write line ScriptSource scriptSource = _engine.CreateScriptSourceFromFile("Content/Scripts/" + script,Encoding.UTF8); in ScriptManager.cs Don't working ( I have error: [PythonApi:Script] Error Loading 'Content/Scripts/loader.py' Script: Microsoft.Scripting.SyntaxErrorException: Non-ASCII character '\xd0' in file Content/Scripts/loader.py Wow! I changed format file to "UNIX UTF-8-BOM" and this works!