HandyHands - Automatic handcrafting

by Qon

Automatically start handcrafting an item that is quickbar filtered (or in logistics requests) that you don't have enough of whenever your crafting queue is empty. Prioritises items in your cursor and what you need the most. It's like having logistics deliveries for early game!

Utilities
3 years ago
0.13 - 1.1
9.29K

b [Resolved] Significant UPS usage

5 years ago

Handy hands is using a LOT of UPS on average, averaging between 2 to 12ms, might be a few cases for optimization there. :-)

5 years ago
(updated 5 years ago)

Please provide more details. It uses less than 0.1 for me.

Multiplayer? How many players?
How many toolbars and assigned slots? What are your settings?
When is it 2ms and when is it at 12ms?
Other mods that affect crafting? Please post your log file "factorio-current.log".
A screenshot of your mod usage stats and toolbar would be helpful.

The command given below will print all players settings to <Factorio directory>/script-output/handyhands_log.txt

/c 
local s = "" 
for i,p in pairs(game.players) do 
    local list = {}
    for j = 1, 4 do
        local bar = {}
        local page = p.get_active_quick_bar_page(j)
        for k = 1, 10 do
            local x = (page-1)*10+k
            local slot = p.get_quick_bar_slot(x)
            if slot ~= nil then table.insert(bar, {[x]=slot.name}) end
        end
        table.insert(list, bar)
    end
    s = s .. '\n' .. game.table_to_json({
        index=i,
        name=p.name, 
        connected=p.connected, 
        settings=remote.call('handyhands','settings', p.index),
        bars = list
    })
end
game.write_file('handyhands_log.txt', s, false, game.player.index)

Please run that and send me the contents of that file.

5 years ago
(updated 5 years ago)

Multiplayer? How many players?

2 to 3, we only bring the server up when at least 2 are available (death world) and there are 3 total players.

When is it 2ms and when is it at 12ms?

It's a very active server and thus hand crafting seems to always be happening, whether via this mod or manually. On average it seems when a player is having the mod handcraft things (or the mod needs to handcraft things but is otherwise manually crafting other things) then for each of those players it jumps by about 2-4ms. For the very rare times that everyone is fully hand-crafted up then the times drop to about <0.1ms, but when everyone is handy-hand-crafting then it tends to bounce between 8 to 12ms on average, which is almost halving UPS then.

A screenshot of your mod usage stats and toolbar would be helpful.

No one is around right now to join the server so I'm loading it up in single player, I can grab one later when another is on as well if you need, but even in single player it is eating over 1.2ms fairly consistently (compared to 2-4ms on average per player in mp, it drops to ~0.2ms for just a split second on occasion before jumping back to up 1.2ms for multiple seconds in the listing):

Notice that I was full-up on handcrafting things, nothing needed to be done, not missing any resources. When I placed some red belts to get back up to 50, while it was handcrafting it was flickering between 1.2 and 2.9ms for HandyHands.

Other mods that affect crafting? Please post your log file "factorio-current.log".

The log file is on the order of 'bloody huge', so how about the first part of it prior to repeated noise of actual gameplay where it grows to many megs:
https://overminddl1.com/Factorio/logs/201904140142.log

The command given below will print all players settings to <Factorio directory>/script-output/handyhands_log.txt

No one is around right now to join the server so I'm loading it up in single player, I can grab one later when another is on as well if you need, but it looks like it has everything:
https://overminddl1.com/Factorio/logs/handyhands_log.txt

You know that could be a useful function to add to your mods remote call interface. ^.^

5 years ago

Thanks!

I see nothing immediately worrying when looking at hh_log.txt. I'll check for mod interactions later. If that doesn't give me anything I'll check that the code doesn't run needlessly often and see if I can do anything else to speed it up.

You know that could be a useful function to add to your mods remote call interface. ^.^

Did you find it useful? It does use the remote call interface so you could use the code I gave you above in another mod if you want that info. So it isn't really necessary to add anything to the interface from that perspective. But when I wrote the code I kind of wished that settings(player_index == nil), instead of having to loop through the players and call the interface several times to get them all, would just give me all players info as a nice default. Is there anything from that info you find interesting or useful? Or anything else you are missing from the remote interface? I haven't heard any interest in it from anyone else so far.

5 years ago

Well the Creative Mode mod can call whitelisted mod interfaces (and a mod can call into creative mode to mark a certain interface to whitelist it), so it would be an easy and convenient way for someone to just click a button and get a file dumped of debug info, you could add a lot to it that could simplify your debugging, such as mod lists, versions, etc... Even without Creative Mode it's still easy enough for players to call for easy debugging so you could add it as part of the description to include that if any issues. :-)

4 years ago

HandyHands 1.7.13 might solve your issue. Read more about it in that other thread.

Sorry for the late reply :s
Does it improve things for you?

4 years ago

Don't know about OvermindDL1 but the new version certainly improved things for me so thanks for the optimizations!

4 years ago

Thanks NeilN!

Switching this to resolved. If OverminDL1 responds and says he still has issues then I can switch it back to pending. But the log shows bobs mods etc that would add a lot of complicated recipes so I think this should affect him. Thanks OvermindDL1 for the logs and requested info :)

4 years ago

Oh yes, sorry for the delay, the issue is resolved now yes! :-)

4 years ago
(updated 4 years ago)

You were very quick compared to me though :)
Morcam gave me the solution. I had no idea that recipe count would impact HandyHands so badly.

New response