userscript: VPA-like object selection

« Back to Developers

2652 days, 9 hours, 18 minutes ago
Profile Image
xeye
userscript: VPA-like object selectionWrite Reply
Hi, 
I've made small userscript to make map objects selection to be more VPA-like:

1. when you click on your own planet you always get planet view, not the list from the planet/ships orbiting.
2. when you already have an object selected and click somewhere, you have new object selected, if you want to set a ship waypoint or see a distance ruler click with ctrl key pressed.

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

suggestions are welcome


2651 days, 13 hours, 41 minutes ago
View lord helmet's profile
lord helmet
RE: userscript: VPA-like object selectionWrite Reply
Seems not to work for me, behaviour is still the same. I investigated a little, but I couldn't find the reason. The new function seems not to be used or the old version is not overwritten or something...
When I entered the functions via the console, clicks on own planets wouldn't open anything.
Has anyone else tried it? I use Firefox 12 on Linux Mint 12.
2651 days, 13 hours, 8 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
hmm, I checked in chrome only.
will test with FF soon
2651 days, 10 hours, 42 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
reworked for FF compartibility, uploaded to userscripts.org
2651 days, 10 hours, 24 minutes ago
View lord helmet's profile
lord helmet
RE: userscript: VPA-like object selectionWrite Reply
Allright, works for me now!
But what made the difference? The append and remove part? Maybe you've got some hints for future utility scripters?
2651 days, 10 hours, 3 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
I just checked some existing scripts and few of them did work in both browsers, so I borrowed some code
1) used @include instead of @match
2) used a bit different script inclusion code

2651 days, 8 hours, 6 minutes ago
View anathesos's profile
anathesos
RE: userscript: VPA-like object selectionWrite Reply
Excellent xeye, thanks for that!

Easy Warpwell selection suggestion:
Do you think it would be possible to include "Alt + PlanetWaypoint" in ship view to automatically select the shortest waypoint to the warpwell of that planet (shortest distance to travel)?
2650 days, 15 hours, 6 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
>Easy Warpwell selection suggestion:

yes, I already have draft implementation for this,
I think I'll finish my tests and release it in a week or two.
2650 days, 7 hours, 59 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply

done.

there're few glitches cause planets.nu object selection logic is still odd, but the overall functionality is pretty usable.

This small userscript makes map objects selection to be more VPA-like:

1. When you click on your own planet you always get planet view, not the list from the planet/ships orbiting.
2. When you already have an object selected and click somewhere, you have new object selected, if you want to set a ship waypoint or see a distance ruler click with Ctrl key pressed (automatic grav.well usage) or Alt key (grav.well will not be used)
3. Whenever you set a ship waypoint, gravity well is used automatically, and also a warp speed (maximum according to ship's engines)
4. If you don't want to use a warp well, or if you want to use manual waypoint inside a well, click with Alt pressed. Warp is always set automatically cause it's pretty rare case when you need to have non-maximum warp according to your engines (e.g. grav.well movement at 1 warp)

http://userscripts.org/scripts/show/132880
(if you already have installed older versions you may still have it cached in browser, in this case use url like http://userscripts.org/scripts/show/132880?somerandomstuff)

DON'T USE it together with my another script http://userscripts.org/scripts/show/132971 -- it's added for those who prefer standard phost.nu object selection.

still VPA is superior game client :))) and phost is superior host
2650 days, 7 hours, 49 minutes ago
View anathesos's profile
anathesos
RE: userscript: VPA-like object selectionWrite Reply
Awesome, thanks a lot!! :)
2650 days, 6 hours, 9 minutes ago
Profile Image
suntzu
RE: userscript: VPA-like object selectionWrite Reply
Hi Xeye, cool idea!

Unfortunately I am on Mac and on Safari. Ctrl-click is wired to right mouse button in OS X and alt click does not seem to work. Any way to change the key-bindings? I don't understand your script I must confess...
2650 days, 5 hours, 47 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
>Unfortunately I am on Mac and on Safari. Ctrl-click is wired to right mouse button in OS X and alt click does not seem to work. Any way to change the key-bindings? I don't understand your script I must confess...

I've just added meta (Command) key handling though it may be still screwed.
2648 days, 14 hours, 28 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
I like the clicking to get straight to the planet view.
clicking while holding Ctrl to set a way point is annoying.  The times I play on my deck smoking a cigar, I only have one free hand :)
2648 days, 14 hours, 16 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
> I like the clicking to get straight to the planet view.
clicking while holding Ctrl to set a way point is annoying.  The times I play on my deck smoking a cigar, I only have one free hand :)

there are certain limits in the planets.nu UI technique, so all I can offer is middle mouse button click to set a waypoint. does it fit you?
2647 days, 19 hours, 12 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
script was updated to include new play.planets.nu URL and middle mouse button handling
2642 days, 7 hours, 49 minutes ago
View capnkill's profile
capnkill
RE: userscript: VPA-like object selectionWrite Reply
One quick little bug, or two perhaps:

