Looking for more data from shiptypes via script

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

Hi!

I'm looking to make a more informative Ship Configuration dockscreen, as I often can't remember what various ship capabilites are, and because I'm sick of referring to xml files to see what my (UG) wingmen can do/use.

I seem to be finding that there isn't any way, however, to get these pieces of data:
  • maxCargoSpace
    maxDevices
    maxWeapons
    maxNonWeapons
    maxArmor
Am I mising something? I've tried all of the likely fooGetStuff functions that would work for it. If I'm not, I guess I can get these experimentally, just wanted to check first :). (Also it might be a PITA for armor, and I don't know of a way to store the data for a specific ship without it being copied when the player switches. (OTOH it's one screen, so recalcing it each time might be ok.))

Aha, I just found out how to get the manuverability and thrust to weight and the modified cargo space for a ship instance, though. Though I don't understand two of these numbers; how manuver works at all or why TTW is 400 when a total-mass-1-ton ship has 200 thrust...
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

There are a lot of xml attributes we can not get a hold of via script.

I went down that road some time ago, and complied a list of all that i could gather about ships. You can find it on xelerus here http://xelerus.de/index.php?s=mod&id=321

Recalculating in screens is no big deal... i build some pretty heavy screens and i have yet to see them stutter.

BTW, if you are building dockscreens and you are into scripting you might be interested in the soon to be finished DockScreenFramework It has little to no docs yet, but that will come. It works like a charm however :)

Hope that helps you.
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

Oh wow, a listing on Xelerus I've never seen before. I thought I went through all the listings :D.


....


Wait, I did see that, because I remember the tale of two cities comment. I guess I just didnt' realize what it was :D.

And yeah, i've heard of the DSF (for one thing, it comes up in the Captains' Log docs), but I haven't looked into it yet.
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

*tinker tinker* Aha! I have found a decent method to obtain the max relevant armor weight for a ship; that is, the mass of the largest armor piece currently existing in the game that the ship can support:

Code: Select all

(setq wvrGetMaxArmor (lambda (theShip)
 (block (armorSamples anArmor aMass maxMass)

  (setq armorsamples (atmAtomTable nil))
  (setq maxWeight 0)
  ; Save the last item fond of each mass
  (itmEnumTypes "a" anArmor
    (atmAddEntry armorSamples (itmGetMass anArmor) anArmor)
  )
  ; Check one armor of each extant mass against ship
  (enum (atmList armorSamples) aMass
    (if (eq (shpCanInstallArmor theShip 
              (atmLookup armorSamples aMass)) 0)
      ; The atmlist is already sorted,
      ; so the last one that matches is highest
      (setq maxMass aMass)
    )
  )
  maxMass

)))
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

BTW, I'm always happy to add more data field to the typGetDataField function. If there is info that you need for a ship class, add a ticket to the Trac database.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

george moromisato wrote:BTW, I'm always happy to add more data field to the typGetDataField function. If there is info that you need for a ship class, add a ticket to the Trac database.
Hmm, with the fear of sounding obnoxious, how about all of them? :)
Is there something that keeps you from adding them across the board?
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

alterecco wrote:Hmm, with the fear of sounding obnoxious, how about all of them? :)
Is there something that keeps you from adding them across the board?
Time is always the limiting factor.

There are many other feature requests that people want, so I try to work in priority order.

I know you know this, but for others: I use Trac to keep track of all feature requests and to prioritize my work. If you want to influence what I work on, the best way is to add a ticket to Trac:

http://wiki.neurohack.com/transcendence/trac/report/3

And if you want to increase the chances of getting your ticket fixed, follow these guidelines:

1. Create bite-sized tickets. Major changes to the engine often get deferred.
2. For bugs, give as much info as possible to reproduce. Include a relevant mod if possible.
3. For feature requests, describe exactly what you want. Vague requests are easy for me to defer.
4. Set the "priority" field properly. Don't add too many high-priority tickets or I won't know what to fix.
5. Try to avoid duplicate tickets, but don't assume that someone else has reported a problem.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Star Weaver wrote:

Code: Select all

