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.

Updating Visual Studio with the latest references

Discussion in 'Programming Questions and Suggestions' started by nogare321, May 21, 2015.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. nogare321 Trainee Engineer

    Messages:
    64
    I've been reading through the forum and noticed that the last update added a couple native methods to the API: Namely
    IMyProgrammableBlock Me;
    Action<string> Echo;
    TimeSpan ElapsedTime;

    I've tried them in the game with the following code, and it works. However, when I try to use them in my Visual Studio program, It clams they don't exist. How do I update (or what needs to be updated) to add these methods to my reference library?
    Code:
    string strData = "PB Name: " + Me.CustomName;
    Echo(strData);
    
    Currently loaded libraries are:
     
  2. indigodarkwolf Apprentice Engineer

    Messages:
    115
    The same way that you get Visual Studio to pretend that GridTerminalSystem exists: You declare them as variables in the class. Visual Studio will compile the code just fine, then. Just remember you can't copy-paste them into the PB.
     
  3. nogare321 Trainee Engineer

    Messages:
    64
    Ok, that would work for the IMyProgrammableBlock Me, but not for the Echo(string Data) function. I'm asking if there is an updated version of the Sandbox.ModAPI.Ingame or Sandbox.ModAPI.Interfaces libraries that aren't auto updated when SE updates, or if these new methods (I think that's what they are) are located in another library.

    Thanks for your suggestion!
     
  4. mexmer Senior Engineer

    Messages:
    1,977
    these variables are injected into code on compile time in ingame script compiler and evaluated when compiler engine creates assembly.

    see MyProgrammableBlock.cs in source code.

    Following variables are defined
    IMyGridTerminalSystem GridTerminalSystem; // grid terminal system to which is pb connected
    string Storage; // pb private storage - limited to 65000 characters
    IMyProgrammableBlock Me; // programable block selfreference
    Action<string> Echo; // Text to output into detailed info - limited to 8000 characters
    TimeSpan ElapsedTime; // time elapsed since program start and scaled by simspeed
     
  5. nogare321 Trainee Engineer

    Messages:
    64
    I see, so I just need to add your list before my SE code, and make sure not to copy it into the PB terminal.
    Thanks!
     
Thread Status:
This last post in this thread was made more than 31 days old.