Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
No edit summary
 
mNo edit summary
 
Line 1: Line 1:
  +
{{wowapi}}
−
Joined WoW October 6, 2006. First character was a warlock on Undermine. Made a pally on Medivh, got bored of it, made a druid, fell in love, and have been 70 since November, 2007. I love long walks through Moonglade, romantic picnics under the glow of Tempest Keep, and fishing off of the docks at Stormwind.
 
−
==Raiding==
 
−
I have raided everything from MC up to Sartharion. Click the link below to see all he bosses that I have killed.
 
   
  +
These are cut-and-paste functions that you can use in your addons, submitted by Wowpedia contributors.
−
http://www.wowwiki.com/User:SDKPhoenix/Raids
 
   
−
==Achievements==
+
== API ==
  +
The following functions aim at extending the information WoW API provides; some are provided by specialized addons rather than being copy/pastable.
−
{{User GeneralAchievements|37}}{{User QuestAchievements|43}}{{User ExplorationAchievements|67}}{{User PvPAchievements|43|alliance}}{{User InstanceAchievements|112}}{{clrl}}
 
  +
:[[GetSellValue]](item) - Returns an item's merchant sell price.
−
{{User ProfessionAchievements|61}}{{User ReputationAchievements|25}}{{User EventAchievements|50}}{{User StrengthAchievements|14}}{{clrl}}
 
  +
:[[GetMinimapShape]]() - Returns a string describing the shape of the minimap (square? round? and more)
  +
:[[allAreType]](type,...) - Returns true if all the additional parameters are of the type specified.
   
  +
== Arguments & Returns ==
−
==Badges==
 
  +
: [[setArgs]](myTable, "name", ...) - remember list of arguments to use for a callback
−
{{User Nether ray}}{{User Drake}}{{User BFRam}}{{User ShatteredSun}}{{User NaaruChamp}}{{User PvP Rank|Corporal}}{{clrl}}
 
  +
: [[getArgs]](myTable, "name", ...) - retreive stored list of arguments, plus optional extras
−
{{User exalted|Netherwing}}{{User Dark Portal}}{{User Deadmines}}{{User Dedicated}}{{User Raid}}{{User WW Editor}}{{clrl}}
 
  +
