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.

[Suggestion] Script Communication

Discussion in 'Programming Questions and Suggestions' started by Spartan322, Jan 8, 2015.

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

    A simple idea is to introduce communication between Programming Blocks in the same Grid.
    For Example:
    //We should need to use this if we wanted to make library blocks 
    GridTerminalSystem.GetBlockFromName("<block name>").UseCode();
    //or we could use this
    using <block name>;
    //but then the default import keyword is overridden, not the best idea
    importBlock <block name>;//or just import <block name>;
    void Main()
      doStuff(6);//Would come from one of the other libraries 
      //or we could go this route
      var libraryBlock = GridTerminalSystem.GetBlockWithName("<block name>");
      var library = libraryBlock.ImportLibrary();
      library.GetFunctionByName("doStuff", 6);
      //would be similar to reflection, bad idea for api
    EDIT: Sorry, not a C# by default, import fixed to using
    Last edited by a moderator: Jan 9, 2015
  2. mhalpern Senior Engineer

    Well it isn't that hard to do, in theory, being able to get and change (read/write functionality), the name of blocks allows information to be transferred between scripts, to be acted upon the next time the script receiving the information runs, to make it more usable and expandable though, you need to have an "address" that the script would be looking for, that would not be overwritten with name change, not too complicated to do just something that requires consideration, and as the "LAN" if you will gets more crowded. the more you have to ensure that each storage device has a unique address. Of course that is but one way to read/write data in a block, if you keep the block name constant, to act as an address, and modify the information inside the block, block settings, inventory (if it has one), than you might be able to get away with effectively having a database of variables to call upon, that multiple scripts can access and modify, without interfering with each-other, in the case of cargo containers, you would have it on an isolated conveyor system, the variable names would correspond to item names, and the variable would correspond to the quantity of the item, so long as you make sure that the inventory won't become full, it should work.
  3. Spartan322 Apprentice Engineer

    Except this requires a ton of workaround, and very much disorganized the code, which the specific reason I suggest this is to make things easier to read and organize. It would also lead to more powerful systems but my main reason to suggest it is because you can't technically call a function from another programming block. You can send data but I am asking for more then just networking data, networking code, which in theory is possible but takes up a lot of code and time and does exactly the opposite of what I would like with this suggestion. (Also, it could act as multiple .CS files running each other and calling each other instead of putting it in one file, like how you are suppose to program regular projects, and we often end up with large and hard to read collections of library like files, I prefer for ease of use and to make cool library blocks instead of doing copy-n-paste)
    Last edited by a moderator: Jan 8, 2015
  4. pipakin Apprentice Engineer

    I am totally on board with this. I wrote the referred to bulky workaround, and would be MUCH happier with official support.
  5. Cuber Apprentice Engineer

    import isn't a keyword in C#, I think you're thinking of using.
  6. Malware Master Engineer

    Check out my mainframe suggestion here:


    Very easy for the devs to implement and easy to use for us.
    Last edited by a moderator: Jan 12, 2015
  7. kor kilden Trainee Engineer

    Would a variable storage block be adequate? Instead of using names, have a block that contains an array of data it contains, and simply access that for over-save storage and passing data between blocks. It might make passing waypoints to drones easier to do.
  8. Malware Master Engineer

    Not for my needs, no. I need some way to have a shared library place, somewhere I can write code I can call from whichever other PB. Needing to copy the same framework to all PBs is really annoying, especially when fixing bugs in the said framework code.
  9. Phoera Senior Engineer

    i will comment this in your topic, it is not so easy as you think
Thread Status:
This last post in this thread was made more than 31 days old.