[MOD EXT] Empyrion Scripting - Scripts

Discussion in 'The Hangar Bay' started by Ephoie, Mar 22, 2020.

  1. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    Hi folks,

    a question: What is "damagelevel" doing?
     
    #81
  2. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    I get the feeling this may have been removed in A12, previously it was giving a percentage of damage of the current ship/structure (I think an overall 'current hitpoints' / 'total hitpoints' for every block) but when i tried using it more recently post-A12 it always returned 0, including in older scripts that I know worked at the time.

    I did a brief look into it and the total/current hitpoints for a block are still accessible when using {{block structure coords}} but the top level @root.E.S.DamageLevel seems to always be zero. There's a (quite high) probability I was doing something wrong or missing something as I just abandoned the idea without doing any further research, but it's also possible the hook for this was removed from the API in A12 so the script is no longer able to pull that information.

    One theory i've had is the API is being cleaned up to remove outdated information. I recall the ship control panel used to have a 'Hitpoints' metre on it a few versions back - random google image from ~Alpha 6
    [​IMG]

    But from ~alpha 10 when shields were introduced the shield bar replaced that in the control panel
    [​IMG]

    (Look in the bottom left of both images)

    So I think for alpha 10 / alpha 11 this data was still available via the API for a script to pick up on, even though it was no longer being displayed in the base game anywhere. Come alpha 12 it's been removed entirely as it "wasn't being used" so any script referencing 'DamageLevel' now always shows zero damage taken.

    @ASTIC would have a much better idea than I do of what's going on behind the scenes so this is all just theory based on what I've observed/remembered
     
    #82
    tachyon likes this.
  3. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,918
    Love you mate! :D
     
    #83
  4. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    Thanks.
    According to the A10 release notes this should have been moved "above battery" (I think they mean the battery charge value):
    https://empyriononline.com/threads/alpha-10-out-now.49963/ under "Updated Control Panel Display" but obviously it is not there.
    The value of this also does not change if a structure or devices on it take damage. I also tried "save tamplate" to check if this calculates the percentage of demage relative to the template, but seemingly it does not.
     
    #84
  5. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    By the way: ASTIC die Mod ist großartig. :)
     
    #85
  6. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Danke :)

    Ich habe versucht die Entwickler davon zu überzeugen einen "Computerblock" als Scripteditor bereit zu stellen und die API zu erweitern (Konstruktoren, Wassergeneratoren, weitere Schiffs-, Flug- und Playfielddaten) ... leider ohne Erfolg :-(

    Dabei könnten wir so leicht die Lücke zu SE schließen....

    PS: Davon, die Mod in das Spiel zu integrieren mal ganz abgesehen... auch hier besteht leider kein Interresse :-((
     
    #86
    Last edited: Jul 17, 2020
    Sephrajin and shadowiviper like this.
  7. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    Yes! I remember seeing it just above the battery display previously, but failing to find a screenshot with it in and not being able to check in-game I wasn't 100% sure if I was misremembering some other stat there.

    In which case if it's no longer being displayed where it was most recently moved to it's likely it's been removed from the base game. So something like
    < alpha 10 = show hitpoints as their own column
    alpha 10, alpha 11 = show damage.level above the battery display
    alpha 12 = not displayed

    I've skimmed the A12 change log and can't see anything about it being removed, so could be it was unintentional or a bug, but more likely was intentionally removed due to not being super useful.

    (Saving the ship template was also literally the first thing I did when it stopped working thinking the total hitpoints was based on the ship template. Glad I wasn't the only one...)

    If it's still something you're attempting to do, the workaround I'd started on but gave up with was to manually enter the xyz coordinates of key components to the ship as part of the script (engines, weapons, shield, core etc) and using that you can still manually access those using {{block}}, including the total hit points and current damage - not quite the same as showing it for the whole ship but you could have a display listing out your key areas and if they've taken any damage while ignoring the general armor blocks
     
    #87
  8. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    Das hatte ich tatsächlich auch schon in einem Thread (https://empyriononline.com/threads/...-structural-devices.76917/page-12#post-407778) vorgeschlagen. Vielleicht wird es ja doch irgendwann was.
    Gibt es eine Begründing, wieso kein Interesse an so einem Feature besteht? Ich finde, erst so können die ganzen Konstruktionen erst richtig schön zum Leben erwachen. LCDs mit statischen Inhalten sind z.B. reichlich öde. Und die Möglichkeit, Inventarmanagement zu betreiben ist auch fein.

    Die Idee eine Templatesprache für das Scripting zu nehmen, finde ich übrigens sehr fein. Das macht die Dinge viel einfacher, als z.B. in SE. Wenn dann noch die Dinge, auf die man zugreifen kann zusammenreflektiert und im UI angeboten würden, wäre es perfekt.

    Ich spiele Empyrion quasi seit dem Release und habe sowas immer vermisst.
     
    #88
    Last edited: Jul 17, 2020
  9. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    Maybe it would be possible to sum up the total hitpoints and store it within a config lcd and then calculate the percentage using this. I think this could be a relaible solution, especially of blocks get totally destroyed. Do you now what was the base for "total hitpoints" <A10? What happened back then when blocks were completely destroyed? Unfortunately I never really paid attention to this.
     
    #89
    Last edited: Jul 17, 2020
  10. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    Unlikely I think - the only way to access that data for a block is to load it from the {{block}} tag, which requires as input x,y & z coordiantes for the block. To get every block you'd need to know the boundary of the ship and then be able to loop through every single block layer by layer, line by line. So starting in 1 corner and looping through every X coordinate, then increment Z (front to back) by 1, doing it again until you get the back of the ship, then increment Y (up and down) by 1 and repeating the whole thing again until you get every block.

    Unless i'm mistaken there also isn't a direct "for" loop of just looping through a set of numbers, so being able to have a script "Start at -100, add 1 each time, until you get to +300". All the loops are based on {{each}} for a set of entities/values, so without having a dictionary of all your block coordinates you'd need to cobble the loop together manually as well.

    I'd tried all of it previously when I was working on a script to give you a current ammo readout, so had wanted to loop through every block on a ship looking for anything in the 'Weapons' category. Tally up the number of, for example, Gattling guns and from that work out how much ammo you needed / how much volume to dedicate to 15mm bullets. In the end I had it as a 'manual entry' style where you had to type in the number of each weapon type, as I couldn't find a decent way to scan every block of the ship based on it's coordinates and the other methods like DevicesOfType didn't support weapons/turrets.

    If you work out how to do it though, make sure to share it back as I'd love to see where I went wrong :)
     
    #90
  11. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    I will see if I find the time to try things out. Maybe this would be a use case for the new C# scripting.
     
    #91
    shadowiviper likes this.
  12. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    I've brought it up a few times as well in various 'suggestion' threads and it's always on my wishlist. Would love to see full integration with constructors, thrusters etc - so much could be done with that if the proper modding tools were given, there is already so much achievable with what you've done with the limited amount of data.

    Sorry to hear you're losing interest. While I don't have the faintest idea of how the API works or C# in general if there's anything I can do to help let me know!
     
    #92
  13. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,918
    It is Eleon that is not interested to implement the ScriptingMod.
    Astic is very interested in doing so :p

    That, or I misunderstood you both.
     
    #93
  14. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    In that case, I blame Google Translate for my misunderstanding :D (and forgetting 100% of the German I learnt in school)
     
    #94
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    I love Empyrion and would love to advance the game ... and integrate the mod and expand MUCH more.
     
    #95
    Sephrajin likes this.
  16. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    Glad to hear that :) The offer of anything I can do to help still stands of course. Hopefully i'll have some new scripts to show off over the weekend once I've squashed the last few bugs
     
    #96
    Sephrajin likes this.
  17. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,918
    Speaking of bugs...
    That 2hr log script of yours - works well when inserted into an online vehicle.
    BUT.. if saved, and then respawned (online only!! ; works perfect offline!).... it kicks everyone from the playfield - within 11 secs, but NO error messages at all, just straight to the main menu...

    I would provide logs for @ASTIC , but there are none.
    I even had the server owner check the logs, nothing that indicates a script issue - yet, it only happens with that script saved to the blueprint, and only in online games. :(
     
    #97
  18. Phieeel

    Phieeel Ensign

    Joined:
    Jul 18, 2020
    Messages:
    3
    Likes Received:
    3
    @Sephrajin - Thank you for sharing your scripts with the community!

    However, I seem to be having difficulty getting the AutoFill script working on A12. The AutoMove script still seems to function fine, but Autofill does not seem to work. The only edits I made to the original code was to lower the 'reserve' value from 1000 to 500, as I tend not to run with that much excess fuel/O2/Pentaxid.
    The displayLCD shows and updates based on the switch just fine, and it even properly will show if I have enough resources, but it never seems to move them into the docked vessels. I even ensured there's room in the fuel tanks, lol. Is this just not possible in A12? Or did some of the functions change?
    (if it matters, I am using several of the other scripts from this thread, but they are just the informational display types (ships docked, nearby vehicle list, etc. All of which work as fine as they can in A12, lol)
     
    #98
    Last edited: Jul 18, 2020
    Sephrajin likes this.
  19. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,918
    You're welcome, happy someone takes use of them! :)
    I just copied it as is to a new structure and tested it successfully.

    Did you place the following?
    1 Cargo box, Named "Output Power"
    1 Lever, txSignal: "sw_autofill"
    2 LCD, named (Script: )AutoFill

    Other musts:
    -> Vessel must be docked
    -> Vessel must be power DOWN/OFF
     
    #99
    Last edited: Jul 19, 2020
    Phieeel likes this.
  20. Phieeel

    Phieeel Ensign

    Joined:
    Jul 18, 2020
    Messages:
    3
    Likes Received:
    3
    Ah-ha! The bit I was missing was having a specifically named cargo box. That direction was not present in the original post. Got it working now! Cheers! Thanks for your help!

    Now I gotta work on figuring out Shadowviper's Universal Container display and Dynamic Transfer scripts, lol.
     
    #100
    shadowiviper and Sephrajin like this.

Share This Page