Page 1 of 1

[1.7.3] Use Command Staff talent Lua error

Posted: Wed Jun 02, 2021 6:48 pm
by melighos

Code: Select all

[LOG]	#ORCHID##{bold}#Melighos refocuses the energies of his staff.#{normal}##LAST#
Just started the chat, and we apparently have o.factory_settings.
[CHAT] loaded	element_bonestaff	table: 0x4314c268
[CHAT] loaded	bone_horror_mock	table: 0x4314a3f8
[CHAT] loaded	welcome	table: 0x4314a3c8
[CHAT] loaded	which_aspect	table: 0x4354ec00
[CHAT] loaded	how_speak	table: 0x4354ef98
##Use Talent Lua Error##	T_COMMAND_STAFF	Actor:	4087	melighos
Lua Error: /engine/interface/ActorTalents.lua:351: /engine/interface/ActorTalents.lua:324: /engine/interface/ActorTalents.lua:190: /engine/dialogs/Chat.lua:134: attempt to index a nil value
stack traceback:
	/engine/dialogs/Chat.lua:134: in function 'resolveAuto'
	/engine/dialogs/Chat.lua:160: in function 'generateList'
	/engine/dialogs/Chat.lua:42: in function 'init'
	/engine/class.lua:147: in function 'new'
	/engine/Chat.lua:416: in function 'invoke'
	/data/talents/misc/objects.lua:182: in function </data/talents/misc/objects.lua:167>
	[C]: in function 'xpcall'
	/engine/interface/ActorTalents.lua:186: in function </engine/interface/ActorTalents.lua:173>
	At [C]:-1 
	At [C]:-1 error
	At /engine/interface/ActorTalents.lua:351 useTalent
	At /engine/interface/PlayerHotkeys.lua:179 
	At /engine/interface/PlayerHotkeys.lua:162 activateHotkey
	At /engine/HotkeysIconsDisplay.lua:392 onMouse
	At /mod/class/uiset/Minimalist.lua:1815 fct
	At /engine/Mouse.lua:71 
FROM 	/mod/addons/cults/superload/engine/dialogs/ShowErrorStack.lua	loading previous!

Code: Select all

[ENGINE LOADER] sorted:	te4	1	7	3
[ENGINE LOADER] loading engine:	1	7	3	te4
[ENGINE LOADER] using archived engine:	/engines/te4-1.7.3.teae

Binding addon	Items Vault	/addons/tome-items-vault.teaa	tome-items-vault-1.7.0
Binding addon	Possessor Bonus Class	/addons/tome-possessors.teaa	tome-possessors-1.7.3
Binding addon	Ashes of Urh'Rok	/addons/ashes-urhrok.teaac	tome-ashes-urhrok-1.7.3
Binding addon	Forbidden Cults	/addons/cults.teaac	tome-cults-1.7.3
Binding addon	Embers of Rage	/addons/orcs.teaac	tome-orcs-1.7.3
Char was made in 1.7.2. After updated to 1.7.3, I found Staff of Bones. For first time, Command Staff talent worked fine and I could spoke with it and change damage type of the staff.
Then, the other day, it's just start to give errors.
Now all of my attempts to use Command Staff talent with any staff give me an error instead.

Re: [1.7.3] Use Command Staff talent Lua error

Posted: Thu Aug 05, 2021 7:59 pm
by Feorg
A similar error in 1.7.4, could be related. The character created in the same version. Not a necromancer, but a writhing one. I asked the Staff of Bones to change its basic properties and got a lua error. No dialogue was shown unlike with other options. After the error report screen, I was able to adjust the spellpower/critical normally.

Code: Select all

[LOG]	#ORCHID##{bold}#Original Lonkero refocuses the energies of his staff.#{normal}##LAST#
Just started the chat, and we apparently have o.factory_settings.
[CHAT] loaded	element_bonestaff	table: 0x460781d0
[CHAT] loaded	bone_horror_mock	table: 0x43ecaae0
[CHAT] loaded	welcome	table: 0x43ecaab0
[CHAT] loaded	which_aspect	table: 0x43673418
[CHAT] loaded	how_speak	table: 0x45a5a080
Using cached font	/data/font/DroidSansMono.ttf	14
[CHAT] selected	I'd like to alter your basic properties.	function: 0x44be87f0
##Use Talent Lua Error##	T_COMMAND_STAFF	Actor:	9508	Original Lonkero
stack traceback:
	[C]: in function 'error'
	/engine/interface/ActorTalents.lua:190: in function </engine/interface/ActorTalents.lua:173>
FROM 	/mod/addons/cults/superload/engine/dialogs/ShowErrorStack.lua	loading previous!


ERROR:
Game version: tome-1.7.4
Addons: ashes-urhrok-1.7.4[O], items-vault-1.7.0[O], possessors-1.7.4[O], orcs-1.7.4[O], cults-1.7.4[O]

Game version (character creation): tome-1.7.4
Lua Error: /engine/interface/ActorTalents.lua:1272: cannot resume dead coroutine
  At [C]:-1 
  At [C]:-1 error
  At /engine/interface/ActorTalents.lua:1272 unload
  At /engine/Game.lua:467 unregisterDialog
  At /engine/dialogs/Chat.lua:122 use
  At /mod/dialogs/Chat.lua:41 fct
  At /engine/ui/VariableList.lua:143 onUse
  At /engine/ui/VariableList.lua:113 fct
  At /engine/Mouse.lua:71 receiveMouse
  At /engine/Mouse.lua:111 delegate
  At /engine/ui/Dialog.lua:817 mouseEvent
  At /engine/ui/Dialog.lua:510 fct
  At /engine/Mouse.lua:71 
