View Single Post
11-23-22, 02:11 PM   #1
BustleNation
A Defias Bandit
Join Date: Nov 2022
Posts: 3
C_Timer.After() not sending messages in Open World

Hi all - I am very new to programming in general and would appreciate any insight or help

I am working on an addon that will tell a joke in two parts when a button is pressed. The second part coming after a 5 second delay. Doing some searching it seems like C_Timer.After() is what I'm looking for. Inside of an instance it works correctly. However in the open world it is giving me the error "Interface action failed because of an Addon"

Here is the code that I have:

Code:
f.JokeButton:SetScript("OnClick", function()
  f.JokeButton:Disable()
  SendChatMessage("Why did the chicken cross the road?", "SAY")
  C_Timer.After(5, function () SendChatMessage("to get to the other side", "SAY") end)
  C_Timer.After(5, function () f.JokeButton:Enable() end)
end)
The C_Timer.After works for re-enabling the button after 5 seconds - just not for saying the second part ("to get to the other side").


I'd appreciate any thoughts! Thanks!
  Reply With Quote