1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

Quick Introduction to Space Engineers Ingame Scripts

Discussion in 'Programming (In-game)' started by Malware, Aug 9, 2017.

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

    Malware Master Engineer

    Messages:
    9,867
    • Like Like x 7
    • Informative Informative x 2
  2. Pennywise

    Pennywise Apprentice Engineer

    Messages:
    338
    Heh, can't wait to see some stuff in "Debugging your script" section:)
    Thanx, it's very impressive!
     
  3. krypt-lynx

    krypt-lynx Apprentice Engineer

    Messages:
    175
    Well... You can to inherit requared interfaces, to create environment simulation and start your script in visual studio.

    Also, I'm using my own script for logging. It allows to to redirect script debug output on lcd.
     
  4. Malware

    Malware Master Engineer

    Messages:
    9,867
    Hi, I finally got around to writing that debugging tutorial. I'm really sorry it took so long, I hope at least it's a little bit useful for you!
     
  5. JumpinJack

    JumpinJack Trainee Engineer

    Messages:
    25
    Thank you for that useful introduction! :tu::)
     
  6. JulianB

    JulianB Trainee Engineer

    Messages:
    15
    Sooo, I just skipped to the state machine part. It really is impressive. Nice "hack" :)
    Then I thought about a more generic implementation of this and realised you'd have to serialize the enumerator instance to ensure complete execution of the method after reloading the game.
    I found this veeery old article about another "hack" to serialize this compiler generated thingy: https://dotnet.agilekiwi.com/blog/2007/05/implementing-workflow-with-persistent.html
    But I am not the most proficient C# coder here, so I thought... maybe... some more Malware would help? :p
     
  7. Malware

    Malware Master Engineer

    Messages:
    9,867
    @JulianB That article is missing some important aspects (missing code, bad link), so I can't see how it's actually done. But I suspect that it's showing a method that's lightyears outside of what's allowed to do within the programmable block. Sorry :(
     
  8. JulianB

    JulianB Trainee Engineer

    Messages:
    15
    Too bad. Fortunately I still have found a good place to put this in one of my older projects. If all goes well I may even end up publishing something for the first time :D
    Anyways, thanks for the reply and thanks for the MDK btw. It looks so much better having all the nested classes in different files :)
     
  9. Uncheat

    Uncheat Trainee Engineer

    Messages:
    12
    Hello =)
    Does something like this: static readonly Vector3D ZV = Vector3D.Zero; can be used safe? Or it's Don't from your Do's and Don'ts:
    "use static fields or properties. Methods are fine, but static fields and properties are a potential source of memory leaks. Pass your instances around, don't be lazy."
    Because I am lazy to compare or set used vectors to Vector3D.Zero every time I need :p
     
  10. Malware

    Malware Master Engineer

    Messages:
    9,867
    Yes, that's fine, it won't cause any issues.
     
  11. Uncheat

    Uncheat Trainee Engineer

    Messages:
    12
    Thank you :)
     
  12. 2nd Engr. 3Dog

    2nd Engr. 3Dog Trainee Engineer

    Messages:
    16
    Heh. Thanks Malware, this is very, very nice. I've been doing things that hard way in Notepad++, trying to figure out the namespace by trial and (mostly) error. To add to the kick-in-the-crotch feeling, I have an MSDN license and was able to install VS 2017 Pro. Thanks for helping me "see the light", but i need to go through the rest of your tutorial now. I haven't written a line of code since 2007 and have a lot of catching up to do.
     
  13. Malware

    Malware Master Engineer

    Messages:
    9,867
    You are welcome. Keep in mind that we have a community on Keen's discord too, in the #programming-in-game channel. Lots of helpful people there.
     
  14. 2nd Engr. 3Dog

    2nd Engr. 3Dog Trainee Engineer

    Messages:
    16
    The Invitation for the Discord channel in your "Your First Script" page says that the invite has expired. I'm sure I could search and locate it, but I'm supposed to be "working" ;)
     
  15. mojomann71

    mojomann71 Senior Engineer

    Messages:
    2,005
    • Like Like x 1
  16. Malware

    Malware Master Engineer

    Messages:
    9,867
    Ah ffs... I can't be replacing that invite continuously... :p Thanks, @mojomann71, I'll try that link on the page too.
     
    • Like Like x 2
  17. 2nd Engr. 3Dog

    2nd Engr. 3Dog Trainee Engineer

    Messages:
    16
    • Like Like x 1
Thread Status:
This last post in this thread was made more than 31 days old.