Page 1 of 1

Eyedropper - An easier way to pick items from your inventory

Posted: Tue Aug 04, 2015 8:52 pm
by Tinyboss
NOTE: This mod is deprecated. I made a much better version using billw's excellent suggestion.

Type: Mod
Name: Eyedropper
Description: Easier selection of items from your inventory.
License: Public domain
Version: 0.0.2
Release: 2015-08-07
Tested-With-Factorio-Version: 0.12.2
Category: Convenience
Tags: Inventory, Convenience
Download-Url: https://dl.dropboxusercontent.com/u/118 ... _0.0.2.zip
Website:
License
Long description
Version history

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Fri Aug 07, 2015 4:25 pm
by Lemures
To anyone curious about if you should use this: You should. I did not expect it to add as much to the game as it does.

To tinyboss: I'm not familiar enough with modding to know: Is there a way to only have this work if the mouse is within a bounded box of, say, 20% the screen size or so? Too often I rest the mouse over something to see its status (such as the amount of fluid in a pipe) and that item gets selected. If this behavior only occurred if I was relatively near the item, I feel this would be better. Also, please just email the devs and ask how to get the middle mouse working. This would make this one of the top downloaded mods I'm sure :). Thank you for the work you put in, this is a great mod!

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Fri Aug 07, 2015 4:28 pm
by OBAMA MCLAMA
If he can get the entity under the cursor, im sure he can get the distance between player and entity.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Fri Aug 07, 2015 5:35 pm
by Tinyboss
Thanks for the feedback!

Having used it myself for a couple of days, I realize that it does get in the way of checking the status of things. I considered limiting it to a radius around the player, but I use it on distant objects frequently enough that I decided against that. Of course, the ideal solution would be to have it bound to the middle mouse button, but that's not accessible currently. I've thought of three possible compromises:
  1. Limit the picker to a radius around the character. A problem with this is that without a visual indication of the active range, you could find yourself hovering over an item and wondering why it's not working.
  2. Disable the picker for items you frequently hover over to check status. It's especially a problem with chests where you might need a couple of seconds to find the thing you're interested in. One second is usually long enough to check a pipe. Although, you sometimes just want to watch pipes for a while, so there's that.
  3. Make it so that once you clear your cursor with Q, it won't pick that item again until you move your cursor off of it. It would still bother you one time, but then you could hit Q and watch the status for as long as you want.
I'm leaning toward #3, but I'm definitely open to ideas.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Fri Aug 07, 2015 8:54 pm
by Lemures
What about a combination: #3 (which I quite like), combined with limiting to the build radius of the player. That radius is a bit "intuitive" to a player who has played for a while, so there wouldn't be much need for a visual indicator.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Fri Aug 07, 2015 10:06 pm
by Tinyboss
Lemures wrote:What about a combination: #3 (which I quite like), combined with limiting to the build radius of the player. That radius is a bit "intuitive" to a player who has played for a while, so there wouldn't be much need for a visual indicator.
It's even better than that, actually: the little highlight cursor is yellow if you're in build/interact range and red if not, which overcomes my main objection to limiting the range. I made both changes and uploaded a new version (link updated in the OP). I made it so that the old infinite range can be restored by changing one line in the control.lua file, but I'm going to use it with limited range for a while to see how it feels.

I also removed the message for when you don't have an item in your inventory. I think it was annoying.

Thanks again for using it and giving feedback!

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Sat Aug 08, 2015 1:09 am
by theit8514
For some reason, on_tick is getting called before on_load has a chance to create the eyedrop variable. Maybe an on_init would be better for setting up the object. Creating a new game results in: __Eyedropper__/control.lua:50: attempt to index global 'g' (a nil value)

In addition, this if statement can be flipped to short-circuit the call to can_reach_entity since infinite_range is either always true or always false (it never changes unless the lua changes which requires a restart):

Code: Select all

(p.can_reach_entity(p.selected) or g.infinite_range)

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Sat Aug 08, 2015 1:25 am
by Tinyboss
Okay, I made a very quick and dirty fix and uploaded it. Thanks for the report!

It actually was on_init instead of on_load in the first version. But apparently on_init only gets called once, ever, and so it's a bad place to put options like infinite_range. For now I've just duplicated on_init and on_load, just so it'll run. When I get time I'll do a proper fix.

Actually that whole mess of logic probably doesn't bear close scrutiny, since it's been poked and prodded and added onto, at the same time as I've been learning to make Factorio mods. It's due for a rewrite soon. But you're right about the short-circuiting.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Mon Aug 10, 2015 12:53 pm
by billw
You could add an item called eye dropper that if it is in your hand will perform selection otherwise won't. People can have this as a short cut in their toolbelt then.
You could extend for other "tools" as well and turn the toolbelt into a set of tools!
e.g. Eyedropper for items, eye dropper for contents, refueller, rearmer, single click mark for deconstruct/cancel deconstruct (really want this one, trying to selection rectangle from distance on a single item is a pain) whatever else people can think of...

/edit of course if they stop moving too long the eyedropper gets replaced by an item, but its to quick to re-select something from toolbelt I don't think this would be a problem.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Mon Aug 10, 2015 1:32 pm
by Tinyboss
billw wrote:You could add an item called eye dropper that if it is in your hand will perform selection otherwise won't. People can have this as a short cut in their toolbelt then.
That is just perfect! (Well, middle-click would be perfect, but that's damn close.)

Okay, time to learn a little more about modding so I can put a new item in.

Thanks for the great idea!

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Mon Aug 10, 2015 8:57 pm
by GopherAtl
I'd actually just make it not pick unless your hand is currently empty, rather than add an eyedropper object; if you're already holding something, it won't drop it, and you can just hit q to deselect if you want to use the eyedropper effect. So the worst harm of unintended selections is you fill an empty hand and have to tap q to put it away.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Mon Aug 10, 2015 11:13 pm
by billw
GopherAtl wrote:I'd actually just make it not pick unless your hand is currently empty, rather than add an eyedropper object; if you're already holding something, it won't drop it, and you can just hit q to deselect if you want to use the eyedropper effect. So the worst harm of unintended selections is you fill an empty hand and have to tap q to put it away.
Hmm, I normally don't like having stuff in my hand, if it worked with empty hand I would constantly be accidentally picking stuff up.
FYI I don't use this mod so I'm just going off the description and what I would like.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Tue Aug 11, 2015 1:49 am
by Tinyboss
Hey guys, check the OP, I implemented billw's suggestion as a new mod called Picker. I think it works really well.

Re: Eyedropper - An easier way to pick items from your inventory

Posted: Sat Aug 22, 2015 9:25 am
by ssilk
Would be nice, if such obsolete mods would be marked via reporting-function. That makes the moderation job much easier.