Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-26-20, 10:05 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Using a C_Timer.After and how to add a time delay

Hi all

I am the author of a small addon Aardvark, I am self taught with no background in coding at all.

I have a couple of issues that I have not been able to solve that I would like some guidance for.

Q1. I have a sell function that scans my bags and auto sells grey items and items that a player adds to their sell list when they visit a vendor, (line 1910).

When the vendor opens the sell function runs however it does not always sell all the grey and listed items, I get the "that object is busy" message and I have to spam the sell button to clean out all of the remaining items.

I have tried adding a C_Timer.After in the sell function wrapped around the actual sell chunk, (line 1942) using:

Code:
C_Timer.After(1, function(self)
    -- code chunk
end)
however I then get the following error,

Code:
2x Aardvark\Aardvark-AR 9.0.8.3.lua:1951: attempt to perform arithmetic on local 'itemValue' (a nil value)
[string "@Aardvark\Aardvark-AR 9.0.8.3.lua"]:1951: in function <Aardvark\Aardvark.lua:1910>
[string "@Aardvark\Aardvark-AR 9.0.8.3.lua"]:2469: in function <Aardvark\Aardvark.lua:2456>
I have not been able to kill this error no matter where I wrap a chunk within the sell function.

How do I add a timer delay in the sell function to ensure all the items sell properly?
Is there a better way to ensure all the items sell other than using a timer?


Q2. I have used a timer in my add item by itemID function, (line 5987), without issue.

I have tried to use a time less than 1 sec but it does not seem to reduce the time below 1 sec.

Is there a way of reducing the timer to less than 1 sec or is there a alternative way of adding a delay that will allow a sub 1 sec timer?


Looking forward to some help and understanding of what I am doing wrong.

Last edited by Walkerbo : 03-26-20 at 10:28 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Using a C_Timer.After and how to add a time delay

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