Thread Tools Display Modes
10-28-16, 10:47 PM   #1
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
detect pvp status somehow??

* SOLUTION * it is indeed just a GHI environment problem; not a code problem. It has to be updated with patches.

I could really use the following function which seems to be disallowed in addons (but not macros)

GetPVPDesired()
(has the player flagged themselves)

http://wowprogramming.com/docs/api/GetPVPDesired

I'm writing this from within GHI addon.. does anyone know if this function works in normal addons? It could be a GHI environment problem, although so far that's never been the case.

GetPVPTimer works, so it's strange that this one doesn't.

Failing this, I'm hoping to detect pvp with a workaround of some kind...

thanks!

Last edited by Tesser : 10-31-16 at 08:36 AM.
  Reply With Quote
10-29-16, 12:46 AM   #2
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
Wowprogramming states that the return values are 0 and 1.
But lots of functions have been reworked to return true and false.

Maybe this is the case here?
__________________
Better to fail then never have tried at all.
  Reply With Quote
10-29-16, 03:09 AM   #3
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
updated slightly - it is available in macros actually, so I have the syntax right. Just no addons it seems.

And yea it returns true / false in macros.

Last edited by Tesser : 10-29-16 at 03:12 AM.
  Reply With Quote
10-29-16, 11:45 AM   #4
rowaasr13
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 27
What EXACTLY do you mean when you say "not available"?
__________________
Garrison Mission Manager
  Reply With Quote
10-29-16, 02:27 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
What happens when you run this command:
/dump GetPVPDesired()
If you get an error (you do have an error display running, right?) post the actual error message.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-29-16, 03:39 PM   #6
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
Code:
/dump GetPVPDesired()
[1]=true
But the problem is not from the WoW command / macro line - the problem is from within Gryphonheart Items addon, which allows you to script your own lua.
I've successfully called maybe 50 API functions from within GHI, so it's definitely something about this one.

what I get from GHI is:

Code:
Syntax error in GHI item at runtime
attempt to call global 'GetPVPDesired' (a nil value)
and the exact code in my GHI item is:

Code:
local test = GetPVPDesired()
print(test)
From the printout on "/dump" it looks like maybe it returns an array, so I also tried "print(test[1])" to no avail.

I'm wondering if I need to provide syntax like so:
GlobalObject.GetPVPDesired()

I just don't know what "GlobalObject" would be.

*edit* and I just tried "_G.GetPVPDesired()", nope...

thanks for feedback!

Last edited by Tesser : 10-29-16 at 04:07 PM.
  Reply With Quote
10-29-16, 04:10 PM   #7
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
That error means no function with that name exists.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
10-29-16, 04:12 PM   #8
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
yea it's looking like this is a question for the GHI creator (I've left a post, usually takes a couple weeks to respond)

Because I know it IS a function, and 99% of functions seem to be available to GHI, but for some reason not this one.
  Reply With Quote
10-29-16, 06:58 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Lombra View Post
That error means no function with that name exists.
Or, that it's not defined yet when you are trying to call it.
__________________
"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
10-30-16, 06:34 PM   #10
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
If anyone can think of an addon that detects your pvp status I'd be grateful to hear it, to scan through the code.
  Reply With Quote
10-31-16, 03:20 AM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Tesser View Post
But the problem is not from the WoW command / macro line - the problem is from within Gryphonheart Items addon, which allows you to script your own lua.
If you can call the function from the command line yourself, then the problem is not with the function. A cursory glance at the Gryphonheart Items addon (I searched for text from the error message you got to find the relevant section of code) shows that it is setting up a custom function environment for user macros/snippets to run in, but that environment does not include the complete WoW API. The "GetPVPDesired" is not in the list of included functions; others may be missing as well.

The only way to fix this is to get the addon's author to add the missing function. They should probably also be using a script to check for added/removed functions in-game after each patch, rather than trying to keep up with such changes by hand (a tactic prone to error) or relying on a third-party source like Wowpedia (which may not always be up to date or accurate).

Originally Posted by Tesser View Post
From the printout on "/dump" it looks like maybe it returns an array, so I also tried "print(test[1])" to no avail.
No, /dump just numbers the values so you can easily identify each value in without having to count them by hand. Also, numbering the values means it doesn't need to print nils in the middle of a list -- if a function returns 5 values, and the 2nd and 4th values are nil, /dump will only show you values 1st, 3rd, and 5th values.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-31-16, 08:31 AM   #12
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
awesome, tyvm for help. Time to learn more about the custom function environment.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » detect pvp status somehow??

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