1. The warpwell thing doesn't work when you do multi waypoints.. so if my first waypoint is in deep space and my second is to a planet, the second waypoint will not sue the warpwell.

2. If your ship has damage it shouldn't use maximum warp, it should use maximum warp available based on the damage you have.  That could be misleading for some, thinking that htey'll get to their destination in 1 turn when really it would take 2 if  the damage limited travel to warp 7 or something like that.

Also to add to #2, it would be super awesome if the warp setting for a damaged ship would take into account the supplies on board... so if I have 30% damage but I had enough supplies to repair it all, it would say Warp 9 as opposed to warp 7... 

Either way, this is one of the best scripts here, so these are just minor things, not a huge deal either way. 

Thanks again!!
2641 days, 14 hours, 42 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
ver. 0.1.18
+ warp set according to the current ship damage and checking supply repair (including lizards damCap)
* shift removed from non-warp keys check, so you can use well movement with multiple waypoints, use alt to skip wells.
2632 days, 17 hours, 51 minutes ago
View capnkill's profile
capnkill
RE: userscript: VPA-like object selectionWrite Reply
One more minor note.

If I use "ALT" + Waypoint in the Warp well it should maintain my warp... so if I'm warp 1 it should stay that way I think.

Actually it does do that, which is good, the only time it does not is if my waypoint is in the warpwell and it is a ship.  Then it seems to switch me to warp 9.
2630 days, 14 hours, 39 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
ver. 0.1.19
+ when you hover a minefield, show number of torps needed to lay this minefield, with/without Robot bonus
2630 days, 8 hours, 37 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
Hey Xeye,

Found a bug.  the code seems to treat any waypoint that is clickable as having a warp well, ship or planet.  in cases of planets, that works well.  but if you try to target a ship in space using the Ctrl key, it sets the target to the "warp well" surrounding a ship.  same thing happens if you want your ship in space to be stationary, Ctrl click on it to set its coordinates to its own location, it instead sets them 3 ly away.  major problem if you are trying to orchestrate meetings in space as a pirate typically does.

I like most other features of this client, but holding down Ctrl in general to move anything will take some getting used to.  could that one feature perhaps be made optional and be able to be disabled through the settings page?
2630 days, 8 hours, 7 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
one more bug.  your script does not play nicely with the map drawing script.  it disables the ability to click on a map to add any markings.  tried it with pressing alt or ctrl with no effect.
2630 days, 7 hours, 51 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
ver. 0.1.20
* bugfix: non-planet waypoints are not treated as planets having warpwells anymore.

As for Ctrl-clicking -- it's done for those guys who don't have middle mouse button. I never use Ctrl click myself, just using middle click.

As for map drawing, it works for me perfectly (just checked with ver. 0.5)
2630 days, 7 hours, 23 minutes ago
View big beefer's profile
big beefer
RE: userscript: VPA-like object selectionWrite Reply
I think map drawing should work if it is run after this script, but probably won't work if they're run in the other order. Haven't tried it, but that would be my guess from glancing at the code.
2630 days, 7 hours, 9 minutes ago
View capnkill's profile
capnkill
RE: userscript: VPA-like object selectionWrite Reply
I just use ALT + Click when I want to go straight to an object, seems to work very well.

Xeye, would you be able to add a feature that shows the actual location of an enemy ship when you click on that ship or hover over it?
2630 days, 4 hours, 13 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
big beefer, how do you select what order the scripts load?  i use greasemonkey in firefox.
2630 days, 4 hours, 12 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
the problem with the middle mouse button is that i have the stupid scroll wheel instead of the true button and that is a pain to use, and also brings up the multiple open pages selection window that you get in windows 7.  can support for the left side mouse button (on the side of the mouse) (4 or 5 dont remember) be implemented for the ctl command and maybe the little mouse button on the right sidewall of the mouse be equivalent to holding down alt?
2630 days, 1 hours, 8 minutes ago
View big beefer's profile
big beefer
RE: userscript: VPA-like object selectionWrite Reply
Vepr, you can set the order of scripts in the greasemonkey "Manage User Scripts" screen. In the upper right there should be an "execution order" item. There you can right-click the scripts and make them run earlier or later.
2629 days, 23 hours, 59 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
yup, you are right, rearranging the order fixed it.   thanks!
2629 days, 19 hours, 46 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
>the problem with the middle mouse button is that i have the stupid scroll wheel instead of the true button and that is a pain to use, and also brings up the multiple open pages selection window that you get in windows 7.
>can support for the left side mouse button (on the side of the mouse) (4 or 5 dont remember) be implemented for the ctl command and maybe the little mouse button on the right sidewall of the mouse be equivalent to holding down alt?

