Thread Tools Display Modes
05-02-10, 04:21 AM   #1
myrddinwylt
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 11
Wink AcceptLevelGrant being ignored

Hello,

According to all the documentation I have found, this function should work to accept a level as granted, however, it seems that it is being skipped over.

I have tried typing /run AcceptLevelGrant() in the wow chat window, which works, however, it doesn't work in the following case even though the value for "sender" is being output to the screen (i added that for debugging).

Could someone please review this and let me know what I am doing wrong, or perhaps a more advanced way to call this function -- aka.. similulate /run .

Code:
   elseif event=="LEVEL_GRANT_PROPOSED" then
     isLinked = IsReferAFriendLinked(sender);
     if isLinked==nil then
        isLinked=RAFriendExists(sender);
     end
     if isLinked==1 then
        if raAcceptLevels==1 then
          rafLevelGranted=sender;
          AcceptLevelGrant()
          print(sender);
        else
          DeclineLevelGrant();
        end
     else
       DeclineLevelGrant();
     end
------- more code ----
Basically, the above is the condition where the event is fired, and all of the code inside that condition. RAFriendExists() is a function which basically checks an array for the value "sender" if it exists .. 1 if true... 0 if false. The rest is pretty straight-forward.

Thanks in advance.
  Reply With Quote
05-02-10, 06:15 AM   #2
Foxlit
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 91
It may well require a hardware event, in which case, you won't be able to do anything without the user's intervention.
__________________
... and you do get used to it, after a while.
  Reply With Quote
05-02-10, 05:52 PM   #3
myrddinwylt
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 11
Possible.... but what i don't get, is unlike most hardware events, this one allows you to execute it in the fashion:

/run AcceptLevelGrant()

Which is what leads me to believe that it may not be that.
  Reply With Quote
05-02-10, 05:55 PM   #4
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by myrddinwylt View Post
Possible.... but what i don't get, is unlike most hardware events, this one allows you to execute it in the fashion:

/run AcceptLevelGrant()

Which is what leads me to believe that it may not be that.
Pressing enter on the chat edit box is a hardware event. You're confusing "hardware event" with "protected".

Something that's protected cannot be executed by an arbitrary script command at all (i.e. /run CastSpellByName(spell) [with a few exceptions]). It must be executed through a secure frame and also requires a hardware event.

Something that simply requires a hardware event can be executed by script command with no middle-man, just a mouse click or button press.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » AcceptLevelGrant being ignored


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