User Script Extensions

@Qwerty has been writing some awesome scripts that enhance the game and I do plan to integrate some or all of it into the game officially. I have even asked if he would like to be paid to work on my new game but he is too busy with study.

**However I just wanted to remind everybody that when you run another users script in your browser you are handing them the keys to the kingdom, you have to trust them entirely. **

Scripts like these can download all your diplomatic messages, trade your money away, abandon your stars, and probably even read your password if the script is loaded when you login.

Lots of bad stuff can happen!

Please think twice before loading these and only run a script from players you trust.

Jay.

2 Likes

Definitely agree.

###EDIT
I think I am gonna make a list of my scripts of this post :slight_smile:


#Bookmarklet Bookmarklet is a button, a bookmark with javascript function instead of page's url. Clicking the bookmark won't redirect the browser, but will instead execute a desired functionality within current page, making it reusable and super easy to use. (All scripts listed below are made to be compatible with bookmarklet format.) -> [But how to make it?][1] <-

#


Alliance map highlights

Latest version: 1 2
More information here!

#


Mouse selection tool to limit Bulk Upgrade

Latest version: 1
More information here!

#


Mouse binding to capture a fullsize screenshot

Pressing U will pop up a window to save a screenshot, add extension .jpg and confirm.

[size=11]Copy-paste it into adressbar and remove the leading + sign.[/size]

+javascript:Mousetrap.bind(["u","U"],function(){window.location.href=document.getElementsByTagName("canvas")[0].toDataURL("image/jpeg").replace("image/jpeg","image/octet-stream");});

[size=11]HINT: If you zoom out the browser window (Ctrl+-) and create screenshot using this function, it will actually make it with much bigger resolution due to decreased content size.[/size]

#


Script to gather Galaxy Screen data as csv.
There is a way to display the Galaxy Screen data in console. This little script will prompt a save dialog automatically, or open the data in new tab, which then allows you to CTRL+S save it.

[size=11]Copy-paste it into adressbar and remove the leading + sign.[/size]

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

For more information and tricks how to use it with ease see this thread. There is also a workaround for IE.

#


Web API to access public galaxy data

returns JSON

More information here!


#API2.0, the NP2 database
with more than 3 milion items.
Read more here.

1 Like

Scripts like these can download all your diplomatic messages, trade your money away, abandon your stars, and probably even read your password if the script is loaded when you login.

But presumably NOT if you can inspect the source code before using it?

1 Like

Yes, if you know how to read the scripts you should be fine.

Awesomizer has got quite large - it wouldn’t be too hard to sneak something malicious in. You would have to be pretty thorough inspecting the source.

In this case, however, I trust that qwerty isn’t doing anything he shouldn’t :wink: and I’m ok with taking the risk if he does.

1 Like

Ah, that would explain how Qwerty won the last 5 games I was in when he wasn’t even a player…

:slight_smile:

3 Likes

What what ?? :smiley:

Where’s my badge, damn! :smiley:

Is there somewhere central to browse the scripts you and perhaps other users have created?

There used to be, it was for all greasemonkey scripts, but the site is now off. There was only 1 other NP related user-script anyways.

I was trying to write one but had a couple of questions. If you are on google hangouts, would you mind me asking you a couple of questions?

1 Like

If you meant me, then sure, go ahead. I see you already added me to your circles :)

##Script to gather Galaxy Screen data as csv.
There is a way to display the Galaxy Screen data in console. This little script will prompt a save dialog automatically, or open the data in new tab, which then allows you to CTRL+S save it.

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

For more information see this thread.

Script to use the ruler for more than two stars: “ChainRuler”

See here!

1 Like

##API to access public galaxy data

returns JSON

More information here!

I also want to state for the record that, because the game is always evolving, there may be changes to how data is communicated. I may accidentally break your scripts from time to time without warning.

2 Likes

##Mouse selection tool to limit Bulk Upgrade

More information here!

#Mouse binding for capturing a fullsize screenshot

Pressing U will pop up a window to save a screenshot, add extension .jpg and confirm.

[size=11]Copy-paste it into adressbar and remove the leading + sign.[/size]

+javascript:Mousetrap.bind(["u","U"],function(){window.location.href=document.getElementsByTagName("canvas")[0].toDataURL("image/jpeg").replace("image/jpeg","image/octet-stream");});

[size=11]HINT: If you zoom out the browser window (Ctrl+-) and create screenshot using this function, it will actually make it with much bigger resolution due to decreased content size.[/size]

#How to create Bookmarlet?

#NP2 database
I’ve been collecting NP2 data of games I was in since 25.5.
14 games with more than 3 M items in a size of 170 MB.

If you use spread sheets reguralry for your games, have any programming skills or knowledge of plotting data to graphs, or if you are just bored or curious, contact me :wink:

I am offering access to my (complete) API in exchange for some tools you will make publicly available for others.

for example: The most desired functionality which started all this is to draw the stored data to a graph and then to switch between the ticks to provide a historical view without the need of making screenshots.

the database

recorded games

EDIT
The data I record is

Once for every game

  1. games
  2. players
  3. stars

Every two hours

  1. stars_owners_rel
  2. players_data

Here are the columns:

I am storing pretty much everything except fleet moves.

@Qwerty , I am curious (and sometimes bored), but I was also interested in starting to work (fiddle) with the API, maybe coming up with somthing interesting… And if you think this is somthing useful, great, I can try making somthing up.
(Also, I’m not sure if I understood exactly, ¿Is this like a “recording” of games? ¿In order to make like a “Replay game” feature? ¿Like when you end a Sid Meier Civ?)