Thread Tools Display Modes
12/10/17, 09:43 AM   #1
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
[notabug] Possible bug in crafting

I think I might have found a bug, though it might be intended behaviour.

So the following code will reproduce the bug (assuming it is one) if bag and slot are replaced with some bagID and slotID of an item that can be researched.

EVENT_MANAGER:RegisterForEvent("A", EVENT_CRAFT_COMPLETED, function() WC = true end)
ResearchSmithingTrait( bag, slot ) WC = false
for i = 1, 10 do zo_callLater(function() if not IsPerformingCraftProcess() and not WC then d(i*30)CraftSmithingItem(1,1, 5, 2, 2, false) end end, i*30) end

Theoretically, this code should never actually craft anything. While the research request is being acted upon, IsPerformingCraftProcess() will return false, and when the research request is finished being acted upon, EVENT_CRAFT_COMPLETED should fire, and set WC to true. However, running the code shows that that is not the case. It seems there is a small window where IsPerformingCraftProcess returns false, but EVENT_CRAFT_COMPLETED has not actually fired yet. It's possible that it might have to do with latency.
 
12/12/17, 08:47 AM   #2
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
My best guess is that it is due to the frame delay on events. When an event is fired from the client it enters a queue. On the next frame that queue is emptied and the events are sent to Lua. So if the crafting processing state is set in the client and the event is sent on the next line then you will experience what you described.
 
12/12/17, 09:38 AM   #3
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
zo_calllater uses RegisterForUpdate.
What callbacks are called first? The update callbacks or the events? Or do they shared the same queue?
 
12/12/17, 10:12 AM   #4
Kyoma
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 125
Dolgubon, haven't you had enough bugs fixed by now? Let some of us also get some bugs that need fixing!
 
12/12/17, 10:42 AM   #5
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
Originally Posted by Kyoma View Post
Dolgubon, haven't you had enough bugs fixed by now? Let some of us also get some bugs that need fixing!
Wait a second, does that sound like a volunteer? I have some bugs you can fix riiiight over here.


@votan this issue also appears without using zo_callater. I just used zo_callater to create a quick way to show the bug.


@chip so would players with lower FPS encounter this more often? I would assume then that there isn't much that can be done about it though? Or could possibly the craft state be changed closer to the event sending? (Though I think that might not work)
 
12/13/17, 09:47 AM   #6
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
FPS is not related. It is always one frame after, regardless of how long a frame is. If you want to use the event, then query it when the event arrives. If you want to use update then use that. I wouldn't mix both approaches.
 

ESOUI » Developer Discussions » Bug Reports » [notabug] Possible bug in crafting

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off