API Request

Suggestions for WarcraftRealms.com
Post Reply
hafeliel
Posts: 2
Joined: Wed Apr 11, 2007 9:41 am
Location: Cedar City, Utah
Contact:

API Request

Post by hafeliel »

Greetings! I'm a mod developer and not currently a user of CensusPlus, so please bear with me if this has been covered earlier.

I've developed a mod (http://ui.worldofwar.net/ui.php?id=4294) that helps people get groups together. Like CensusPlus, my mod does /who requests also, so if a user is running a census in the background while trying to use my mod, the mods will interfere with each other and neither will function correctly.

Unlike CensusPlus, my mod doesn't continue to do /who requests in the background once my main window is closed, so I'd like a way to cooperate with CP instead of competing with it. Ideally, I'd like a way for me to ask CP to pause when the user asks my mod to search and then have a way for my mod to tell CP to continue when my mod is done.

Obviously, I could do this by reverse engineering your code, but I'd really rather not, or I'll end up updating my code everytime you guys make a change to yours. Would it be possible to add (or do you already have) an API that I could work with? All I would really need is:

* An identifier whose value I could test to see if CP is present or running.

* A method I could call to ask CP to pause any /who requests.

* A method I could call to ask CP to continue.

Many thanks for any feedback other than flames.

User avatar
Rollie
Site Admin
Posts: 4783
Joined: Sun Nov 28, 2004 11:52 am
Location: Austin, TX
Contact:

Post by Rollie »

You can check the variable

Code: Select all

g_IsCensusPlusInProgress
to see if a Census is currently running. Try just setting

Code: Select all

g_CensusPlusPaused
to true to pause the census and false to resume. Alternately you could call

Code: Select all

CensusPlus_TogglePause
which will set a manually paused if a Census is running and will resume if a Census were running but paused.

Looking at the code, it looks that would probably be the easiest thing to do.

Just before you do your /who data, call CensusPlus_TogglePause and then call it again when you're done.
phpbb:phpinfo()

hafeliel
Posts: 2
Joined: Wed Apr 11, 2007 9:41 am
Location: Cedar City, Utah
Contact:

Post by hafeliel »

Sweet! Many thanks. It is working with projects like this one that makes software development so worth it.

Phreeze
Posts: 167
Joined: Sun Oct 02, 2005 9:47 am
Location: Luxemburg (L),Europe

Post by Phreeze »

an thanks to a such good developper like Rollie, that has by far the best support for his addon, this one and newer addons like yours have no problems to coexist ;)

Post Reply