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

Startup fails on pure first-time install #332

Closed
random-cdda-modder opened this issue Dec 8, 2023 · 5 comments
Closed

Startup fails on pure first-time install #332

random-cdda-modder opened this issue Dec 8, 2023 · 5 comments

Comments

@random-cdda-modder
Copy link

Reproduction instructions:

  1. Have a fresh install, no existing config files
  2. start up
  3. receive error about "* " is not a valid key name on line https://github.com/Lailloken/Lailloken-UI/blob/main/modules/hotkeys.ahk#L32

I worked around the issue by changing line https://github.com/Lailloken/Lailloken-UI/blob/main/modules/hotkeys.ahk#L15
from: settings.hotkeys.omnikey2 := LLK_IniRead("ini\hotkeys.ini", "Hotkeys", "omni-hotkey2")
to: settings.hotkeys.omnikey2 := 0

with this change settings.hotkeys.rebound_c is correctly set to falsy value and logic at https://github.com/Lailloken/Lailloken-UI/blob/main/modules/hotkeys.ahk#L25 enters the correct conditional branch that does not try to set omni-hotkey2.

Environment if it matters:
Linux Steam Proton Experimental with AHK installed in the PoE wine context, other (simpler) AHK scripts work just fine
Latest AHK 1.x
Default Settings in Path of Exile (C key is Character menu)

@Lailloken
Copy link
Owner

Lailloken commented Dec 8, 2023

I think it might be a compatibility issue, leading to values being incorrectly returned by the LLK_IniRead() function:

  • "* " indicates that settings.hotkeys.omnikey2 contained a space instead of being blank
  • settings.hotkeys.rebound_c is seen as true because it probably also contains a space
  • the script tries to bind *{hotkey} instead of the default *~{hotkey} because settings.hotkeys.omniblock is seen as true since it probably also contains a space
  • LLK_IniRead() should normally return blank or whatever is handed to it via the last parameter if it cannot retrieve anything from the target ini-file
  • this function simply uses AHK's IniRead command with %A_Space% as the default-parameter
  • it's possible %A_Space% is taken literally instead of "return blank"

Could you confirm this by adding these lines somewhere between lines 10 to 20?:
MsgBox, % "!" . LLK_IniRead("xyz.ini", "xyz", "xyz", 0) . "!"
MsgBox, % "!" . LLK_IniRead("xyz.ini", "xyz", "xyz") . "!"
EDIT: These will each open a text-box with the return value of the LLK_IniRead() function, enclosed in exclamation points

@random-cdda-modder
Copy link
Author

the lines both outputted !!

having lines

	settings.hotkeys.omnikey2 := 0
	MsgBox, % "!" . settings.hotkeys.omnikey2 . "!"

outputted !0! so I assume the default value setting of LLK_IniRead does not work as expected

p.s. also no xyz.ini was created in the ini folder next to other created ini files like config.ini if it is supposed to be created at this point

following ini files are created before encountering the original omnikey2 issue with hotkey.ini:
Lailloken-UI/ini/betrayal info.ini
Lailloken-UI/ini/clone frames.ini
Lailloken-UI/ini/config.ini
Lailloken-UI/ini/item-checker.ini
Lailloken-UI/ini/leveling tracker.ini
Lailloken-UI/ini/map info.ini
Lailloken-UI/ini/search-strings.ini

@random-cdda-modder
Copy link
Author

random-cdda-modder commented Dec 8, 2023

Looking at

LLK_IniRead(file, section := "", key := "", default := "")
{
	IniRead, iniread, % file, % section, % key, % !default ? A_Space : default
	If (default != "") && (iniread = "") ;IniRead's 'default' is only read if the key cannot be found in the ini-file
		Return default ;if the key in the ini-file is blank, the target-variable will also be blank (instead of storing 'default')
	Else Return iniread
}

maybe !default ? A_Space : default should be replaced with default != "" ? A_Space : default to support the number 0 correctly?

EDIT: Doing that causes errors elsewhere in some betrayal module so probably not a straightforward fix

@Lailloken
Copy link
Owner

p.s. also no xyz.ini was created in the ini folder next to other created ini files like config.ini if it is supposed to be created at this point

these were just placeholder strings to intentionally fail the ini-load

Yes, the default parameter would need to be modified, now that I know there are instances where the native AHK-command can behave irregularly, albeit under very exact circumstances only.

@Lailloken
Copy link
Owner

v1.51.2 contains a fix for this rare issue: Whenever ini-reads return a single space, the script will assume it was a failed read and return blank instead. A single space will never be a valid configuration in this tool, so this workaround is the most straight-forward solution. I vaguely remember there being a reason for specifically distinguishing 0 and "", but I can't remember now.

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

No branches or pull requests

2 participants