WoW:API SetCurrentTitle: Difference between revisions
Jump to navigation
Jump to search
(It *cannot* be called from OnEvent/OnUpdate entry points. Read the tag text.) |
(The "quick and dirty" solution was a little *too* quick and dirty, with the potential to cause lag or even crashes.) |
||
Line 1: | Line 1: | ||
{{protectedhwapi|3.3}} {{wowapi}} | {{protectedhwapi|3.3}} {{wowapi}} | ||
Changes your character's displayed title. | Changes your character's displayed title. | ||
SetCurrentTitle(titleId); | |||
== Arguments == | == Arguments == | ||
Line 11: | Line 11: | ||
This sets the title "Elder" if your character had earned the title, otherwise it removes any active title. | This sets the title "Elder" if your character had earned the title, otherwise it removes any active title. | ||
/ | /run local t={}; for titles=1,GetNumTitles()-1,1 do if IsTitleKnown(titles)==1 then table.insert(t,titles) end; end; local x=random(#t); print("Using title: "..GetTitleName(t[x])); SetCurrentTitle(t[x]) | ||
This will | This macro will iterate over the list of titles, grab the ones the user has, then choose a random one from that list. | ||
== Details == | == Details == | ||
* The last indexed value (currently 143) returns nil and removes the player's name completely (not available to players). | * The last indexed value (currently 143) returns nil and removes the player's name completely (not available to players). | ||
* [[API GetTitleName|GetTitleName]] can be used to find the name associated with the [[TitleId]]. | * [[API GetTitleName|GetTitleName]] can be used to find the name associated with the [[TitleId]]. |
Revision as of 02:28, 20 January 2010
This function is protected, and may only be called in response to hardware event.
|
Changes your character's displayed title.
SetCurrentTitle(titleId);
Arguments
- titleId
- Number - ID of the title you want to set. The identifiers are global and therefore do not depend on which titles you have learned. Invalid or unlearned values clear your title. See TitleId for a list.
Example
SetCurrentTitle(43);
This sets the title "Elder" if your character had earned the title, otherwise it removes any active title.
/run local t={}; for titles=1,GetNumTitles()-1,1 do if IsTitleKnown(titles)==1 then table.insert(t,titles) end; end; local x=random(#t); print("Using title: "..GetTitleName(t[x])); SetCurrentTitle(t[x])
This macro will iterate over the list of titles, grab the ones the user has, then choose a random one from that list.
Details
- The last indexed value (currently 143) returns nil and removes the player's name completely (not available to players).
- GetTitleName can be used to find the name associated with the TitleId.