Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update advfort.lua #1394

Merged
merged 5 commits into from
Feb 9, 2025
Merged

Update advfort.lua #1394

merged 5 commits into from
Feb 9, 2025

Conversation

velanos
Copy link
Contributor

@velanos velanos commented Feb 5, 2025

If you just remove that check advfort does actually start in steam version but I still cannot mine with it

If this PR makes an externally-visible change in behavior, please add an appropriate line to changelog.txt.

If you just remove that check advfort does actually start in steam version but I still cannot mine with it
@Bumber64
Copy link
Contributor

Bumber64 commented Feb 6, 2025

We should probably just fix the check instead of removing it? The Lua API says dfhack.gui.getCurFocus returns a string, but it's returning a table for some reason.

Also, all instances of df.global.world.units.active[0] need to be replaced with dfhack.world.getAdventurer().

@velanos
Copy link
Contributor Author

velanos commented Feb 6, 2025

@Bumber64 I believe you I just got here in this project so anyhting you tell me I will do. I have fone the rename and I figured the table has one entry that is still the expected string so the easy fix is to just plant [1] after the value. I also cannot get it to actually work with mining but iad far as I understand self._native.parent:logic() is to trigger some final code that actually 'does' the thing and I cannot get to log what native parent is but I think what fixes this might not be in this file itself

Applied the comment as I was told
It is a table now but the first entry is still correct
gui/advfort.lua Outdated
@@ -1837,7 +1837,7 @@ function usetool:onRenderBody(dc)
self:shopMode(self:isOnBuilding())
self:renderParent()
end
if not (dfhack.gui.getCurFocus()=="dungeonmode/Look" or dfhack.gui.getCurFocus()=="dungeonmode/Default") then
if not (dfhack.gui.getCurFocus()[1]=="dungeonmode/Look" or dfhack.gui.getCurFocus()[1]=="dungeonmode/Default") then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be using dfhack.gui.matchFocusString('dungeonmode/Look') or dfhack.gui.matchFocusString('dungeonmode/Default')

there are no guarantees that the string you want will be the first one in the list

@myk002
Copy link
Member

myk002 commented Feb 7, 2025

this is a good start for updating advfort. It will still be marked as "unavailable" since it doesn't actually function properly, but first steps first.

as suggested
Forgot closing
@velanos
Copy link
Contributor Author

velanos commented Feb 8, 2025

Another update I found out when comparing to advfort 0.47 and probably a major thing: usetool:oninput does not trigger in the new version. I will continue to try and find out why. Can it be because we are missing the ruby scripts dfhack does not recognise the key input for advfort? I spent at least 10 hours now at understanding what happens but I cannot really find out why mining does not happen so this is all I can contribute you may now merge it.

@myk002 myk002 merged commit 766c6b2 into DFHack:master Feb 9, 2025
10 checks passed
@myk002
Copy link
Member

myk002 commented Feb 9, 2025

usetool:oninput does not trigger in the new version

are there any errors shown on the console? even though advfort uses the older Screen interface (newer tools use ZScreen for focus handling and draggable, resizable windows), the onInput function should still be called

@velanos
Copy link
Contributor Author

velanos commented Feb 9, 2025

@myk002 gamelog shows no errors or at least I am unable to find which console those errors should be found in it was far more primitive than that namely pasting print('anything') into the logic of this file on 0.47 version on my laptop and the steam version on my pc to see which triggered and oninit does trigger in the old version and not in the new one. Why that is I do not know. The game also 'freezes' in a way I cannot walk when in advfort mode.

@myk002
Copy link
Member

myk002 commented Feb 9, 2025

If you're on Windows, run the show command to get the console. If you're on Linux, run the ./dfhack launcher script from a terminal. Error messages will be shown there

@velanos
Copy link
Contributor Author

velanos commented Feb 10, 2025

@myk002
image
I outcommented the line it is just an announcement it does not actually work even without the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants