New: Javascript code to gather Galaxy Screen data as text!


#1

Jay very kindly created a little script for those who are gathering their Galaxy Screen data.

This is especially useful when playing in a team game and you want to gather the cost of buying Infrastructure across multiple Empires.
Each player can save the data to a text file and it can all be imported into a spreadsheet (like MS Excel, OpenOffice or Google Drive).
This is only recommended for those data mongers who like playing around with figures in spreadsheets to make coordinating a team streamlined. Less questions about spending, current costs and how much cash is left.

If you don’t like spreadsheets or looking at tables full of numbers, then this is not for you.

Instructions to run the script and save data:

Open up the Galaxy Screen window (mandatory for the script to work)
Open the Javascript Console (f12 in Chrome browser)

Type into the console, or Copy/Paste:

window.NeptunesPride.universe.rawExportStars

It will print a set if stats for each star that is displayed in the Galaxy screen, like this:
30,Port Dubhe,1,1,0,0,0,0,16,16

So what does this all mean?

Here is the key for each column:

universe.rawExportStar.push(star.r); (Star Resources)
universe.rawExportStar.push(star.n); (Star Name)
universe.rawExportStar.push(star.e); (Star Economy)
universe.rawExportStar.push(star.i); (Star Industry)
universe.rawExportStar.push(star.s); (Star Science)
universe.rawExportStar.push(star.uce); (Economy Upgrade Cost)
universe.rawExportStar.push(star.uci); (Industry Upgrade Cost)
universe.rawExportStar.push(star.ucs); (Science Upgrade Cost)
universe.rawExportStar.push(star.st); (Ships orbiting star, not including ships on carriers)
universe.rawExportStar.push(star.totalDefenses); (Total ships, including carriers, defending star)

Select and copy the text
Paste the data from the console into a basic text file editor (Notepad in Windows)
Save the file as a standard text file or comma separated values file (.txt or .csv)
Open a blank spreadsheet and Import that file. The software should have some automated settings to recognise and sort the data into columns without any change to the settings.
Add a row at the top and title each column according to the above key descriptions
Freeze that row and sort the columns by Economy, Industry or Science as needed (or use Auto Filters which freeze the top row anyway)

That is it. Get the data from your team mates as often as you want and compare the costs on the spreadsheet, instead of twenty questions each cycle.


#2

No need to open console. Just type this code in adressbar. :) It will show a save dialog, where you specify some_name.csv and then profit :slight_smile:

Don’t forget to remove the leading +

+javascript:Mousetrap.trigger("s");window.open("data:text/csv;base64,"+btoa(NeptunesPride.universe.rawExportStars))

[size=12]Note that this may not work in some older browsers (IE9), if so, use the following function instead.[/size]

+javascript:Mousetrap.trigger("s");window.open("data:text/html,"+NeptunesPride.universe.rawExportStars.replace(/\n/g,"<br>"))

Using this second function you will have to select the text and put it manually in a text editor. Sorry
It is still more convenient though.

[size=21]EDIT[/size]
This will create a bookmarklet, a link, which you click and it will do everything automatically.
Using this method you won’t have to paste the code into adressbar any more :)


User Script Extensions
How to make screenshot without any personal info?
User Script Extensions
How to make screenshot without any personal info?
How to make screenshot without any personal info?
#3

Thank you Qwerty.
As usual you have a way to make it even better.

Edit: the newest method still requires Galaxy screen to be open with the data you need (all stars or just yours), but does save the file automatically.

Kudos.
(Pity I can’t give you real life Kudos points, so I will resort to extra Renown points in game)


#6

Should I just add a button on the galaxy screen to save as csv?


#7

I was waiting to see if anyone else replied.
Seems like an excellent idea to me.
But I would say that, wouldn’t I?


#8

Yes please!

Personally, I’d also love an export for the public player data too (tech levels, ships, ship production, number of stars, number of carriers, status (alive, ko, afk)).


#9

Is there an update on this?


#10

This is pretty cool. However, since I’m pretty new to Triton, when would I use this data or how could I use this data to my advantage?

Thanks!


#11

For different calculations… such as:
Terraforming Calculator (by Christopher Sharman)

found here: Terraforming Calculator


#12

This would be great!


#13

Try the tool created by @Dysp .

First you must register an account with his tool.

Second when you want to record one tick of NP2 game data, shortcut key “O” goes to Options, click “Generate” button and read the API code. Then plug in the API code into Dysp’s tool.


#14

Super,
I was trying it in Chrome for a while without luck
Works great in microsoft edge
Thank you!


#15

It works for me in browser Google Chrome on a PC.