XAML reference

From HoNWiki

Jump to: navigation, search

Contents

[edit] Misc Info:

  • The interface is 100h, the game-scene is 88h tall, the width of it depends on the resolution of the screen.
  • To override a template or item that HAS A NAME ATTRIBUTE without editing it, you can make another one with the same name attribute in a .package file and import the package at the beginning of the file where the template/element you want to override is. Only the first element with a given name will be loaded, so the original one won't load.
  • Setting host_dynamicresreload 1 will reloadinterfaces automatically upon file change.

[edit] Elements:

Note: Clicking a hyperlinked element will take you to a list of attributes specific to that element.

[edit] Attributes:

See List of XAML Attributes for complete attribute list

[edit] Events:

Name Description Note
onclick Called when something is left clicked down, then up. Not sure if this adjusts for reassigned mouse binds.
onrightclick Called when something is right clicked down, then up. Not sure if this adjusts for reassigned mouse binds.
onhotkey Called when hotkey is pressed. Can only have 1 hotkey.
ontrigger Called when watch attribute is triggered. There can be multiple ontriggers; use watch0 with ontrigger0, watch1 with ontrigger1, and so on...
onfocus
onlosefocus
onchange
onenter Called when the object is moused over for buttons and when the input cursor appears for textboxes. Only works for <textbox> and <button>.
onmouseout Called when cursor leaves the area the object cover.
onmouseover Called when cursor is over the object.
onmouseldown Called when object is clicked by left mouse button (mouse down).
onmouselup Called when object is clicked by left mouse button (mouse up).
onmouserdown Called when object is clicked by right mouse button (mouse down).
onmouserup Called when object is clicked by right mouse button (mouse up).
onload Called when the object is loaded/initialized. Unable to use Trigger() from onload,
onframe Occurs once per frame/sec (fps), only occurs when the object is visible
onevent{id} Called with CallEvent('{objectname}', {id}).
Use CallEvent('{objectname}') to trigger onevent.
onenddrag
ondoubleclick
onesc
onhide
onselect
onshow Called when an object is set visible or drawn for the first time since the last page reload.
onwake Called when an widget is woken from the SleepWidget command or forced awake.
onreload Probably only work on <interface>s

Note: to add more attribute-event couples of the same kind in the same element add a number at the end of them (Example: hotkey0="K" onhotkey0="do something" hotkey1="L" onhotkey1="do something else")

There might be (there are actually) other events, if you know or suspect the existence of any other event please add it to the appropriate list, and maybe add a short description.

[edit] Commands:

[edit] Operators

+,-,*,/ Add, Subtract, Multiply and Divide
 % Mod, gives the quotient of a division (Example: 7 % 3 = 1)
int Floor(float);
int Ceil(float);
floor and ceiling functions map a real number to the next smallest or next largest integer
 !bool NOT operator, returns false if bool is true and vice-versa
gt greater than
lt less than
ge greater than or equal to
le less than or equal to
== equals
|, or OR
and AND

[edit] Strings

string # string Concatenates the two string before and after it.
CreateString Create a string variable. CreateString('Name', 'value'); EX: CreateString('dev_spawnerType', 'Creep_LegionMelee');
GetHeightFromString
GetStringWidth
GetStringWrapHeight
GetTextWidth
GetWidthFromString
GetXFromString
GetYFromString
LowerString
SearchString int SearchString ( MyString, SearchString, startPosition ); int returned is the location of the string.
StringContains
StringContainsOnly StringContainsOnly( MyString, '#$@!.,`\'~_-]', 'Aa0'); I believe this means ( String, Allowed Symbols, Allowed A(-Z) a(-z) and 0(-9)) For checking characters.
bool StringEmpty(string); Returns true if the string is empty
bool StringEquals(string, string); Compares two strings and returns a bool, true if they're the same.
StringLength Returns the amount of characters in a string. ex: ontrigger="SetVisible(StringLength(param) gt 0); SetTexture(param);" Translates to, "if string has 1 or more characters in it, do ___"
Substring string substring( MyString, startingPosition, lengthOfSubstring); retutns the substring requested.
UpperString

