API Bugs

Discussion in 'Empyrion API' started by Jascha, Mar 14, 2017.

  1. Taelyn

    Taelyn Guest

    Honestly i believe this is something in your mod. U have to adapt it to the new file changes.

    Exa's mods, EWA, EAH => non of those mods have this issue

    It checks where the dedicated.exe is. And thats in the "DedicatedServer" folder
     
    #101
  2. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    I made 2 copies of my mod, the only thing different between the two is the value of my ModPath variable.

    The mod in DedicatedServer\Content\Mods\Mailbox
    Had DedicatedServer\\Content\\ModsMailbox as the value of ModPath

    The mod in
    Content\Mods\Mailbox
    Had Content\\Mods\\Mailbox
    As the value of ModPath

    Both mods are set to write the value of ModPath to (ModPath + "debug.txt") when the server is started.

    The file that got written to was located in
    DedicatedServer\Content\Mods\Mailbox
    And the line written was
    Content\Mods\Mailbox
     
    #102
  3. Taelyn

    Taelyn Guest

    #103
  4. Taelyn

    Taelyn Guest

    Solution:

    We needed to change the "CurrentDirectory" to be at the folder level where the game.exe is. So, in relative paths you need to go up one folder first, e.g. File.Write("..\" + ModPath + "debug.txt"). In the new ModAPI we will provide a GetPathFor() method where you can explicitly ask for the actual Mod directory, for example
     
    #104
    Last edited by a moderator: Mar 2, 2019
  5. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    Thank you
     
    #105
  6. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    this will work either

    public static string ProgramPath { get; private set; } = GetDirWith(Directory.GetCurrentDirectory(), "BuildNumber.txt");
    public static string GetDirWith(string aTestDir, string aTestFile)
    {
    return File.Exists(Path.Combine(aTestDir, aTestFile))
    ? aTestDir
    : GetDirWith(Path.GetDirectoryName(aTestDir), aTestFile);
    }
     
    #106
  7. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    Experimental 10 broke all my chat commands
    any chat message starting with a slash doesn't get sent to the mod.
     
    #107
  8. Taelyn

    Taelyn Guest

    Intentional. Its used for internal stuff
     
    #108
  9. Mortlath

    Mortlath Commander

    Joined:
    Jul 26, 2017
    Messages:
    49
    Likes Received:
    26
    Are you thinking of Eleon.Modding.CmdId.Request_ShowDialog_SinglePlayer? That does return Event_DialogButtonIndex.

    I tested again with A10, and sending Eleon.Modding.CmdId.Request_InGameMessage_SinglePlayer, with IdMsgPrio.priority = 0 and IdMsgPrio.time = 10, results in no response from the server.
     
    #109
  10. Taelyn

    Taelyn Guest

    The old API isnt really be fixed anymore and in the works to put it all in the new API
     
    #110
  11. Mortlath

    Mortlath Commander

    Joined:
    Jul 26, 2017
    Messages:
    49
    Likes Received:
    26
    Is the new chat api supposed work in dedicated server mode? I wasn't successful getting the chat messages to post, and the demo code only shows the API being used on the client mod.
     
    #111
  12. Taelyn

    Taelyn Guest

    Yes, works fine

    \Empyrion - Galactic Survival\Content\Extras\Modding Doc\StartPage.html

    Docu is there. Its WIP

    Keep in mind the new API isnt done and will get breaking changes during A10

    There 2 demo mods, One is Client one is Dedi
     
    #112
    Last edited by a moderator: Jun 20, 2019
  13. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Ah sorry, yes I thought you were talking about Request_ShowDialog_SinglePlayer

    The Request_InGameMessage_SinglePlayer does not return anything.
     
    #113
  14. Mortlath

    Mortlath Commander

    Joined:
    Jul 26, 2017
    Messages:
    49
    Likes Received:
    26
    I tested the chat API by enabling the client mod for Dedi, but the logs show that it is receiving the messages, but the sending a message doesn't appear to work.
     
    #114
  15. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Not sure if you could actually use the chat messages in a client environment. I would think only dedi and/or playfield mods.
     
    #115
  16. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    My mod does not allow you to enter the game near enemy bases,
    when a player enters the game (Event_Player_Connected), the player teleports away (Request_Entity_Teleport), but there is a problem - when this happens, the game freezes on loading structures and you need to restart the game again.

    Is there any way to fix this?
     
    #116
  17. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Hey, you might want to check if the player is "really" online. Because if he is connected then he is not online but as you mention maybe in the loading screen.
    Either you wait maybe 2 min before you do things, or you check if he moved. Otherwise you might want to wait for a fix we asked for to show when the player is out of loading screen.
     
    #117
  18. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    I have set the teleporter delay for 20 sec. This partially solves the problem.
     
    #118
  19. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    in experimental 10.5!
    error appears after calling the command Request_Structure_Touch

    31-08:11:34.980 11_11 -EXC- System.Exception: Size mismatch, requested=16 expected=64 at Assembly-CSharp.SelectionAttribute1[A].SplitPath (System.Int32 , System.Boolean ) [0x0006f] in <fcc48738ecb3411ba2e6d0b9fbcd1600>:0 at Assembly-CSharp.SelectionAttribute1[A].InsertStream (A[] ) [0x00015] in <fcc48738ecb3411ba2e6d0b9fbcd1600>:0 at Assembly-CSharp.OptionsService.ReduceResource (Assembly-CSharp.BookmarkInvoker+MenuTable ) [0x000f4] in <fcc48738ecb3411ba2e6d0b9fbcd1600>:0

    after this, players kicked from playfiled
     
    #119
  20. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Thanks. Bug report was created
     
    #120

Share This Page