[MOD EXT] Empyrion Scripting - Scripts

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

  1. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Version 5.8.1: recyle & resourcesforid


    Thanks @Ostentatiou5 for this idea.
     
    #161
    Ephoie, Ostentatiou5, tachyon and 2 others like this.
  2. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    That looks fantastic - both for the recycle and being able to pull a recipe for an item.

    I was at one point using the deconstruct on my local coop server and having to dump unusable terrain/deco blocks that couldn't be deconstructed further after disassembling a POI - Interestingly, I was able to place invisible spawn pads I got from deconstructing and they would spawn friendly Zirax in a completely survival game!

    The recipe from config will go nicely with a script I'm working on. It's kind of a 'Search' script that you type in an item name and then returns a list of all containers that have that item & how much. I could extend that to also showing a list of containers that have the required resources to build the item you're searching for without too much difficulty with this update :)
     
    #162
    Ephoie likes this.
  3. tschancellor

    tschancellor Ensign

    Joined:
    Aug 21, 2020
    Messages:
    5
    Likes Received:
    8
    Hi Leutz! =)

    Das ist ja mal total der Oberhammer, was Ihr hier und im speziellen ASTIC auf die Beine gestellt habt! Respekt!!! Unglaublich!!! :D :D :D

    Bin gerad dabei langsam durchzusteigen und hätte da mal zwei Fragen:

    Gibt es die Möglichkeit - ähnlich der Abrage E.S.FuelTank oder E.S.OxygenTank - das Batterie Level oder den Batteriestand auszulesen? (--> Bsp. E.S.CapacitorLevel)

    und:

    kann man Bewegungsmelder zu festgelegten Zeiten deaktivieren? (Hintergrund: Bewegungsmelder sollen das Licht nur Abends/im Dunkeln/Morgens steuern - am Tage aber nicht...weil hell genug...strom sparen, sonst ist die CO2 Bilanz dahin... :D :D :D)


    Vielen Dank für Eure Mühen! =)
     
    #163
    Last edited: Aug 21, 2020
  4. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    Both interesting questions - as far as I know the answer to both is 'no', the only "usable" tanks are Fuel, O2 and Pentaxid (I would love one for shield strength as well as solar capacitor), and there isn't any equivalent to 'local' time (datetime is your actual real-world time) as sunrise/sunset would depend on a combination of time, your latitude and the planet type. It isn't as easy as saying 'Sunrise is at 6am' as that is only true for your current exact location, and Empyrion itself doesn't show a "time" only "time to sunrise"

    That said, there is a *very* slim chance there is something in the device data for a solar panel, for example if it is currently outputting power which you could then use as shorthand for 'is it nighttime?' - if you aren't getting solar power it's probably dark :). Off the top of my head I don't think power in/out is accessible but it's where I'd start looking.

    You'll need to access the solar panel itself using it's exact coordinates via {{block}} as I don't think its in any of the device-types, and then just cycle through all of the properties to see if any of them could be used. I'll have a look when I'm next in-game and let you know if you haven't already checked.
     
    #164
    Ephoie and tschancellor like this.
  5. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Danke für die Blumen :-D

    Hier gibt die API mir z.Zt. leider keinen Zugriff drauf.

    Leider fehlt hier eine API Funtion welche zu einer Position auf dem Playfield eine "virtuelle" Uhrzeit zu liefern

    PS: Sollte Eleon die API erweitern werden ich natürlich im Scripting zur Verfügung stellen.
     
    #165
    Ephoie, tschancellor and shadowiviper like this.
  6. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    I assume data about a Shield Generator and details about a specific weapon (for example: current ammo count actually in the weapon, not in a container) are also the same and just not available in the API :(

    One thing I am struggling to work out that I do think is available - is there a way to tell the ammo type for a specific weapon using the ECF parser? For example {{block E.S......}} for a Gattling gun turret and being able to show it uses "15mm Bullet" (as a name or an ID, I don't mind). I'm sure it's in there somewhere going through block attributes but so far I've not been able to find it. Would save me a lot of time hardcoding a list of each weapon and it's ammo types :)

    Many thanks
     
    #166
    Ephoie likes this.
  7. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    It works with the current but i add some functions for an easyer access so with the 5.9.3 you can write
    Code:
    {{i18n 287 'English'}}
    {{#use (configattr 287 'WeaponItem')}}
    WeaponItem: {{.}}
    {{~configbyname .}} ({{Attr.0.Value}})
    {{#each Childs.0.Attr}}
    {{~test Name 'eq' 'AmmoType'}}
    {{~set 'AmmoType' Value}}
    {{/test}}
    {{/each}}
    AmmoType: {{@root.Data.AmmoType}} (
    {{~configid @root.Data.AmmoType}})
    {{/configbyname}}
    {{/use}}
    and get
    Code:
    Minigun Turret
    WeaponItem: TurretMSMinigunWeapon (2157)
    AmmoType: 15mmBullet (2104)
    
     
    #167
    Ephoie and shadowiviper like this.
  8. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    That is awesome thank you so much :)
     
    #168
    Ephoie likes this.
  9. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    145
    I've tried a few combinations with the data on a solar panel to see if it's possible to check it is active/producing power, but this unfortuantely doesn't seem to be possible. The capacitor itself also gives no information back in the API apart from its basic coordinates etc so isn't useful when loaded directly as a {{block}}. I also tried as a separate base with just a core & a solar panel, to test if the entire base had power or not -but this doesn't work due to solar panels always needing a capacitor which then always shows the base has power.

    I can't think of any other way to do this unless it is added to the game API for ASTIC to integrate, which is a shame as solar power is so awkward to use and integrating it with scripts would go a long way to improving it :(
     
    #169
    Ephoie and tschancellor like this.
  10. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Version 5.9.4:
    I made the access to the attributes even easier by generating two simple flat lists Values and EcfValues.
    Code:
    {{i18n 287 'English'}}
    {{#use (configattr 287 'WeaponItem')}}
    WeaponItem: {{.}}
    {{~configbyname .}} (
    {{~Values.Id}}/
    {{~EcfValues.Id.Name}}:{{EcfValues.Id.Value}})
    
    AmmoType: {{Values.AmmoType}} (
    {{~configid Values.AmmoType}})
    {{/configbyname}}
    {{/use}}
    Values: to the direct primary value of the attribute
    EcfValues: to the EcfAttribut Object with the full Data of the attribute
     
    #170
    Ephoie and shadowiviper like this.
  11. Ostentatiou5

    Ostentatiou5 Ensign

    Joined:
    Aug 9, 2020
    Messages:
    13
    Likes Received:
    10

    That's awesome!
     
    #171
    Ephoie likes this.
  12. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    #172
    Last edited: Aug 24, 2020
    Ephoie and Ostentatiou5 like this.
  13. tschancellor

    tschancellor Ensign

    Joined:
    Aug 21, 2020
    Messages:
    5
    Likes Received:
    8
    Thanks very much @shadowiviper and @ASTIC for your efforts and information!
     
    #173
    Ephoie and shadowiviper like this.
  14. Ostentatiou5

    Ostentatiou5 Ensign

    Joined:
    Aug 9, 2020
    Messages:
    13
    Likes Received:
    10
    #174
    Ephoie likes this.
  15. Ostentatiou5

    Ostentatiou5 Ensign

    Joined:
    Aug 9, 2020
    Messages:
    13
    Likes Received:
    10
    I've tried the recycle script, but it's not fully working. It pulls apart the structure, but is not saving the output anywhere, it just dissapears. Also, I noticed when you ran yours, it removes the core as well. The destruct one for us is leaving the core. This is running on a dedicated server, also running Reforged Eden.
     
    #175
  16. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    @Ostentatiou5 Let's deal with this in a PM (which you have already initiated) and delete the entries here because this is the wrong forum for it
     
    #176
    Ephoie likes this.
  17. tschancellor

    tschancellor Ensign

    Joined:
    Aug 21, 2020
    Messages:
    5
    Likes Received:
    8
    Hi Leutz =)

    hab nochmal 3 Fragen:

    1. Welche Sprache ist euch lieber zum Fragen? Deutsch oder Englisch? oder beides? =)


    und die eigentlich spielbetreffenden Fragen:

    2. Ist es möglich nicht nur "IsPowerd" abzufragen, sondern IsPowerd auch zu setzen? (Hintergrund: CV soll startklar gemacht werden: Schalter umlegen --> alles wichtige wird ins CV in die betreffenden Kisten verschoben und das CV wird natürlich auch angeschaltet --> sonst verdirbt ja zum Beispiel die ganze Nahrung)

    ...also alles wichtige reinverschieben läuft schon erste Sahne, dank eurer hervorragenden Arbeit!!! :D :D :D

    und ja...ich weis, dass mann die Entitäten auch über die Registratur an- und ausschalten kann. Es wär aber cool, wenn man das mit "1em Klick" gleich alles erledigen kann. :D


    3. Wenn ich ein xyz.hbs SaveGameScript laufen lasse, dann wird die Ausgabe des Scriptes immer nur für 1sec auf dem Ausgabe-LCD/Projektor angezeigt (immer wenn das Script durchlaufen wurde). Wenn ich das gleiche Script in einem LCD direkt im Spiel laufen lasse, dann zeigt der AusgabeLCD aber eine dauerhafte Anzeige - auch wenn das Script gerad nicht ausgeführt wird, wird aber auf dem LCD der letzte Durchlauf angezeigt - so solls ja auch sein.

    Frage: Was hab ich übersehen? --> hab auch schon versucht mit {{#settextblock}} eine Ausgabe auf ein LCD zu schreiben. Leider hab ich es noch nicht hinbekommen - irgendwas übersehe ich doch?
    Wenn ich mit {{#settextblock .}}"auszuführender Code" {{/settextblock}} etwas anzeigen lassen will (egal ob direkt im Game oder per SaveGameScript), kommt gar keine Anzeige - LCD bleibt schwarz - auch kein Fehler - sowie ich nur settextblock auskommentiere kommt sofort eine Anzeige - aber die eben nur ca. 1 sec...dann ein paar sec. Pause und wieder 1sec Anzeige (eben immer dann, wenn das Script durchlaufen wurde; soweit ist mir das klar).
    Natürlich steht #settextblock nicht allein, sondern vorher wird das LCD mit #devices @root.E.S 'LCDName' abgefragt und anschliessend mit #each durchlaufen. (Hab ich ja versucht aus den anderen Scripten "EnemyScan" und "Scan" abzuschreiben) - aber irgendwas scheine ich zu übersehen.

    Und es muss ja gehen - sieht man ja an dem EnemyScan und Asteroiden-Scan Savegamescripten. Auch das SchiffsStatus Script hier im Thread weiter oben wird dauerhaft angezeigt (und es hat keine {{settextblock}}-Methode drin :D :D ).

    Ich hoffe ich hab mich verständlich ausgedrückt... =)

    Grüße und Vielen Dank schon mal im Voraus!!! =)
     
    #177
    Ephoie likes this.
  18. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    - deutsch oder englisch, ist beides ok
    - wenn du denn core Block aktiv/inaktiv setzt schaltest du die Struktur ein/aus, oder du koppelst den an ein Signal dessen Schalter du per Script einfach setzen kannst
    - da scheinen entweder zwei scripte sich um das LCD zu prügeln oder die Ausgabe wechselt zwischen Daten und leer (weil z.B. Ein #Test die Ausgabe abbricht...)
     
    #178
    Ephoie and tschancellor like this.
  19. tschancellor

    tschancellor Ensign

    Joined:
    Aug 21, 2020
    Messages:
    5
    Likes Received:
    8


    Cool....Vielen Dank für deine Hinweise. Werd ich gleich mal alles durchgehen...

    Grüße =)
     
    #179
    Ephoie likes this.
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Are these Scripts in a Ship in your workshop or can you post it here? I would like to use them in my new CV :)
     
    #180
    Ephoie likes this.

Share This Page