: [[GetReturnValues]](order, functionCall) - Get the return values from ''functionCall'' in any ''order'' you want.
−
{{User exalted|Cenarion Expedition}}{{User exalted|Consortium}}{{User exalted|Ogri'la}}{{User exalted|Sporeggar}}{{User exalted|Violet Eye}}{{User exalted|Skyguard}}{{clrl}}
 
−
{{User exalted|Sha'tar}}{{User exalted|Aldor}}{{User exalted|Shattered Sun Offensive}}{{User exalted|Argent Dawn}}{{User exalted|Cenarion Circle}}{{User Alliance}}{{clrl}}
 
−
{{User loser}}{{User Blackfathom Deeps}}{{User NotFactionSnob}}{{User exalted|humans}}{{User exalted|Honor Hold}}{{User level|70}}{{clrl}}
 
−
{{User class|Druid}}{{User Profession|Alchemy|Herbalism}}{{User All pros}}{{User bothgenders}}{{User A'dalHand}}{{User GuardCen}} {{clrl}}
 
−
{{User Epicmount}}{{User Talbuk}}{{User Crow}}{{User AmaniBear}}{{User Gryphon}}{{User BrewfestMount|Kodo}}{{clrl}}
 
−
{{User Deathknight}}{{User Bloodsail Buccaneer}}{{User TBCCE}}{{User MissAV}}{{User WotLKCE}}{{User Hippogryph}}{{clrl}}
 
−
{{User Northrend}}{{User EK}}{{User Kalimdor}}{{User Outland}}{{User Deathknight}}{{User Server|Medivh|US}}{{clrl}}
 
−
{{User level|80}}{{User ClassCombo|Night Elf|Druid|male|80}}{{clrl}}
 
   
  +
== Color Functions ==
−
==Silly==
 
  +
:[[ColorGradient]](perc, R1, G1, B1, R2, G2, B2[, ...]) - Converts a percent value into a gradient from 2 or more RGB values
−
{{User Cookies}}{{User awesome}}{{User Creative}}{{User Pandamonium}}{{User NoTakeCandle}}{{User Tinfoil}}{{clrl}}
 
  +
:[[HexToRGB]]("string") - Converts a hex color string to RGB values (0-255)
−
{{User Cow}}{{User Deathwing}}{{User Pets}}{{User Farmer}}{{User Purplz}}{{User Noracesclasses}}{{clrl}}
 
  +
:[[HexToRGBPerc]]("string") - Converts a hex color string to RGB values (0.0-1.0)
−
{{User SpellNaxx}}{{User ProDraenei}}{{User SpellRogue}}{{User SpellOrg}}{{User SpellTerokkar}}{{User Arakkoa}}{{clrl}}
 
  +
:[[RGBToHex]](red, green, blue) - Converts a RGB value (0-255) into a hex string
−
{{User WantPandaren}}{{User 1337}}{{clrl}}
 
  +
:[[RGBPercToHex]](red, green, blue) - Converts a RGB value (0.0-1.0) into a hex string
−
==Characters==
 
  +
−
{{usertable/header02|100}}
 
  +
== Cursor Functions ==
−
{{usertable/row02|Shadowseek|Alliance|Medivh|Night_Elf_Male|Druid|80|LOTH|Corporal}}
 
  +
:[[GetCursorScaledPosition]]() - Return the exact position the cursor is at based on scale.
−
{{usertable/row02|Magmaspike|Alliance|Medivh|Human_Male|Mage|71|LOTH|None}}
 
  +
−
{{usertable/row02|Shadowdraga|Alliance|Medivh|Human_Female|Paladin|23|LOTH|Private}}
 
  +
== Event Functions ==
−
{{usertable/row02|Shadowphoea|Alliance|Medivh|Human_Female|Warlock|16|none|None}}
 
  +
:[[User:Egingell/PLAYER MONEY|PLAYER_MONEY]] - Add a message to the chat frame when you gain or spend money.
−
{{usertable/row02|Shadowsnow|Alliance|Medivh|Dwarf_Male|Hunter|15|none|None}}
 
  +
−
{{usertable/row02|Asteris|Alliance|Medivh|Draenei_Female|Shaman|8|La Vie en Rose|None}}
 
  +
== Frame Functions ==
−
{{usertable/row02|Exteris|Horde|Medivh|BloodElf_Male|Rogue|8|none|None}}
 
  +
: [[GetQuadrant]](frame) - Find which quadrant of the screen a frame lies in.
−
{{usertable/row02|Medorivan|Horde|Medivh|BloodElf_Male|Paladin|14|none|None}}
 
  +
: [[GetUIParentAnchor]](frame) - Returns SetPoint args for the frame, anchor is relative to the nearest corner of the screen.
−
{{usertable/row02|Necroxxus|Alliance|Medivh|Night_Elf_Male|Death Knight|58|LOTH|None}}
 
  +
: [[Frame:RegisterEvents]](...) - Register '''n''' number of events at once.
−
{{usertable/footer02}}
 
  +
: [[Frame:UnregisterEvents]](...) - Unregister '''n''' number of events at once.
  +
: [[Frame:SetManyAttributes]](...) - Simple function to embed in a frame to set many atributes at once.
  +
: [[UnregisterEventFromAllFrames]](event) - Tell all the frames listening for '''event''' to stop listening for it.
  +
: [[addDropDownMenuButton]](uid, dropdown, index, title, usable, onClick [, hint]) - Adds a new button to a drop down (right-click popup) list of your choice.
  +
  +
== Guild Functions ==
  +
:[[GuildNameToIndex]](name, searchOffline) - Takes a name and converts it to their index within the guild for other guild functions.
  +
  +
== Item Functions ==
  +
:[[EquipItemByLink]](link) - Equips the first matching item found in the player's bags.
  +
  +
== Localization Tables ==
  +
: [[LocalizedClassNames]] - Table of localized classes
  +
  +
== Map Functions ==
  +
:[[GetPlayerBearing]]() - Returns the player's current facing bearing based on minimap arrow
  +
  +
== Menu Functions ==
  +
:[[Context Menu Maker]] - Pseudo-Class. Add/Remove menu items and show the menu when you're ready.
  +
  +
== Metatables ==
  +
: [[Memorizing table]] - A special table that calculates values as needed and saves them into itself
  +
  +
== Number Functions ==
  +
: [[round]](input, n) - Round '''input''' to '''n''' places.
  +
: [[truncate]](number, n) - Truncate a number to n decimal places.
  +
  +
== Slash Function ==
  +
: [[GetSlashFunc]] - Get an existing slash command function for hooking.
  +
: [[RunSlashCmd]] - Passes a slash command to the chatframe
  +
: [[SlashCmdList AddSlashCommand|SlashCmdList_AddSlashCommand]](name, func, ...)
  +
  +
== String Functions ==
  +
:[[ChunkSplit]](string [, length [, endChars]])   - Split a string into groups of "length" each ending with "endChars" (identical to the [http://php.net/chunk-split PHP function] of the same name).
  +
:[[CountChars]](haystack, needle)   - Return how many times ''needle'' is contained in ''haystack''.
  +
:[[GetWords]]("string")   - Split words on space boundary, return table
  +
:[[printMSG]]("string")   - Displays a custom message to the default chat frame, for the user to see (time, code and size saver).
  +
:[[strfindt]](tabCaptures, ...)   - Wrapper for [[API strfind|strfind]]() that returns captures in a table - can be used in if() clauses!
  +
:[[StringHash]]("string")   - Create a fair-quality 32-bit hash of a string
  +
:[[substr]]("string", start [, length])   - Imp [[API strsub|strsub]]. Returns a string starting from ''start'' to ''length'' characters from ''start'' (identical to the [http://php.net/substr PHP function] of the same name).
  +
  +
== Table Functions ==
  +
:[[EraseTable]](t) - Erase all values from a table
  +
:[[tinsertbeforeval]](tab, valBefore, val)   - Insert one value before another (without knowing its index)
  +
:[[tremovebyval]](tab, val)   - Remove a value (without knowing its index)
  +
:[[tcount]](tab)   - Count table members (works on non-integer-indexed tables)
  +
:[[tcopy]](tabTo, tabFrom)   - Recursively copy contents of one table to another
  +
  +
== Time Functions ==
  +
:[[GameTime:Get]]()   - Get server time including seconds and milliseconds
  +
:[[wait]](delay,function [, param [,param [,...]]])   - Wait a specified amount of time before running a function with the given parameters.
  +
:[[SecondsToDays]]()   - Converts seconds to days/hours/minutes/seconds
  +
  +
== See also ==
  +
  +
* [[:Category:HOWTOs]] - must have cut-and-pasteable code snippets
  +
  +
[[Category:Interface customization]]
  +
[[Category:User defined functions| User defined functions]]

Revision as of 21:54, 19 October 2010

These are cut-and-paste functions that you can use in your addons, submitted by Wowpedia contributors.

API

The following functions aim at extending the information WoW API provides; some are provided by specialized addons rather than being copy/pastable.

GetSellValue(item) - Returns an item's merchant sell price.
GetMinimapShape() - Returns a string describing the shape of the minimap (square? round? and more)
allAreType(type,...) - Returns true if all the additional parameters are of the type specified.

Arguments & Returns

setArgs(myTable, "name", ...) - remember list of arguments to use for a callback
getArgs(myTable, "name", ...) - retreive stored list of arguments, plus optional extras
GetReturnValues(order, functionCall) - Get the return values from functionCall in any order you want.

Color Functions

ColorGradient(perc, R1, G1, B1, R2, G2, B2[, ...]) - Converts a percent value into a gradient from 2 or more RGB values
HexToRGB("string") - Converts a hex color string to RGB values (0-255)
HexToRGBPerc("string") - Converts a hex color string to RGB values (0.0-1.0)
RGBToHex(red, green, blue) - Converts a RGB value (0-255) into a hex string
RGBPercToHex(red, green, blue) - Converts a RGB value (0.0-1.0) into a hex string

Cursor Functions

GetCursorScaledPosition() - Return the exact position the cursor is at based on scale.

Event Functions

PLAYER_MONEY - Add a message to the chat frame when you gain or spend money.

Frame Functions

GetQuadrant(frame) - Find which quadrant of the screen a frame lies in.
GetUIParentAnchor(frame) - Returns SetPoint args for the frame, anchor is relative to the nearest corner of the screen.
Frame:RegisterEvents(...) - Register n number of events at once.
Frame:UnregisterEvents(...) - Unregister n number of events at once.
Frame:SetManyAttributes(...) - Simple function to embed in a frame to set many atributes at once.
UnregisterEventFromAllFrames(event) - Tell all the frames listening for event to stop listening for it.
addDropDownMenuButton(uid, dropdown, index, title, usable, onClick [, hint]) - Adds a new button to a drop down (right-click popup) list of your choice.

Guild Functions

GuildNameToIndex(name, searchOffline) - Takes a name and converts it to their index within the guild for other guild functions.

Item Functions

EquipItemByLink(link) - Equips the first matching item found in the player's bags.

Localization Tables

LocalizedClassNames - Table of localized classes

Map Functions

GetPlayerBearing() - Returns the player's current facing bearing based on minimap arrow

Menu Functions

Context Menu Maker - Pseudo-Class. Add/Remove menu items and show the menu when you're ready.

Metatables

Memorizing table - A special table that calculates values as needed and saves them into itself

Number Functions

round(input, n) - Round input to n places.
truncate(number, n) - Truncate a number to n decimal places.

Slash Function

GetSlashFunc - Get an existing slash command function for hooking.
RunSlashCmd - Passes a slash command to the chatframe
SlashCmdList_AddSlashCommand(name, func, ...)

String Functions

ChunkSplit(string [, length [, endChars]])   - Split a string into groups of "length" each ending with "endChars" (identical to the PHP function of the same name).
CountChars(haystack, needle)   - Return how many times needle is contained in haystack.
GetWords("string")   - Split words on space boundary, return table
printMSG("string")   - Displays a custom message to the default chat frame, for the user to see (time, code and size saver).
strfindt(tabCaptures, ...)   - Wrapper for strfind() that returns captures in a table - can be used in if() clauses!
StringHash("string")   - Create a fair-quality 32-bit hash of a string
substr("string", start [, length])   - Imp strsub. Returns a string starting from start to length characters from start (identical to the PHP function of the same name).

Table Functions

EraseTable(t) - Erase all values from a table
tinsertbeforeval(tab, valBefore, val)   - Insert one value before another (without knowing its index)
tremovebyval(tab, val)   - Remove a value (without knowing its index)
tcount(tab)   - Count table members (works on non-integer-indexed tables)
tcopy(tabTo, tabFrom)   - Recursively copy contents of one table to another

Time Functions

GameTime:Get()   - Get server time including seconds and milliseconds
wait(delay,function [, param [,param [,...]]])   - Wait a specified amount of time before running a function with the given parameters.
SecondsToDays()   - Converts seconds to days/hours/minutes/seconds

See also