Thread Tools Display Modes
09-27-09, 07:17 PM   #1
Fithin
Banned
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7
Inserting a Delay

I have an add-on that I designed that automatically congratulates your guild mates when they obtain an Achievement. I had a request by a user, to add in a built in delay, as it stands right now the message fires off almost instantly. Which of course would lead people to thinking that it is an add-on sending the message. However I am not certain how to add in a delay either fixed or random that would make the add-on appear to function more like someone actually typing the message rather than the add-on firing off the message. Any help is greatly appreciated, and I thank all that assist with this matter in advance.
  Reply With Quote
09-27-09, 07:39 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Well, it *is* an addon, not you, sending the message. Personally, I was never fond of guildies having automated greet/congrats addons... Felt like they didn't care enough to say "hi" or "grats!" to me on their own. Kind of like the boss's secretary buying you the Christmas present and the boss not even knowing that the nice sweater you'll be wearing next week was from them.

Anyway.... You can have two options.

1. Pop up a button for the user to press to sent the congrats (this would cause a random delay and would let the user actually be aware of the achievement)

2. Look into using an OnUpdate script handler.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-27-09, 08:45 PM   #3
Fithin
Banned
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7
I like the idea of popping up a button, But I do however have limited knowledge of lua scripting, what exactly would be the procedure or function I would use in order to pop up a button. and what function would I then place my automated response into for when that button was pressed. Any help is greatly appreciated.
  Reply With Quote
09-27-09, 08:59 PM   #4
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Take a look at my addon LazyAFK.

Code:
local frame = CreateFrame("Frame")
frame:Hide();
frame:SetHeight(160)
frame:SetWidth(350)
frame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 430, -222)
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetUserPlaced(true)
frame:SetClampedToScreen(true)
frame:SetScript("OnMouseDown", frame.StartMoving)
frame:SetScript("OnMouseUp", frame.StopMovingOrSizing)
frame:SetBackdrop({
    bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
    edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
    tile = true,
    tileSize = 32,
    edgeSize = 32,
    insets = {
        left = 11,
        right = 12,
        top = 12,
        bottom = 11
    }
});

function button_OnClick()
    --Clicking button does stuff in here
end

local button = CreateFrame("Button", "AFKButton", frame, "UIPanelButtonTemplate")
button:SetHeight(45)
button:SetWidth(125)
button:SetPoint("BOTTOM", frame, "BOTTOM", 0, 15)
button:SetText("Click Me!")
button:RegisterForClicks("AnyUp")
button:SetScript("OnClick", button_OnClick)
local close = CreateFrame("Button", "CloseButton", frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -8, -8)
__________________
Never be satisfied with satisfactory.

Last edited by Cralor : 09-27-09 at 09:01 PM.
  Reply With Quote
09-27-09, 10:18 PM   #5
Fithin
Banned
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7
Originally Posted by Cralor View Post
Take a look at my addon LazyAFK.
I am looking it over, and trying to figure our exactly what would need to be done with this section of code. What I am missing, is how to format the code you gave me to have it say the name of the person who received the achievement in the displayed text? As well as have my add-on fire off the pop-up box rather than fire off the message automatically?
  Reply With Quote
10-09-09, 03:08 AM   #6
Nirrudn
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 17
http://www.wowwiki.com/Creating_simp...p_dialog_boxes

Key thing to look at there is the OnAccept bit, that's where you'd stick your function to say "congrats."
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Inserting a Delay


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