Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Scripting Example in 0.6.1

Discussion in 'Modding' started by glubbfreund, Dec 15, 2017.

  1. glubbfreund Trainee Engineer

    Messages:
    12
    Hi,

    I want to start with creating some scripting Mods in ME but I cant compile the example from the wiki in the new version, here is the log output.

    2017-12-15 11:56:21.485|Main thread> Compilation of 936042378.sbm failed:
    2017-12-15 11:56:21.486|Main thread> MOD_ERROR: Smart Shovel Example Mod (Part 1)
    2017-12-15 11:56:21.486|Main thread> in file:
    2017-12-15 11:56:21.486|Main thread> C:\Users\Oli\AppData\Local\Temp\MedievalEngineers\936042378.sbm\MySmartDiggerToolBehavior.cs(44,27): Error: 'MyInputContext' does not contain a definition for 'Actions' and no extension method 'Actions' accepting a first argument of type 'MyInputContext' could be found (are you missing a using directive or an assembly reference?)
    2017-12-15 11:56:21.486|Main thread> MOD_ERROR: Smart Shovel Example Mod (Part 1)
    2017-12-15 11:56:21.486|Main thread> in file:
    2017-12-15 11:56:21.486|Main thread> C:\Users\Oli\AppData\Local\Temp\MedievalEngineers\936042378.sbm\MySmartDiggerToolBehavior.cs(86,18): Error: The name 'MyAPIUtilities' does not exist in the current context
    2017-12-15 11:56:21.486|Main thread> MOD_ERROR: Smart Shovel Example Mod (Part 1)
    2017-12-15 11:56:21.486|Main thread> in file:
    2017-12-15 11:56:21.486|Main thread> C:\Users\Oli\AppData\Local\Temp\MedievalEngineers\936042378.sbm\MySmartDiggerToolBehavior.cs(86,5): Error: The type or namespace name 'IMyUtilities' could not be found (are you missing a using directive or an assembly reference?)
    2017-12-15 11:56:21.487|Main thread> MyModManager.LoadData() - END

    It seems that the MyInputContext still exists but the Actions table is gone. I tried to research it by myself by using your definitions.xsd but I cannot even find an type named MyInputContext there. I have some C# fundamentals but no experience with this XSD typed documentation. Could you please support me what im doing wrong here? Thanks in advance.
     
  2. CptTwinkie Moderator

    Messages:
    4,457
    It needs to be updated for 0.6

    I'm working on some new guides right now. When I'm finished I'll see what I can do about updating old ones.
     
    • Like Like x 1
  3. glubbfreund Trainee Engineer

    Messages:
    12
    Wow - that was pretty fast :)
    Thats great and im excited to hear that, thank you so much!
     
  4. Sir_Moodz Apprentice Engineer

    Messages:
    377
    Good idea is to look at/start from existing mods (that are updated to 0.6)
     
  5. glubbfreund Trainee Engineer

    Messages:
    12
    thats what im doing actually but I think I could some bigger thinks with more documentation (or perhaps im just not as good as them:)). But I have to weird issues. If I try to use

    m_subpartEntityState = Container.Get<MyEntityStateComponent>();

    I get the following error:

    Error: The type or member 'MyEntityStateComponent' is prohibited

    I thought it should be whitelisted? Another issue is that I need an persistent member of that entity. If I grab it the content should not be destroyed - is there a way to prevent that behavior or to add the possibility in future updates if not yet? For now I will use an static stack member and push it if it will be destroyed and pop the last one if it will be placed again. Fore some Member it works, but others are prohibited, see see https://forum.keenswh.com/threads/mod-api-whitelist-discussion-and-requests.7395164/.

    Example (because I know how hard the Monday morning is..:):

    public class ExampleBehavior : MyEntityComponent, IMyEventOwner, IMyEventProxy, IMyGenericUseObjectInterface
    {

    (..)
    private static Stack booksStack = new Stack();
    (..)
    public override void OnAddedToScene() {

    (..)
    if (booksStack.Count > 0) { m_subpartSign.Text = booksStack.Pop().ToString(); }
    SetBookTitle(m_subpartSign.Text);
    (..)
    public override void OnRemovedFromScene() {
    if(!String.IsNullOrEmpty(m_subpartSign.Text)) booksStack.Push(m_subpartSign.Text);
    (..)
    }
    }
     
    Last edited: Dec 16, 2017
  6. gromit190 Trainee Engineer

    Messages:
    1
    Gave it a crack at the Smart Shovel myself. Same problem as OP. Any solution to this, yet?