[edit] Conversions

string FtoA(float, int) Converts a float to a string, displaying int decimals.
string FtoA2(float, int min, int max) Converts a float to a string displaying minimum int-1 decimals and maximum int-2 decimals
FtoP(float) float to Percentage Returns a % but need to do %% to get a percent in a string.
FtoT(float time, int format, int approximation, string format2)
FtoT(float, int)
Converts float to time

format can be:

   * -1 -> MM:SS (appears the same as 1)
   * 0 -> in seconds
   * 1 -> MM:SS (minutes go over 60, used for match time display)
   * 2 -> H:MM:SS with a leading zero if less than 1 hour

approximation: how many digits are considered for seconds after the "," format2:

   * a -> 12m 34s
   * - -> 12:34
   * 0 -> 12:34

[edit] Common Commands

Feel free to add any and all commands that are used often in UI modding.

AllChat(string <message>); Sends a message to the All Chat in-game for all players to see.
Call(string <var_name>, string <value>); Calls a Widget.
ClearText();
CreateBool(string <var_name>, bool <value>); Creates a bool variable.
CreateInt(string <var_name>, int <value>); Creates a int variable.
CreateFloat(string <var_name>, float <value>); Creates a float variable.
CreateString(string <var_name>, string <value>); Creates a string variable.
Echo(<text or value>, <text or value>, ...); Prints to the console. Text and variables can be concatenated using the ',' character.
HideWidget(string); Hides the widget whose name attribute is equal to the provided string.
If(bool <condition>, <if true do this>, <if false do this>); a IF-THEN-ELSE structure. Example: If(param1 == 0, ClearText(), SetText(Ceil(param0) # '/' # Ceil(param1)));
Instantiate(string <template>, string attribute0, string value0, string attribute1, string value1, ...); Creates an instance of the template with attributes and values as given.
TeamChat(string <message>); Sends a message to the Team Chat in-game for only team members to see.
Set(string <var_name>, <value>); Sets the given variable to the given value (value has to be of the same type of the variable of course).
SetColor(string <color>); Sets the color of the element, accepts three formats of the color: html color name or codes that you can check here or a sequence of 4 float numbers divided by a space, ranging from 0 to 1 indicating in order Red, Green, Blue and Alpha (transparency), for example like '1 .7 0 .45'
SetText(string <text>); Called from within a label element, sets the text of the label.
SetTextColor(string); Sets the color of the text, accepts three formats of the color: html color name or codes that you can check here or a sequence of 4 float numbers divided by a space, ranging from 0 to 1 indicating in order Red, Green, Blue and Alpha (transparency), for example like '1 .7 0 .45'.
SetVisible(bool); Set the visibility of the element, hidden if bool is false.
ShowWidget(string <widget_name>); Shows the widget whose name attribute is equal to the provided string.
Split( <command_1>, <command_2>, <command_3>, ...); Lets you execute multiple commands in place where only one could be normally be executed, like inside If statements.
ToggleWidget(string <widget_name>); Toggles the status between shown and hidden of the widget whose name attribute is equal to the provided string.
VarExists(string); Returns true if variable string exists.

[edit] Full Lists

Updated October 28, 2009, Version 0.1.50.1:

Updated August 14, 2009, Version 1.35:

[edit] Strings

Strings hold variables of all sorts. When reading a string, it should be refered to directly. Strings are stored without their apostrophes. Three examples of booleans reading strings:


StringEquals(variableheld, 'yes')

StringEmpty(variableheld)

!(integername == -1)


There is also the special case of concatenated strings. These are often used for cases where the string will be used multiple times for different reasons. The underscores have no special significance.


StringEquals(*('player' # param27),*('player' # mod_Player))

*('number_' # param27) lt 100


When writing a string or the variable contained within it, apostrophes are used, noting what is a new string. When any of these strings are referenced in the future, they will return what is inside of them.


CreateString('variableheld','yes')

CreateInt('integername',3)

CreateString('string3', string2 # param0)

Set('number_' # param27,*('number' # param27)+1)


[edit] Triggers

Triggers are user created "Watches." To create a trigger, declare it once, in one of the files you will be using.


<trigger name="MyTrigger">

Now My trigger can be set to a watch inside any tag


watch="MyTrigger"


To throw your trigger you call


Trigger('MyTrigger', 'blah', 'blah', true, false, 0, 2, 3, 'blah blah blah');


All of the inputs following the name of your trigger will be used as param0-whatever.

[edit] Watches

ActiveExperience param1 int: total exp
param2 int: exp needed for next level (if its 167/200, this is 200)
param3 ??: PROBABLY is the exp needed to level up (needs to be verified)
param4 int: exp you have for the next level (ex: if xp needed for lvl 2 is 100, and you have 150, this is 50)
ActiveHealth param0 float: current health
param1 float: total health
param2 float: health percentage as float (not sure if it's 0 to 1 or 0 to 100)
ActiveHealthRegen param0 float: base health regeneration
param1 float: current health regeneration including buffs
ActiveLevel param0 int: indicates the level of the owned selected unit (your hero, your creeps, allied hero that is being shared)
ActiveInventoryStatus{index} {index}: number of the ability [0 to 41]


param0 bool: true if the ability can be used
param1 bool: true if the ability is currently actived (ie. channeling or autocasted)
param2 bool: true if you are silenced
param3 bool: true if you don't have enough mana to cast this ability
param4 bool: true if the ability is currently being cast
param5 int: the level of the ability
param6 bool: true if the ability can be leveled up further, at this time
param7 int: the max level of the ability
param8 bool: true if the hotkey has been pressed and you are currently selecting a target

ActiveLifetime param0: watch="ActiveLifetime" ontrigger="SetText(Ceil(param0 / 1000) # ' s');"
param1: <panel watch="ActiveLifetime" ontrigger="SetVisible(param1 gt 0);" visible="false" noclick="true" pasivechildren="true">
param2: <piegraph texture="/ui/common/exp_ring.tga" watch="ActiveLifetime" ontrigger="SetValue(param2);" start="225" end="-49" square="1" color="#e5df2f" value=".2" noclick="true"/>
ActiveMana param0 float: current mana
param1 float: total mana
param2 float: mana percentage as float (not sure if it's 0 to 1 or 0 to 100)
ActiveManaRegen param0 float: base mana regeneration
param1 float: current mana regeneration including buffs
AllyAbility{index}Cooldown{index2} {index}: number of the ability [0 to 3]
{index2}: number of the ally player in team [0 to 3]
param int: cooldown time left on the ability in seconds
AllyAbility{index}Info{index2} {index}: number of the ability [0 to 3]
{index2}: number of the ally player in team [0 to 3]


param0 :
param1 bool: true if you still don't have that skill (level 0) [Color: grey]
param2 bool:
param3 bool:
param4 bool: true if the ability is unavailable because of silence/stun [Color: red]
param5 bool: true if you don't have enough mana to use the ability [Color: blue]
param6 : level of the ability
param7 bool:
param8 bool:
param9 :
param10 : name of the ability
param11 : icon of the ability, use with SetTexture(param);
param12 bool: true if the ability is a passive skill [Color: green]
If(param2 or param3, SetColor('lime') -> true if the ability can be used (have mana and not in cooldown)
If(param8 and param7, SetColor('yellow') -> no clue
Color: Orange -> have mana, but in CD

AllyDisconnected{index} {index}: int from 0 to 3, indicates the number of your ally
param bool: indicates if the ally is disconnected (true) or not (false)
AllyDisconnectTime{index} {index}: int from 0 to 3, indicates the number of your ally
param float: indicates disconnection time left, formatted as a clock with SetText(FtoT(param, 1, 0, '-'))
AllyExists{index} {index}: int from 0 to 3, indicates the number of your ally
parambool: true if there's a player on that index
AllyGold{index} {index}: int from 0 to 3, indicates the number of your ally
param: Ally's gold "SetText(Translate('tooltip_gold') # param);"
AllyHealth{index} {index}: int from 0 to 3, indicates the number of your ally
param0 float: current health
param1 float: total health
param2 float: health percentage as float (not sure if it's 0 to 1 or 0 to 100)
AllyHeroInfo{index} {index}: int from 0 to 3, indicates the number of your ally
param0string: Hero name
param1: Hero Icon
param2: Hero level ontrigger="SetText(Translate('tooltip_level', 'level', param2));"
AllyLoadingPercent{index} {index}: int from 0 to 3, indicates the number of your ally
param float indicates the loading percentage
AllyMana{index} {index}: int from 0 to 3, indicates the number of your ally
param0 float: current mana
param1 float: total mana
param2 float: mana percentage as float (not sure if it's 0 to 1 or 0 to 100)
AllyPlayerInfo{index} param0 string: Player's name
param1: Player's color
AllyRespawn{index} {index}: int from 0 to 3, indicates the number of your ally
param0 float: empty if hero is alive (can be checked with StringEquals(param0, ''); ), when hero is dead contains a float number indicating the time left until respawn in milliseconds (use Ceil(param0 / 1000); to convert into seconds).
AllyStatus{inedx} {index}: int from 0 to 3, indicates the number of your ally
param bool: if the hero is alive (true) or dead (false)
EndGame param: bool: true if throne is destroyed else false.
EventDefeat
EventVictory
Called when the throne has been destroyed.
HeroHealth param0 float: current health
param1 float: total health
param2 float: health percentage as float (not sure if it's 0 to 1 or 0 to 100)
HeroIcon param: hero icon, use with SetTexture(param);
HeroLevel param0 int: current hero level
param1 int: number of unused skill points
HeroMana param0 float: current mana
param1 float: total mana
param2 float: mana percentage as float (not sure if it's 0 to 1 or 0 to 100)
HeroStatus param bool: if the hero is alive (true) or dead (false)
HeroRespawn param0 float: empty if hero is alive (can be checked with StringEquals(param0, ); ), when hero is dead contains a float number indicating the time left until respawn in milliseconds (use Ceil(param0 / 1000); to convert into seconds).
LobbyGameInfo param0 string: Game Mode
param1 string: Game Options
param2 string: Server
param3 string: Map Name
param4 int: Players
param5 int: MaxPlayers
param6 int: Ping
param7 string: Game Name
param8 int: MatchID
param9 string: Host Name
LobbyPlayerInfo{index} {index}: the index of the player, 0 to 4 is legion, 5 to 9 is hellborne


param0 int: -1 is no player, 0 to * is the number of the player using that slot
param1 string: name of the player using the slot
param2: color of the slot in 'R G B A' format
param3 bool: True if the player is the host
param4:
param5:
param6:
param7 string: name of the color of the slot
param8 bool: True if you are in this slot.
param9 int: player ID
param10 int: PSR
param11:
param12 int: PSR gain if the game is won
param13 int: PSR loss if the game is lost (negative number)
param14:
param15 bool: Slot is locked true/false
param16 bool: Player Team - true if the player is on Hellborne, false if on Legion.
param17 bool: True if you are the host.
param18 bool: True if this slot is the top slot for its team.
param19 bool: True if the player is an S2 employee
param20 bool: True if the player is a prepaid account

RecipeComponent{index}


RecipeUsedIn{index}

{index}: For RecipeComponent, the position of each item required to make up the recipe (Under Requires: heading). For RecipeUsedIn, the position of each recipe that the recipe can be used to make (Under Used In: heading). Range is from 0 to 3, left to right.


param0 bool: true if a component/recipe exists in this index, false if not
param1 string: item/recipe name.
param2 string: Additional item info. For example for Post Haste it's: "When activated, teleports self to a selected allied structure or unit."
param3 string: Path to item/recipe texture.
param4 int: Price.
param5 int: Total cost all components to the recipe. If RecipeComponent, same as param4.
param6 bool: true if item is available to purchase at the current location, false if not
param7 string: Text to be added at bottom of item/recipe tooltip. Example: Click to VIEW this recipe
param8 bool: true if component is a recipe.
param9 string: Path to shop icon texture.
param10 string: Name of shop where item/recipe can be bought.
param11 bool: true if component is present in inventory, false if it is not
param12 bool:  ?
param13 string: A single letter like Q or E. The hotkey used to buy the component or access the recipe from the shop.
param14 int: 2 for RecipeComponent, 3 for RecipeUsedIn
param15 bool:  ?
param16 bool: ?
param17 bool: true if recipe automatically combines items once they are purchased, false if recipe purchase is required
param18 bool: true if clicking the component (button) will redirect you to another shop window.
param19: ?
param20 float: ?
param21 int: ?
param22 int: ?
param23 bool: ?
param24 bool: ?

ScoreboardPlayer{index} {index}: the index of the player, 0 to 4 is legion, 5 to 9 is hellborne


param0 string: player's name
param1 string: player's hero name
param2: Player's Hero's Icon, use with SetTexture(param1);
param3: Player's color, use with SetColor(param3);
param4 int: Player's Hero's Level
param5 int: Number of Kills
param6 int: Number of Deaths
param7 int: Number of Assists
param8 bool: true if the player is alive, false is dead.

ScoreboardPlayerRespawn{index} {index}: the index of the player, 0 to 4 is legion, 5 to 9 is hellborne
param int: The time left before the hero respawns in seconds.
SelectedHealth{index} {index}: the number of the selected unit, starting from 0
param0 float: current health
param1 float: total health
param2 float: health percentage as float (not sure if it's 0 to 1 or 0 to 100)
SelectedMana{index} {index}: the number of the selected unit, starting from 0
param0 float: current mana
param1 float: total mana
param2 float: mana percentage as float (not sure if it's 0 to 1 or 0 to 100)
SelectedIcon{index} {index}: the number of the selected unit, starting from 0
param: selected unit icon, use with SetTexture(param);
SelectedIllusion{index} {index}: the number of the selected unit, starting from 0
param bool: true if the unit is a illusion
StashExists{slot} {slot}: the targeted slot in your stash. Ranging from 0-5. 0 is top left, 5 is bottom right.
param bool: True if slot is used else false.
StashIcon{slot} {slot}: the targeted slot in your stash. Ranging from 0-5. 0 is top left, 5 is bottom right.
param string: Path to item/recipe texture.
StashStatus{slot} {slot}: the targeted slot in your stash. Ranging from 0-5. 0 is top left, 5 is bottom right.


param0 bool: True if player can interact with the stash, else false.
param1 bool: True if {slot} is used, else false.
param2 bool: ?

VotePermissions Will be called repeatedly until param2, 3 and 4 reach 0.


param0 bool: ?
param1 int: Cooldown vote timer in milliseconds. Starting at 60000ms upon a vote call. Must reach 0 before user can vote again.
param2 int: Remake active timer in milliseconds. Starting at 300000ms at game start. Vote remake is available as long as this hasn't reached 0.
param3 int: Concede countdown timer in milliseconds. Starting at 900000ms at game start. Vote concede is unavailable as long as this isn't 0.
param4 bool: If a vote is in progress. (verify)
param5 bool: Have permission to call pause vote. (verify)
param6 bool: Have permission to unpause. (verify)
param7 bool: ?

VoteProgress


param0 float: Number of people that have voted.
param1 float: Total number of people eligible to vote.
param2 float: A number representing % of votes accepted. Use FtoP(param2) to get actual %.

PlayerCanShop PlayerGold EventPlayerGold ActiveHasInventory ActiveAttributeInfo MenuPlayerInfo{index} Minimap SelectedVisible{index} SelectedType{index} SelectedName{index} SelectedLevel{index} SelectedDamage SelectedArmor SelectedMoveSpeed SelectedHasAtrributes SelectedAttribute

Personal tools
Google AdSense