Save file with the staff equipped, for me the error is replicated on subsequent attempts to change the properties.

Re: [1.7.3] Use Command Staff talent Lua error

Posted: Thu Nov 11, 2021 8:05 pm
by Zizzo
Just tripped over the original error reported by melighos above, on 1.7.4, running an Adventurer with a smattering of Necromancer talents. A bit of digging reveals that the bug is in the Staff of Bones' ability to summon a bone horror after it's absorbed 100 souls, which appears to be broken in two ways:

· First, the reason it breaks in the first place is that this feature is apparently not Adventurer-proof. Basically, FC installs a Chat:invoke hook that says, "Ah! the player has absorbed 100 souls with the Staff of Bones, so we should start the Command Staff chat at the 'you can now summon a bone horror' stage", and a CommandStaff:SentientChat hook that says, "Hmm, the player is not a Necromancer (by virtue of not knowing the Aura of Undeath and Call of the Crypt talents), so we shouldn't include the 'you can now summon a bone horror' stage in the Command Staff chat". You can see how that might not work as planned. :wink:

· Second, the reason it stays broken is that it never gets a chance to clean up behind itself. Here's the relevant code from FC's Necromancer:SoulLeech:GainSoul hook that collects souls for the Staff of Bones:

Code: Select all

if weapon.captured_souls >= 100 and not weapon.captured_souls_goal then
	weapon.captured_souls_goal = true
	game:onTickEnd(function()
		self.is_first_time_souls = true
		self:forceUseTalent(self.T_COMMAND_STAFF, {ignore_cooldown=true, ignore_energy=true})
		self.is_first_time_souls = nil
	end)
end
The forceUseTalent() line is where the breakage above happens, and that means that the 'is_first_time_souls' flag never gets cleared and the Command Staff talent keeps trying (and failing) forever to go to the non-existent 'you can now summon a bone horror' stage. [That's a lesson I learned the hard way: if you're trying to follow the "set state, do a thing, restore state" pattern in Lua, and the "do a thing" step is even slightly complex, always wrap that step in a pcall(), so that no matter how badly it breaks, you can still get back in and do the "restore state" step.]

Re: [1.7.3] Use Command Staff talent Lua error

Posted: Thu Nov 18, 2021 9:39 am
by melighos
Zizzo wrote: Thu Nov 11, 2021 8:05 pm Just tripped over the original error reported by melighos above, on 1.7.4, running an Adventurer with a smattering of Necromancer talents. A bit of digging reveals that the bug is in the Staff of Bones' ability to summon a bone horror after it's absorbed 100 souls, which appears to be broken in two ways:

· First, the reason it breaks in the first place is that this feature is apparently not Adventurer-proof. Basically, FC installs a Chat:invoke hook that says, "Ah! the player has absorbed 100 souls with the Staff of Bones, so we should start the Command Staff chat at the 'you can now summon a bone horror' stage", and a CommandStaff:SentientChat hook that says, "Hmm, the player is not a Necromancer (by virtue of not knowing the Aura of Undeath and Call of the Crypt talents), so we shouldn't include the 'you can now summon a bone horror' stage in the Command Staff chat". You can see how that might not work as planned. :wink:

· Second, the reason it stays broken is that it never gets a chance to clean up behind itself. Here's the relevant code from FC's Necromancer:SoulLeech:GainSoul hook that collects souls for the Staff of Bones:

Code: Select all

if weapon.captured_souls >= 100 and not weapon.captured_souls_goal then
	weapon.captured_souls_goal = true
	game:onTickEnd(function()
		self.is_first_time_souls = true
		self:forceUseTalent(self.T_COMMAND_STAFF, {ignore_cooldown=true, ignore_energy=true})
		self.is_first_time_souls = nil
	end)
end
The forceUseTalent() line is where the breakage above happens, and that means that the 'is_first_time_souls' flag never gets cleared and the Command Staff talent keeps trying (and failing) forever to go to the non-existent 'you can now summon a bone horror' stage. [That's a lesson I learned the hard way: if you're trying to follow the "set state, do a thing, restore state" pattern in Lua, and the "do a thing" step is even slightly complex, always wrap that step in a pcall(), so that no matter how badly it breaks, you can still get back in and do the "restore state" step.]
Hmm, very interesting indeed.
Is there a way to fix character save after it got corrupted with that uncleaned data, or it's permanent?

Re: [1.7.3] Use Command Staff talent Lua error

Posted: Sun Nov 21, 2021 4:03 am
by Zizzo
melighos wrote: Thu Nov 18, 2021 9:39 am Is there a way to fix character save after it got corrupted with that uncleaned data, or it's permanent?
Ooh, let me see, I think I eventually lost that character to an unrelated bug, but I do remember fixing this problem, and I think it was just a matter of clearing the 'is_first_time_souls' flag on the player. I have no idea whether that's the sort of thing that a mod could do over chat, though; never been entirely clear on how that worked…

Re: [1.7.3] Use Command Staff talent Lua error

Posted: Sun Nov 21, 2021 4:07 pm
by Moasseman
Zizzo wrote: Sun Nov 21, 2021 4:03 amOoh, let me see, I think I eventually lost that character to an unrelated bug, but I do remember fixing this problem, and I think it was just a matter of clearing the 'is_first_time_souls' flag on the player. I have no idea whether that's the sort of thing that a mod could do over chat, though; never been entirely clear on how that worked…
It's not. Mods can only teleport people & remove effects (tho the latter doesn't work) through the interface. For save file fixing I gotta get my hands on the save itself, which usually means uploading it (or necessary parts of it, such as game.teag in this case) to either a cloud service (dropbox, google drive etc) or to Discord in the ToME Discord server/my PMs