User Script Extension: "ChainRuler" -- Use the ruler on more than 2 stars!

What about the map, @JayKyburz?

Updated to use the MIT license.

map should be NeptunesPride.npui.map

Also, sorry about some of the weird names. I never expected anybody to be reading the code but me.

2 Likes

LOL, I wrote almost the whole thing before realizing i could get uncompressed scripts from /gameu/ :frowning: @Qwerty told me about it.

I think it’s awesome that you let us see the client code! I love the game and I just want it to be as good as it can be :smile:

Updated to use the stuff @JayKyburz exposed and to use carrier ETA where appropriate (see update on original post).

Updated with some changes based on discussion with @JayKyburz, see the main post for details.

1 Like

Updated the ruler drawing code to adjust transparency to indicate “direction” you’re drawing the ruler. See main post for code/details.

1 Like

I like how you use Math.max I dont really a lot of other peoples code but I should!

It bothers me a little that it will still do the max comparison after it’s no longer necessary :slight_smile: As a C++ developer, JavaScript is weird and scary to me. This is me asking stupid questions of my old friend the actual web developer, lol:

haha, well I’ve only been programming a little while so still learning. C++ is too scary for me.

you created a global i in drawRuler but i fixed it.

for (i = numStars - 1; i > 0; i--) {
1 Like

Global i is all-knowing, all-seeing, all-incrementing.

And now fixed.

1 Like

Looks like the ChainRuler made it in to the game, plus an improvement to display your real ETA, warp ETA, non-warp ETA, and a reset button! Thanks @JayKyburz!

1 Like

Congratulations, @dakotahawkins!

1 Like

Yea, this is AWESOME … great job Dakota and Jay.

FYI Jay that if you select a fleet, there is a Reset button - see the image below. When I press it, it brings up the Battle Calculator - should that button be re-labeled?

Yeah that looks like an accident.

        Crux.Button("reset", "show_screen", "combat_calculator")
        .grid(19, 0, 6, 3)
        .roost(fleetInspector);

Should be

        Crux.IconButton("icon-doc-text", "show_screen", "combat_calculator")
        .grid(22, 0, 3, 3)
        .roost(fleetInspector);

Yea, I figured as much a typo - thanks for findiing the exact code;
Dakota has certainly earned his Wizard badge! :wink:

P.S.Here’s a feature request to consider.
When doing multiple stars, add a row for each waypoint … maybe number them 1-2-3-4 … and place a number at the midpoint of the ruler line between the stars.

I thought of something like that initially - maybe even adding check-boxes so you could control the gated-ness of each star.

One problem, at least for me, would be on mobile - there’s not much space to work with. A single number in the middle of the ruler, say the real ETA as it is now, might look OK, but I’m not sure how to draw what I’m thinking of in the code.

Here’s a mockup:

3 Likes

Oh WOW … that’s even better … I was thinking number’ed waypoints with a row across the top showing the times … but that is simpler and more intuitive - great UI design.

Yea, one will always be limited on mobile and other lower resolution devices … but HEY, I can tell you your code looks GREAT on my 2560x1600 sub-$400 monitor via eBay! :wink:

1 Like

sorry, fixing the calculator now!

Jeez, it’s like you’ve been asleep all day or something :stuck_out_tongue:

I am really enjoying using the chain ruler in the game.

I was wondering why it only measures to one decimal place now ,
rather than two decimal places like before ?

Maybe I have a strange request here.
Is it possible that when only measuring one path, to allow measuring to two decimal places ?
but when measuring multiple paths, then switch to only measuring only one decimal place ?