Page 2 of 2

Re: fire_rate coding

Posted: Sun Sep 04, 2011 4:43 am
by sdrubble
sdrubble wrote:
@Eric,
...the original is an array with strings. And every sting can be replaced by the new, corresponding dictionary for the new style definitions. You can even mix new and old style definitions to obtain an arrays filled with strings an dictionaries.
Well this is auspicious news. In other words I can just stick my 'NEW CODE' block above in place of the former single line for the turret...

That's the quickest solution I can see. I'll trust you that it will indeed work (that's the main quest), although the code will indeed look UGLY (well, Frankenstein also did BOTH, so that's not a real issue). :mrgreen:

I'll test this first with this turret which is almost 'ready', and later propagate to the other turrets. In any case I'll come back with whatever results ...
So, I'm glad to report that your suggestion is working.

While I'm doing this one or two blocks of code at a time - recode, comment, check, flight test & repeat - about half of the turrets are now properly working as new dict entries in the array, alongside with the still remaining one-liner elements. The latter will all disappear shortly.

And indeed, I can only agree with you... editing XML on a text editor is a PITA. At the moment, 1000+ lines and growing. And I certainly won't use your Python script - as it would chew and spit the comments, without which I'd be totally lost. Ten turrets mean, since I'm keeping the general subentity layout of the original, thirty blocks of code just for the turrets. Really fun work, man... :mrgreen:

While of course, the end flying result is becoming increasingly awesome with each test round ! :D :lol: :D

Cheers

Re: fire_rate coding

Posted: Sun Sep 04, 2011 9:28 am
by Eric Walch
The fastest way to convert old style to new style subentities on the mac, is just opening the cache file, copying the subentities there and paste them in the original file. That is because oolite works internally only with the new definitions and those end up in the cache file.

On the mac, the cache is in a binary-plist format that is not readable by text editors, only with the plist editor. I have no idea what the format is in other systems. Probably also unreadable by text editors.

Re: fire_rate coding

Posted: Sun Sep 04, 2011 4:35 pm
by sdrubble
Eric Walch wrote:
On the mac, the cache is in a binary-plist format that is not readable by text editors, only with the plist editor. I have no idea what the format is in other systems. Probably also unreadable by text editors.
In Windows it's mostly unreadable garbage, minus the assorted text strings sprinkled around.