I guess you just need to check the software coming with your mouse, it should be able to configure mouse buttons etc. Browser script API does not have access to the values of these extented buttons directly.

If you have other ideas about attaching "select waypoint" event, I'll consider these options.
2628 days, 12 hours, 42 minutes ago
Profile Image
suntzu
RE: userscript: VPA-like object selectionWrite Reply
Hi
first of all let me thank you for this wonderful script. I like so much that you don't always have to press 'x' to click on the next ship. 

However, I have a problem: I cannot click on ships of my ally any more! Enemy ships I can click but if I click on a ship of my ally nothing happens. This is a real problem!
2628 days, 12 hours, 29 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
>However, I have a problem: I cannot click on ships of my ally any more! Enemy ships I can click but if I click on a ship of my ally nothing happens. This is a real problem!

I don't have any ally ATM to check, what do you specifically mean by 'click' in this case and what's expected behavior? I can't figure out the context, if I just to try to select-click enemy ship, it also does not work for me.
2628 days, 11 hours, 54 minutes ago
Profile Image
suntzu
RE: userscript: VPA-like object selectionWrite Reply
when I click on an enemy's ship I get the ship window popping up. Same as without your script if nothing was selected previously.

When I click on a ship in deep space of an ally nothing happens. The ship info screen should pop up so I can see what kind of ship it is, which beams, cargo, etc.
2628 days, 8 hours, 2 minutes ago
View capnkill's profile
capnkill
RE: userscript: VPA-like object selectionWrite Reply
This is true, I can confirm Suntzu's observation
2628 days, 6 hours, 54 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
ver. 0.1.21
* bugfix: now ship selector is shown for enemy ships stack
+ when we have our ship among other ships or over enemy/neutral planet, always select the ship
+ show the actual location of a ship in hover info

2628 days, 6 hours, 37 minutes ago
View capnkill's profile
capnkill
RE: userscript: VPA-like object selectionWrite Reply
It is hard to put into words the pure awesomeness of your contributions Xeye.  

Thank you!! 

2623 days, 11 hours, 45 minutes ago
Profile Image
suntzu
RE: userscript: VPA-like object selectionWrite Reply
Thank you!
2620 days, 22 hours, 26 minutes ago
View vepr's profile
vepr
RE: userscript: VPA-like object selectionWrite Reply
do we know if this works with the newest version yet?
2620 days, 18 hours, 33 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
>do we know if this works with the newest version yet?

can you be more specific? what's working with what version of what?
2601 days, 0 hours, 27 minutes ago
View n@ndus's profile
n@ndus
RE: userscript: VPA-like object selectionWrite Reply
lol :-)

unfortunately I face another issue: I cant't choose "save" or any color when I placed a waypoint (Circle etc.) using your script. Browser is firefox (latest regular built), newest version of your tool.

Its just like clicking on the starmap "behind" the tool window. Only coordinate setting is possible by using the "tab" button. wierd. Can you help?

2600 days, 18 hours, 5 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
>Its just like clicking on the starmap "behind" the tool window. Only coordinate setting is possible by using the "tab" button. wierd. Can you help?

I suppose you're confusing me with the author of map drawing addon, blame him please :) My addon does not affect the behavior you described
2600 days, 4 hours, 14 minutes ago
View big beefer's profile
big beefer
RE: userscript: VPA-like object selectionWrite Reply
n@ndus, the map drawing script has been updated to work a little better with the new code
2599 days, 9 hours, 22 minutes ago
View n@ndus's profile
n@ndus
RE: userscript: VPA-like object selectionWrite Reply
@big beefer: great that you found this post although its under the wrong topic :-)

AND: version 0.9 of your tool IS WORKING! yeah! as a former VPA user this instrument is essential

But also your other scripts rock - excellent work!

(BTW: I hope the cat on your pic is not your cat .-))
2583 days, 1 hours, 53 minutes ago
View spiper's profile
spiper
RE: userscript: VPA-like object selectionWrite Reply
I added code to hitTextBox to print if the planet had a starbase and if it was building anything.  I also added waypoints & mining rates but it's a pain to paste it here.

-Stephen

var starbase;
if (starbase = vgap.getStarbase(hit.id)) {
    txt += "[tr][td]Starbase[/td]";
    if (starbase.isbuilding) {
        var hull = vgap.getHull(starbase.buildhullid);
       txt += "[td colspan='2']Building: " + hull.name + "[/td][/tr]";
    }
}
2449 days, 6 hours, 27 minutes ago
Profile Image
xeye
RE: userscript: VPA-like object selectionWrite Reply
http://userscripts.org/scripts/show/153116

made a separate script to support planets.nu v3 changes

changed mapping in the script for v2 to ignore play.planets.nu