Script Request (XML Extraction)

« Back to Developers

2586 days, 6 hours, 12 minutes ago
View mycroft's profile
mycroft
Script Request (XML Extraction) Write Reply
Greetings,

I'm wondering if it is at all possible to extract XML data from your ship list in game. I'm wanting to be able to "Copy" all data under the "Starships" tab of the Dashboard Viewer. I'm very big on having external lists for each game I play where I try to create a known ship list file so I can attempt to keep up with what all ships are built. Having the ability to at least copy down my information will save me a lot of time.

Thanks,
2585 days, 11 hours, 2 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
Just yesterday I had a similar idea: wouldn't it be great to have a list of all ships known?
I'd want to use it for my userscript that loads ships into the VCR simulator, and now we know about the armory of ships we fought earlier, they could be loaded there too (I will release this in a few days).
Data on NU is stored in JSON format, somewhat better than xml in online uses and easy to extract. I don't know about importing it to a spreadsheet. But that should be a standard problem with some solution on the web.
I will look into this when I find a quiet minute or two.
2585 days, 5 hours, 41 minutes ago
View nakor's profile
nakor
RE: Script Request (XML Extraction) Write Reply
That's a good idea and reminds me of the Echoview feature. If possible, please also provide that list in-game. That would be nice! :)
2585 days, 3 hours, 28 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
Okay, I've got a csv output ready but have to leave now, so I cannot upload the script. the following properties of ships are included, if you need more (like mission or enemy) just say the word.

id
name
friendlycode
x (Position)
y
targetx
targety
damage
engineid
beams
beamid
torps (launchers)
torpedoid
mass
neutronium
duranium
tritanium
molybdenum
supplies
clans
megacredits
ammo
2584 days, 20 hours, 52 minutes ago
View mycroft's profile
mycroft
RE: Script Request (XML Extraction) Write Reply
At least for my uses, all I would really want in a list is;

Ship Id #
Hull Type
Controlling Player
Armament (Numer and type of beams/tubes/bays)
Known propulsion speed
Known ammo 
Known damage
Number of turns since last spotted
Estimated max fuel based on mass and known cargo/armament.

I think anything more then this is erroneous information. So maybe have the option to export only certain information. I'm sure someone would like a system with more or less information. I personally would prefer a spreadsheet like feature. If it could be viewed as another one of your dashboard systems I would be amazed. That would be one less thing for me to rely on google drive so I can have all my information available in a more condensed fashion.

Even better if the information could be reciprocated to the ship views inside the game also. For some cream on that cake lol.
2583 days, 2 hours, 8 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
Okay, here we go. Actually it's two different things implemented in one userscript.

http://userscripts.org/scripts/show/138532

