daemitus / SomethingNeedDoing

86 stars 59 forks source link

Retrieving select_stringX contents for Lua scripting, and yield() return value #79

Closed BeetleLord closed 2 years ago

BeetleLord commented 2 years ago

I've been able to write a beautifully simple LUA script for refreshing all my retainers thanks to the new Lua scripting feature.

However, it's hard to make any conditional behavior without accessing the string contents of menus. For example, I'd like it to skip over retainers that are currently on a venture, but there's no way to retrieve that info. I'd love a function such as GetSelectStringContents(i) where i is a value 1 through 12, which returns the string contents of that selectable string. I don't know if such a thing is possible, however.

Alternatively, or in addition to this, if the yield() function returns a bool value for whether the command was executed successfully, we could use /waitaddon to determine in Lua scripts whether a certain menu is currently active. Then we might infer the result of a selection based on which menu becomes active. For this to work, it would also be necessary to allow a Lua script to continue executing despite a yield command being unsuccessful.

daemitus commented 2 years ago

I will get to this eventually, finishing up a big improvement to zodiacbuddy and work stuff.

daemitus commented 2 years ago

Added methods, although theres an issue where c# exceptions arent being thrown through the lua interface. So if you like... GetSelectStringText(50) you get 50 as the result. So itll still fail any matching you have afterwards, just not the way you expected.