(setq wvrGetMaxArmor (lambda (theShip)
 (block (armorSamples anArmor aMass maxMass)

  (setq armorsamples (atmAtomTable nil))
  ... snip ...
Nice and well written function. Just a word of advice. As far as i know atmAtom* functions are deprecated, or rather, leftovers from an implementation that was never finished (and is not intended to be finished)

Instead just use the common list, and the find and lookup functions.
Also, you don't need to declare the enumeration variable as block local.

I took the liberty of rewriting your function using lists as an example here:

Code: Select all

(setq wvrGetMaxArmor (lambda (theShip) 
 (block (maxMass) 

  (setq maxMass 0)

  (itmEnumTypes "a" anArmor (block (mass)
    (setq mass (itmGetMass anArmor))
    (if (and (gr mass maxMass) (shpCanInstallArmor theShip anArmor))
      (setq maxMass mass)
    )
  ))
  maxMass
))
Hmm, after having rewritten it a couple of times i ended up simplifiying it to what you see above... it should yield the same results (please correct me if I misread your function). Not much of an example for the use of lists though o.O

It can be compressed even more, if one were into that kind of thing (must resist temptation)
User avatar
Arisaya
Fleet Admiral
Fleet Admiral
Posts: 5535
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

george moromisato wrote:
alterecco wrote:Hmm, with the fear of sounding obnoxious, how about all of them? :)
Is there something that keeps you from adding them across the board?
Time is always the limiting factor.

There are many other feature requests that people want, so I try to work in priority order.

I know you know this, but for others: I use Trac to keep track of all feature requests and to prioritize my work. If you want to influence what I work on, the best way is to add a ticket to Trac:

http://wiki.neurohack.com/transcendence/trac/report/3

And if you want to increase the chances of getting your ticket fixed, follow these guidelines:

1. Create bite-sized tickets. Major changes to the engine often get deferred.
2. For bugs, give as much info as possible to reproduce. Include a relevant mod if possible.
3. For feature requests, describe exactly what you want. Vague requests are easy for me to defer.
4. Set the "priority" field properly. Don't add too many high-priority tickets or I won't know what to fix.
5. Try to avoid duplicate tickets, but don't assume that someone else has reported a problem.
To use the trac, you first need to have your account permissions changed to allow submittig tickets (spambot prevention), so you will need to go on IRC and talk to Gambit-. The process normally takes only a few minutes, unless Gambit is away from his computer x_x
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

george moromisato wrote:
alterecco wrote:Hmm, with the fear of sounding obnoxious, how about all of them? :)
Is there something that keeps you from adding them across the board?
Time is always the limiting factor.

There are many other feature requests that people want, so I try to work in priority order.

I know you know this, but for others: I use Trac to keep track of all feature requests and to prioritize my work. If you want to influence what I work on, the best way is to add a ticket to Trac:

http://wiki.neurohack.com/transcendence/trac/report/3

And if you want to increase the chances of getting your ticket fixed, follow these guidelines:

1. Create bite-sized tickets. Major changes to the engine often get deferred.
2. For bugs, give as much info as possible to reproduce. Include a relevant mod if possible.
3. For feature requests, describe exactly what you want. Vague requests are easy for me to defer.
4. Set the "priority" field properly. Don't add too many high-priority tickets or I won't know what to fix.
5. Try to avoid duplicate tickets, but don't assume that someone else has reported a problem.
this are very good guidelines for tickets, what about having them at the welcome page of the tracker ?
User avatar
Arisaya
Fleet Admiral
Fleet Admiral
Posts: 5535
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

Include instructions on how to get activated though!
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

alterecco wrote: I took the liberty of rewriting your function using lists as an example here:

Code: Select all

(setq wvrGetMaxArmor (lambda (theShip) 
 (block (maxMass) 

  (setq maxMass 0)

  (itmEnumTypes "a" anArmor (block (mass)
    (setq mass (itmGetMass anArmor))
    (if (and (gr mass maxMass) (shpCanInstallArmor theShip anArmor))
      (setq maxMass mass)
    )
  ))
  maxMass
))
Hmm, after having rewritten it a couple of times i ended up simplifiying it to what you see above... it should yield the same results (please correct me if I misread your function). Not much of an example for the use of lists though o.O
Wow, I missed this post, and that code is so much better... *noms*
Post Reply