Page 55 of 55

Re: Scripting requests

Posted: Sun Mar 20, 2016 10:49 pm
by Svengali
Could we get an option to set light position and color in mission.runScreen? Maybe even with the possibility to change it on-the-fly? I'm aware that we can pass them to the shader, but writable properties which can be bound are rare.

Image

Edit:Updated pic.

Re: Scripting requests

Posted: Mon Jul 24, 2017 11:16 am
by spara
I want to set materials for a ship using a ship script. Currently I can easily do that in shipSpawned event. That however, does not work when the ship is being displayed on mission screen.

Ideally I would like to have an ship script event shipDisplayed with a suitable handle to the ship model, that would trigger when a ship is being shown.

Re: Scripting requests

Posted: Tue Oct 17, 2017 1:51 am
by cag
- be able to provide a destination for data to reduce garbage generation

1) calls to filteredEntities or entitiesWithScanClass return arrays, thus generate garbage
- if I could supply an array as a parameter for the result, there'd be no garbage to be collected
(ok, that's a bad solution, how about a separate method?)

[Aside: I replaced a single call to filteredEntities with 11 to entitiesWithScanClass, as that was much faster. But the former creates 3.43 x's as much garbage! filteredEntities must be creating JS objects rather than core ones, no?}

2) during frame callbacks, I often refer to .position & .orientation data, which genereate garbage
- if I could provide a Vector3D object (or better still, an array) for the data to be copied to, no garbage is created

Also, are there any pre-determined garbage collection calls? I'm recycling arrays to reduce how many I create and if I know when a pre-determined GC will occur, I can purge some if my pool gets too big. I currently do purge much in shipWillDockWithStation & shipWillEnterWitchspace on the assumption GC may happen but knowing actually when/if might be helpful.

Re: Scripting requests

Posted: Tue Oct 17, 2017 2:42 am
by cag
I'd like programatic access to the data logged by console.writeJSMemoryStats():
JS heap, limit, # collections to date
- really only need the 1st but with fine resolution (not MiB)
- it could be used to monitor rate of production, isolate which areas are responsible

Re: Scripting requests

Posted: Tue Oct 17, 2017 5:07 pm
by Astrobe
cag wrote:
Tue Oct 17, 2017 1:51 am
Also, are there any pre-determined garbage collection calls? I'm recycling arrays to reduce how many I create and if I know when a pre-determined GC will occur, I can purge some if my pool gets too big. I currently do purge much in shipWillDockWithStation & shipWillEnterWitchspace on the assumption GC may happen but knowing actually when/if might be helpful.
http://www.aegidian.org/bb/viewtopic.ph ... 45#p259439

Re: Scripting requests

Posted: Tue Oct 17, 2017 11:48 pm
by cag
D'oh! Perfectly demonstrates the value of a wiki over BB. I must've scrolled past that a number of times, it's so small. Such a declarative and authoritative statement
should be writ large,
don't you think? :D

Anyway, it doesn't appear to matter if you use
  • shipWillDockWithStation or shipDockedWithStation
  • shipWillExitWitchspace or shipExitedWitchspace,
as they're invoked on consecutive lines in the code. The is no shipEnteredWitchspace, so all that remains is
  • shipWillLaunchFromStation or shipLaunchedFromStation
which would only concern station based oxp's (and really, how much garbage can they generate!)

Unless you can think of a problem, I suggest the wiki advise purges/freeing be done in the 'Will' events, to keep is simple & consistent.

Re: Scripting requests

Posted: Fri Jan 19, 2018 11:21 am
by Svengali
Can we get a mouseclick event on missionscreens, which passes mouse coordinates, pleeeeaaase?

spara wrote: I want to set materials for a ship using a ship script. Currently I can easily do that in shipSpawned event. That however, does not work when the ship is being displayed on mission screen.
It's already possible to change materials/shaders on mission screens.

Re: Scripting requests

Posted: Fri Jan 19, 2018 2:32 pm
by montana05
Just a suggestion of mine, including defense_ship_roles similar to escort_roles would make life easier. I am aware that a script could do the same trick easy so its just an idea.

On the other hand I tired scan_description for certain groups and the result was all the time that the game earlier or later crashed, usually while exiting whitchspace with a lot ships of this group waiting ahead.

Re: Scripting requests

Posted: Fri Jan 19, 2018 4:31 pm
by spara
Svengali wrote:
spara wrote: I want to set materials for a ship using a ship script. Currently I can easily do that in shipSpawned event. That however, does not work when the ship is being displayed on mission screen.
It's already possible to change materials/shaders on mission screens.
You indeed can change materials on mission screen. And I actually heavily utilized that with those card games I did a long time ago. I had to scratch my head quite a bit to remember what this was all about. It's about a different way to do ship variants. Traditionally one like_ships a core ship and it's roles and in the process changes the distribution balance of different ships. I was experimenting with the idea of changing the livery via script rather than defining oodles of new ships. I actually managed to attach the livery to the personality of the ship. The show stopper was different mission screens in various OXPs that show some random ship and some missions regarding it. I could not get my hands on those because there is practically no hook to the model displayed on the mission screen. Or it would have needed some serious hacking.

Re: Scripting requests

Posted: Fri Jan 19, 2018 5:48 pm
by Svengali
You are right. If the entity does not explicitely declare materials in shipdata.plist you get an empty object via getMaterials().

Re: Scripting requests

Posted: Mon Mar 19, 2018 10:43 am
by Svengali
Can we get a script method to check if an image or texture file exists, please? :wink: