Quantcast GetWorldStateUIInfo() clarification - WoWInterface
Thread Tools Display Modes
10-23-10, 12:13 PM   #1
Ninkosen
A Defias Bandit
Join Date: Oct 2010
Posts: 2
GetWorldStateUIInfo() clarification

Hi so I'm new, and quite a beginner in wow addons, I've looked all over the place, before coming here.

Does this code works ?

Code:
		local _, stateh, scoreh = GetWorldStateUIInfo(2);
		if (stateh == 2 and not hcarrier) or scoreh == 2 then
			LeaveBattlefield()
		end
 		local _, statea, scorea = GetWorldStateUIInfo(1);
		if statea == 2 and scorea == 2 then
			LeaveBattlefield()
		end
It's a tiny modification I made of Capping. It's supposed to make me leave a battleground if :
- Horde hold the alliance flag and capping doesn't know who is holding it regardless of the score, Or Horde has 2 points out of 3 in the match, no matter what.
- Alliance has 2 points out of 3 and they hold horde flag

Apparently it doesn't do that, as I get out of the BG, if Alliance hold horde flag (and 0-0), when I just join in. It shouldn't.
Don't ask me why I want to do that, long story.

The score is a string ? does my scorea == 2 works ?

hcarrier should be nul at this point of the execution...

Thanks for any help.
  Reply With Quote
10-23-10, 12:45 PM   #2
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
if the score is a string ( logic tells me its a number, but okay) then string == 2 wont work. because "2" does not equal 2.

you could do

score == "2" or tonumber(score) == 2, but worst case, add some prints so you can see whats going on

like

local _, stateh, scoreh = GetWorldStateUIInfo(2);
print(stateh, scoreh, type(scoreh)) --that last bit you can see if scoreh is a string or a number.

edit::
you could even add
print((stateh == 2 and not hcarrier) or scoreh == 2) and it will print true or false (i think, it might print if true and print nothing if false, i forget, you could try print(1==1, 1==2) and see what that yields)
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
10-23-10, 02:47 PM   #3
Ninkosen
A Defias Bandit
Join Date: Oct 2010
Posts: 2
ok thanks a lot, this should help

edit: after some time, I figured my problem was that WoWwiki isn't correctly documented, it state that the argument 1 is alliance and 2 is horde... which is false, at least for warsong gulch... it's 2 alliance and 3 horde... 1 being used for the time remaining info... For arathi basin it might be 1 alliance, 2 horde, as there is no time... but it's not always like that

that's why I had weird stuff going on... also the score is indeed a string as documented in wowwiki, like "0/3"

just weird that they say [score]/3, it's a bit confusing...

Last edited by Ninkosen : 10-24-10 at 03:47 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » GetWorldStateUIInfo() clarification

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