Thread Tools Display Modes
01-13-13, 05:33 PM   #1
Sieben11
A Deviate Faerie Dragon
Join Date: Jan 2009
Posts: 10
Logineffect & Player_entering_world

Thought I'd ask here as there is limited data I found on LOGINEFFECT. Maybe just didn't find the right spot. Anyways, can the spell "LOGINEFFECT" be used effectively in place of the event "PLAYER_ENTERING_WORLD"? Given that both fire when logging in or changing instances. Have not tested changing instances bit. Going off someones reply on WoWHead. Though I do know it fires every time I logged in.
  Reply With Quote
01-13-13, 06:09 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you want to do something once when your addon loads, use ADDON_LOADED. If you want to do something once when you log in, use PLAYER_LOGIN. If you want to do something every time you see a loading screen, use PLAYER_ENTERING_WORLD. If you want to do something else, you'll have to be more speific about what it is.

However, watching for a spellcast is not an appropriate way to detect logging in or anything else other than detecting when someone casts a spell.
__________________
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
01-13-13, 06:30 PM   #3
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Adding to what Phanx said, PLAYER_LOGIN fires on every UI reload as well.
  Reply With Quote
01-14-13, 11:21 AM   #4
Sieben11
A Deviate Faerie Dragon
Join Date: Jan 2009
Posts: 10
Originally Posted by Phanx View Post
If you want to do something once when your addon loads, use ADDON_LOADED. If you want to do something once when you log in, use PLAYER_LOGIN. If you want to do something every time you see a loading screen, use PLAYER_ENTERING_WORLD. If you want to do something else, you'll have to be more speific about what it is.

However, watching for a spellcast is not an appropriate way to detect logging in or anything else other than detecting when someone casts a spell.
Originally Posted by Haleth View Post
Adding to what Phanx said, PLAYER_LOGIN fires on every UI reload as well.

Yes was just curious on the firing of that spell. Event types I know. Had been just curious about that since there was little information floating about. With a few tests I did find:

LOGINEFFECT - Fires when first entering the world/instance. And of course never on a UI reload.

PLAYER_ENTERING_WORLD - fires on UI reloads as well

Was just mostly curious. Thanks for the replies.

A simple use of it could be to announce your initial arrival into the world/instance. Without much care to store it, or remember it across UI reloads. ie say "WoW what a long journey it has been."

Can be used for RP stuff.
Considering : Fires on world/instance. Not useful to try and store since UI reloads will dismiss it.
So it is more for things that are more dismissable then rememberable.

Last edited by Sieben11 : 01-14-13 at 11:30 AM.
  Reply With Quote
01-14-13, 07:28 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You seem to be confusing spells with events.

LOGINEFFECT is a spell. Spells don't fire; only events fire. To detect a spell, you must register for UNIT_SPELLCAST_SUCCEEDED or another event that tells you when a spell is cast, and then evaluate the event arguments to determine whether the spell cast was LOGINEFFECT or not, and then unregister the event so you are not continuing to evaluate arguments for potentially millions of spellcasts during your gameplay session.

PLAYER_LOGIN is an event. You just register for it, and don't have to check any arguments when it fires to determine why it fired -- it fires once and only once when you log into the game, and never at any other time.

That's what events are for -- to notify you when something happens. Using a spell to detect logging in is just as silly as using a spell to detect entering combat. Neither of those are good ideas. Just use the events that fire specifically to tell you that you logged in or entered combat.
__________________
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

WoWInterface » Developer Discussions » General Authoring Discussion » Logineffect & Player_entering_world


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