In the ship list two new things can be found: First there is a link to download the own shiplist with the properties I mentioned above (plus hull name). This is a text file with comma separated items (csv) which can be easily imported or recognised by any spreadsheet-program. Exporting enemy ships is more complicated, but I can add that later - if you say "please" a lot.
But enemy (used as a synonym for "not own") ships are shown in an extra tab of the ship list. I highlighted (or better "lowlighted" because it's grey not white) unknown properties of the ships. I took mycroft's list as a guideline, the fuel estimation is a great idea (hope I didn't screw it up)! For now it is only the enemy ships that are visible the current turn.
There are some little bugs right now (for instance, don't use the time machine or the links will disappear and come back only after reentering the game) but they're going to be fixed in a few hours.

As always feel free to suggest changes, report bugs or throw insults (the latter in private messages please).
2583 days, 1 hours, 27 minutes ago
View big beefer's profile
big beefer
RE: Script Request (XML Extraction) Write Reply
I'm getting an error when I try to view the known enemy ships:
--
[12:15:13.752] vgap.getTorp is not a function

there is a vgap.getTorpedo function
2583 days, 1 hours, 13 minutes ago
View big beefer's profile
big beefer
RE: Script Request (XML Extraction) Write Reply
Actually, might try this for line 181:

        if (hull.launchers>0 && ship.torps>0) fuel-= ship.torps*vgap.getTorpedo(ship.torpedoid).mass;

Worked fine for me with that change (and looks really good too). A useful tool. Min/max fuel would be nice to have when you click on an enemy ship on the starmap too, if you should find the time and interest.
2583 days, 1 hours, 6 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
You're right! Already fixed it... quite confusing with all those torps, torpid, launchers, torpedos - all mixed up.
I'll have a look where to put the fuel calculation, but too many overlays on the map from the userscripts might influence one another...
2583 days, 1 hours, 3 minutes ago
View big beefer's profile
big beefer
RE: Script Request (XML Extraction) Write Reply
Also, for some odd reason when I click on a cat's paw in the enemy ship list, it won't take me to that ship. Seems to work fine for all the others. Maybe the ' is messing something up?
2583 days, 0 hours, 35 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
LOL great, look what it does to the code:
title="CAT" s="" paw="" destroyer'onclick="[stuff]"

I'll bet extraordinary ship names might do similar or worse stuff.
2581 days, 17 hours, 14 minutes ago
View big beefer's profile
big beefer
RE: Script Request (XML Extraction) Write Reply
For the first problem above, when I downloaded the new version (over my edited copy) it was back,. Still need to change the ship.torpid to ship.torpedoid I think.

Also, you can get some weird results with the min/max fuel estimates when you've seen a ship fight, because now that the armament is remembered, ships are assume to have whatever ammo they had when last seen. I have an enemy cat's paw that is shown as having 0 possible fuel (min & max) because when it fought my planet it had a whole slew of torps it has since turned into a lovely minefield. But since we're calculating possible fuel including those torps as cargo we get a result saying there cannot possibly be fuel on the ship. I'm not sure if it's better to include ammo in the calculation or not, but something to be aware of
2581 days, 10 hours, 26 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
Somehow I uploaded a wrong version last time. Now there's v0.5
torpedoid has been changed, as well as a dirty fix for the Cat's Paw.
More changes: Ships with a warp >0 have at least one kt of fuel.
I removed the ammo from fuel calculation, you're right, beefer - it changes just too easily. Super Refit could mess with the mass again, but that's a really special case.
Ownerless ships (crew killed in radiation) used to kill the whole table, that's fixed now.

Not released but on 2do-list: (edit: oops, I already released it, but seems to work fine. Sometimes there's so much data to save, that http-error 414 occurs. In that case we can't be sure everything's saved)
I'm currently trying to save and load data, so info from older turns can be merged to the current list. The newest ship data will always be used (also when another turn is viewed in time machine) because it's such a mount of data to save every turn's info. For the beginning, one will have to load every older turn to be sure all ships go into the list. But the current turn will always update the list.

Don't know yet what to do with destroyed ships. For now a new ship with the same id will overwrite the old one - that's the easy way. There can still be some wrong ships in there, like when they're captured by the player or when the id has been given to a ship that is never seen.


2580 days, 2 hours, 19 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
I had to release another version. When the list of ships is very long sometimes the recent changes were not saved. This includes all changes and moves that were made after the last save (which occurs quite often luckily.)
Hope nobody lost any serious data by this. I removed useless data from the shiplist to make it smaller and use localStorage now.
2575 days, 15 hours, 4 minutes ago
View big beefer's profile
big beefer
RE: Script Request (XML Extraction) Write Reply
I'm having another issue with this. There appears to be some sort of conflict between this and the improved hover text script for ally ships. After viewing the known enemy ship list, the cargo of all allied ships shows as "undefined" in the hover text. It appears fine before I view enemy ships. When you delete the "useless data", are you by chance clearing it out of the actual vgap.ships array (or a shallow copy of the objects in it)?
2575 days, 13 hours, 11 minutes ago
View lord helmet's profile
lord helmet
RE: Script Request (XML Extraction) Write Reply
You're right, I deleted all the info from ally ships too, and I hadn't been aware that some objects were still referenced directly. But this was only in versions 0.6 and 0.7 (current is 0.8). Now nothing should be deleted any more. This means a lot of unused text and it cannot be saved to the server (unless splitting it to multiple notes). I will take care to use copies only. As far as I can see it's only one location in the code. Update will follow tonight (CEST), adding min/max fuel to ship scan screen.

@all: take care to update to at least version 0.8, because older versions might lead to data loss.
2524 days, 3 hours, 40 minutes ago
View mycroft's profile
mycroft
RE: Script Request (XML Extraction) Write Reply
Lord Helmet, 

I'm not sure if a recent update occurred or perhaps I have two conflicting scripts in operation, however the "Known Enemy Ship" list has ended up becoming a blank screen. (If you need a list of extensions I use I can do that, along with any other help I can be.)

Other then that I really do like the functionality of it. Perhaps making another edition to separate between Allied, Neutral (Share Intel/Safe Passage), and Enemy ships based on owner and current mutual diplomatic stance. So you can only see one or the other,