Wikia

WoWWiki

Changes: API SetCurrentTitle

Edit

Back to page

m (Fixing typo)
(The "quick and dirty" solution was a little *too* quick and dirty, with the potential to cause lag or even crashes.)
 
Line 10: Line 10:
   
 
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.
 
/script repeat i = random(GetNumTitles()) until IsTitleKnown(i) == 1; SetCurrentTitle(i)
 
 
This will set a random title. (Warning: quick'n'dirty: may hang WoW if no title available. May cause lag if only few titles are available.)
 
   
 
/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])
 
/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 run a little more efficiently than the above, by iterating over the list of titles, grabbing the ones the user has, then choosing a random one from that list.
+
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 ==

Latest revision as of 02:28, January 20, 2010

WoW API < SetCurrentTitle

Changes your character's displayed title.

SetCurrentTitle(titleId);

Arguments Edit

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 Edit

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 Edit

  • 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.

Around Wikia's network

Random Wiki