WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   detect pvp status somehow?? (https://www.wowinterface.com/forums/showthread.php?t=54750)

Tesser 10-28-16 10:47 PM

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!

Yukyuk 10-29-16 12:46 AM

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?

Tesser 10-29-16 03:09 AM

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.

rowaasr13 10-29-16 11:45 AM

What EXACTLY do you mean when you say "not available"?

Phanx 10-29-16 02:27 PM

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.

Tesser 10-29-16 03:39 PM

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!

Lombra 10-29-16 04:10 PM

That error means no function with that name exists.

Tesser 10-29-16 04:12 PM

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.

Seerah 10-29-16 06:58 PM

Quote:

Originally Posted by Lombra (Post 320465)
That error means no function with that name exists.

Or, that it's not defined yet when you are trying to call it.

Tesser 10-30-16 06:34 PM

If anyone can think of an addon that detects your pvp status I'd be grateful to hear it, to scan through the code.

Phanx 10-31-16 03:20 AM

Quote:

Originally Posted by Tesser (Post 320464)
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).

Quote:

Originally Posted by Tesser (Post 320464)
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.

Tesser 10-31-16 08:31 AM

awesome, tyvm for help. Time to learn more about the custom function environment.


All times are GMT -6. The time now is 12:45 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI