TasToolTipBox

Introduction


TasToolTipBox is a custom UI addition for Warcraft 3 V1.31 or higher in Lua & vjass.
It displays some generic spell values in a additional tooltip-box.
Show new Icon + Text slots next to the Tooltip resource costs, needs much manual setup.

Details


Creates an custom TooltipBox with "multiple" rows of custom Icon-Text-Frames.
When an activ Spell or item is hovered it shows the box and displays MissileSpeed, Cooldown, Range, Area & CastTime.
One can adjust the used Icons and amount of infos. To make them display different data you need to edit the system code.
For items only the first skill is considered, which should be activ one anyway.

Does not work correctly in group selection.
Does not work correctly for sub menues like hero skill, built or spellbooks.
In V1.31.1 always display values of Level 1.

Resource Tooltip Slots


same restrictions as above, Single Selection, sometimes unreliable in sub Menues, avoid command card colisions. No Spellbooks.

To display new Tooltip slots for object Editor objects you need 2 seperate actions for each rawCode that you want custom resource slots for.
Action 1 tell where the object can be hovered in the command card.
Action 2 what to display for the object.

function TasToolTipBox_AddData/TasToolTipBox_AddDataBatch are used to tell TasToolTipBox which objects are encountered.
The next example line adds 3 objects to human townhall normal mode, which is just selection no sub menu like built, learn.
JASS:
call TasToolTipBox_AddDataBatch(null , 'htow' , "hpea,Rhpm,hkee")
// townhall trains/researches this 3 rawCodes in its default view.


function TasToolTipBox_SetObjectSlot is used to setup the additional slots for each Object.
Lets display a new Slot for a peasant. 120 & Brilliance Aura Icon at the second additional slot.
JASS:
call TasToolTipBox_SetObjectSlot('hpea' , -2 , "120" , "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")
Now when a townhall is selected and one hovers the command button that is meant to hold peasant TasToolTipBox will show the additional Resource Slot.
294074-643a2e725e3c4f4ea64fe511a2e3c1e9.png


How to install


Requiers Warcraft 3 1.31+ or higher
  • Copy TasToolTipBox Lua (trigger Editor).
  • Copy required lib HoverOriginButton Lua.
  • Or Copy TasToolTipBox vjass (trigger Editor).
  • Copy required lib HoverOriginButton vjass.
  • export
    • war3mapImported\TasTooltipBox.fdf
    • war3mapImported\TasTooltipBox.toc
    • WHEN USING THE EXPORT ALL BUTTON, IT CAN HAPPEN THAT THE CONTENT OF THIS FILES SWAP
    • import them into your map
    • You can skip fdf & toc when you only want Slots in the default UI.
  • Installed

The system code this post, only contains the parts your as "user" care about.
At top some config.
Inside function StartUI the displayed text is set.
function endUI happens when the user stops pointing at a command button
When you want to change the displayed text, Beaware that both StartUI & endUI run in async context. Some things you should not do in this functions:
dont keep references to objects (that are going to be destroyed)
dont random
dont make new handleId
dont create
dont destroy
dont change gamestate

Lua:
--[[ TasToolTipBox V8c by Tasyen
  An additional TooltipBox for buttons in the command card/inventory which displays MissileSpeed, Cooldown, Range & Area values

  changes position of ORIGIN_FRAME_UBERTOOLTIP

  function TasToolTipBox.AddData(array, unitCode, objectCode)
    Tell the TasToolTipBox that units of unitTypeId UnitCode have objectCode inside array. This is needed for BuiltMenu, LearnMenu & Selling/Training.
    array should be one of the TasTooltipBox dataSets:
        TasToolTipBox.DataBuilt
        TasToolTipBox.DataLearn
        TasToolTipBox.DataDefault
    unitCode is the unitTypeId of the unit using this data.
    objectCode is one RawCode in a string or a number 'Hpal'.
    uses x/y coords of objectCode, therefore with colisions you get unwanted results

  function TasToolTipBox.AddDataBatch(array, unitCode, objectCodeString)
    uses TasToolTipBox.AddData with many rawCodes at once.
        TasToolTipBox.AddDataBatch(TasToolTipBox.DataBuilt, 'hpea', "htow,hhou,hbar,hbla,hwtw,halt,harm,hars,hlum,hgra,hvlt")
        TasToolTipBox.AddDataBatch(TasToolTipBox.DataDefault, 'htow', "hpea,Rhpm,hkee")
    to get this string open the unit in object editor navigate to the field hold shift press enter which opens the field in text input, copy paste it.

   function TasToolTipBox.SetObjectSlot(objectCode, slotIndex, text, icon)
      objectCode can be an item
      SlotIndex shows Text & Icon when ObjectCode is hovered.
      SlotIndex is -InTooltipInfoCount to InfoCount, 0 is not used.
      0 to InfoCount - 1 are in the custom UI
      -SlotIndex are next to the normal resource costs.
      ObjectCode is the rawCode of an ObjectEditor object.
      This only works for data added with TasToolTipBox.AddData/TasToolTipBox.AddDataBatch.
      This should be called outside of the action call backs like at map init or 0s.
      example: TasToolTipBox.SetObjectSlot('hpea', 3, "120", "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")
      When a command button is hovered that holds Human worker in  DataBuilt DataLearn or DataDefault. Then it slot 3 will diplsay 120 and the Aura Icon
      text & icon can be string or table. As table it reads either table[item] or table[GetItemUserData(item)], depends on the setup ArrayUseUserData

    function TasToolTipBox.ClearObjectSlot(objectCode)
        clear data stored at objectCode placed over TasToolTipBox.SetObjectSlot
        you could do this when an item is destroyed/removed

    function TasToolTipBox.SetUnitData(unit, buttonIndex, slotIndex, text, icon)
       sets custom wanted data for an unit for that buttonIndex.
       buttonIndex is 0 to 11 for command buttonIndexes.
       buttonIndex can be a spellCode like 'AHbz' then the buttonIndex is calced from the data.
       slotIndex like TasToolTipBox.SetObjectSlot
       text & icon can be string or table. As table it reads table[unit] or table[GetUnitUserData(unit)], depends on the setup ArrayUseUserData
       

    function TasToolTipBox.ClearUnitData(unit[, buttonIndex])
        removes data of unit without buttonIndex all is removed
        This is automaticly used for not heroes when they die.

  works incorrect when multiple skills use 1 slot in the command card
  works incorrect in group selection
  works incorrect with spellbooks

  requires BlzGetAbilityId for skills with more than 1 level (not Warcraft V1.31.1)
  requires HoverOriginButton
]]
do
    TasToolTipBox = {
--config start
        TocPath = "war3mapImported\\TasToolTipBox.toc"
        ,AutoRun = true --(true) will create Itself at 0s, (false) you need to TasToolTipBox.Init()
        ,ArrayUseUserData = true -- when an array/table is provided as text/icon (true) it reads text[GetUnitUserData(unit)] (false ) read text[unit]
        ,ParentFunc = function() return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) end -- should not be simple, called when TasToolTipBox is created the returned frame is used as parent
        ,Hide0Text = true -- hide a Slot when the displayed Text would be 0/0s/0.0s
        ,InfoCount = 5 -- how many Infos you want, every 4 are one row
        ,InTooltipInfoCount = 3 -- how many additional slots next to the default ResourceCost slots
        ,FixedPos = false -- true default tooltip pos does not change when TasToolTipBox is not shown
        ,ExcludSlots = {[7] = true} -- the buttonIndexes set, are not used in the auto ability detection -> this.ActionSpell; [7] = true -> ignore command button 7, 0 is the Top Left button 11 the bottom right
        ,Icon = { -- filePaths used for the icons, Indexes should fit the data used in this.ActionXxxx functions
            "replaceabletextures/passivebuttons/pasbtntrueshot"
            ,"ui/widgets/battlenet/bnet-tournament-clock"
            ,"replaceabletextures/commandbuttons/btnload"
            ,"replaceabletextures/selection/spellareaofeffect_undead"
            ,"replaceabletextures/commandbuttons/btnreplay-speedup"
            ,"UI/Widgets/ToolTips/Human/ToolTipManaIcon"
        }
        ,FilterItemSkills = true -- true items are never in the command card in your map
        ,EnableSubMenu = true -- true creates events/timer; changing it after the Init run is not supported/recommented.        
        ,YPos = 0.17

        ,NoFDF = false -- only affects InTooltipInfoCount, true dont need the fdf. should also change InfoCount to 0.

        --
        -- manual stored data Display Actions
        --
        ---@param buttonIndex integer active commandButton Index
        ---@param data type manual stored Data at buttonIndex for Learning
        ---@param unit unit active unit
        ---@param unitCode integer of unit
        ---@return boolean use/show the custom UI
        ,ActionSubMenuHero = function(buttonIndex, data, unit, unitCode)
            -- requires EnableSubMenu
            -- inside hero skill menu
            --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
            TasToolTipBox.ShowObjectSlot(data) -- Show Content for TasToolTipBox.SetObjectSlot

            return true
        end
        ,ActionSubMenuBuilt = function(buttonIndex, data, unit, unitCode)
            -- requires EnableSubMenu
            -- inside built menu
            --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
            TasToolTipBox.ShowObjectSlot(data) -- Show Content for TasToolTipBox.SetObjectSlot
            return true
        end
        ,ActionDefaultData = function(buttonIndex, data, unit, unitCode)
            -- mostly meant for shops/trainers
            --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
            TasToolTipBox.ShowObjectSlot(data) -- Show Content for TasToolTipBox.SetObjectSlot
            TasToolTipBox.ShowUnitData(unit, buttonIndex)
            return true
        end

        --
        -- autoDetect Actions
        --
        ---@param buttonIndex integer active commandButton Index
        ---@param abi ability ability that uses the button
        ---@param abiCode integer rawCode of abi requires BlzGetAbilityId
        ---@param unit unit active unit
        ---@param unitCode integer of unit
        ---@param level integer abi index for abilityInstance api requires BlzGetAbilityId
        ---@return boolean use/show the custom UI
        ,ActionSpell = function(buttonIndex, abi, unit, abiCode, level, unitCode)
            -- displayed data in autoDetect ability
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED))
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)).."s")
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level)))
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level)))
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level).."s")
            TasToolTipBox.ShowObjectSlot(abiCode) -- Show Content for TasToolTipBox.SetObjectSlot
            TasToolTipBox.ShowUnitData(unit, buttonIndex)
            --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level))    
            return true
        end
        ,ActionItemSpell = function(buttonIndex, abi, unit, abiCode, level, unitCode, item)
            -- displayed data autoDetect inventoryButton-ability
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED))
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)).."s")
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level)))
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level)))
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level).."s")
            TasToolTipBox.ShowObjectSlot(abiCode) -- Show Content for TasToolTipBox.SetObjectSlot
            TasToolTipBox.ShowObjectSlot(item)
            --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level))
            return true
        end
-- config ende
JASS:
library TasToolTipBox initializer init_function requires HoverOriginButton, optional Ascii, optional FrameLoader
/* TasToolTipBox V8c by Tasyen
  An additional Box for a spell in the command card/inventory which displays MissileSpeed, Cooldown, Range & Area values

  changes position of ORIGIN_FRAME_UBERTOOLTIP

  function TasToolTipBox_GetUnitCodeData takes integer unitCode, boolean insert returns integer    
    makes unitCode use an index and return it
    returns 0 when the unitcode was not used and insert == false
    only 32k/12 ~2666 unitCodes can have data in this system
    GetObjectSlotCode

  function TasToolTipBox_AddData takes gameevent dataType, integer unitCode, integer objectCode returns nothing
    Tell the TasToolTipBox that units of unitTypeId UnitCode have objectCode inside dataType. This is needed for BuiltMenu, LearnMenu & Selling/Training.
    supproted dataType are:
        EVENT_GAME_BUILD_SUBMENU
        EVENT_GAME_SHOW_SKILL
        null
    unitCode is the unitTypeId of the unit using this data.
    objectCode is one RawCode in a string or a number 'Hpal'.
    uses x/y coords of objectCode, therefore with colisions you get unwanted results

  function TasToolTipBox_AddDataBatch  takes gameevent dataType, integer unitCode, string objectCodeString returns nothing
    uses AddData with many rawCodes at once.
    requires Ascii
    call TasToolTipBox_AddDataBatch(EVENT_GAME_BUILD_SUBMENU, 'hpea', "htow,hhou,hbar,hbla,hwtw,halt,harm,hars,hlum,hgra,hvlt")
    call TasToolTipBox_AddDataBatch(EVENT_GAME_SHOW_SKILL, 'Hpal', "AHhb,AHds,AHre,AHad")
    call TasToolTipBox_AddDataBatch(null, 'ngme', "stwp,bspd,dust,tret,prvt,cnob,stel,pnvl,shea,spro,pinv")
    
   function TasToolTipBox_GetObjectSlotCode takes integer objectCode, boolean insert returns integer    
    makes objectCode use an index and return it
    returns 0 when the objectCode was not used and insert == false
    only 32k/InfoCount objectCode can have data in this system.
    
  function TasToolTipBox_SetObjectSlot takes integer objectCode, integer slotIndex, string text, string icon returns nothing
      SlotIndex shows Text & Icon when ObjectCode is hovered.
      SlotIndex is -InTooltipInfoCount to InfoCount
      0 to InfoCount - 1 are in the custom UI
      -SlotIndex are next to the normal resource costs.
      ObjectCode is the rawCode of an ObjectEditor object.
      This only works for data added with TasToolTipBox_AddData/TasToolTipBox_AddDataBatch.
      This should be called outside of the action call backs like at map init or 0s.
      example: TasToolTipBox_SetObjectSlot('hpea', 3, "120", "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")
      When a command button is hovered that holds Human worker in  DataBuilt DataLearn or DataDefault. Then it slot 3 will diplsay 120 and the Aura Icon

    function TasToolTipBox_SetWidgetSlot takes widget u, integer buttonIndex, integer slotIndex, string text, string icon returns nothing
       sets custom wanted data for an unit or item for that buttonIndex.
       buttonIndex is 0 to 11 for command buttonIndexes.
       buttonIndex can be a spellCode like 'AHbz' then the buttonIndex is calced from the data.
       slotIndex like TasToolTipBox_SetObjectSlot
       for items always use buttonIndex 0
       the first use of this will use a hashtable

    function TasToolTipBox_RemoveSlot takes widget u returns nothing
        removes all SetWidgetSlot of u, u should be an item or unit
    function TasToolTipBox_RemoveWidgetSlot takes widget u, integer buttonIndex, integer slotIndex returns nothing
        removes one data entry SetWidgetSlot of u, u should be an item or unit

  works incorrect when multiple skills use 1 slot in the command card
  works incorrect in group selection
  works incorrect with spellbooks

  requires BlzGetAbilityId for skills with more than 1 level (not Warcraft V1.31.1)
*/
globals
    constant boolean REFORGED = false // have BlzGetAbilityId? otherwise false
    public string TocPath = "war3mapImported\\TasToolTipBox.toc"
    public boolean AutoRun = true //(true) will create Itself at 0s, (false) you need to TasToolTipBox_Init()
    public boolean FixedPos = false // true default tooltip pos is the same even no TasToolTipBox is shown
    public boolean Hide0Text = true // hide a Slot when the displayed Text would be 0/0s/0.0s
    public boolean FilterItemSkills = true  // true itemspells are never in the command card in your map
    public boolean EnableSubMenu = true  // creates events/timer; changing it after the Init run is not supported/recommented.
    public integer InfoCount = 5 // how many Infos you want, every 4 are one row
    public integer InTooltipInfoCount = 3 //  how many additional slots next to the default ResourceCost slots
    public real YPos = 0.17

    public boolean NoFDF = false // only affects InTooltipInfoCount, true dont need the fdf. should also change InfoCount to 0
    public constant boolean SpeedUpHash = true // true makes it faster hopeful, stores hashes for TasToolTipBox_SetWidgetSlot

// system variables
    public real SizeX
    public real SizeY
    public boolean array ExcludSlots // the buttonIndexes set, are not used in the auto ability detection
    public string array Icon // filePaths used, indexes should fit the data used in ActionXxxx functions
    public unit array SelectedUnit // current Selected


    public integer array DataUnitCode // the unitcodes with Data
    public integer array DataBuilt // DataUnitCode*12
    public integer array DataLearn // DataUnitCode*12
    public integer array DataDefault // DataUnitCode*12

    
    public integer array ObjectSlotCode // the unitcodes with ObjectSlotData
    public string array ObjectSlotIcon // ObjectSlotCode*InfoCount+InfoCount
    public string array ObjectSlotText // ObjectSlotCode*InfoCount+InfoCount
    public string array ObjectSlotIcon2 // ObjectSlotCode*InTooltipInfoCount+InTooltipInfoCount
    public string array ObjectSlotText2 // ObjectSlotCode*InTooltipInfoCount+InTooltipInfoCount

    public hashtable Hash = null
    public integer array StringHashWidgetText
    public integer array StringHashWidgetIcon

    public integer EventCount = -1
    public integer TimerUnit = -1
    public integer LastAction = -1
    public integer TimerCount = -1
    public boolean TimerCountChanged = false
    public gameevent currentAction = null    
endglobals

// ==========
// Config functions
// ==========

public function ParentFunc takes nothing returns framehandle // should not be simple, called when TasToolTipBox is created the returned frame is used as parent
    return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)
endfunction
public function InitUserData takes nothing returns nothing
    // filePaths used for the icons, Indexes should fit the data used in ActionXxxx functions
    set Icon[1] = "replaceabletextures/passivebuttons/pasbtntrueshot"
    set Icon[2] = "ui/widgets/battlenet/bnet-tournament-clock"
    set Icon[3] = "replaceabletextures/commandbuttons/btnload"
    set Icon[4] = "replaceabletextures/selection/spellareaofeffect_undead"
    set Icon[5] = "replaceabletextures/commandbuttons/btnreplay-speedup"
    set Icon[6] = "UI/Widgets/ToolTips/Human/ToolTipManaIcon"

    set ExcludSlots[7] = true // the buttonIndexes set, are not used in the auto ability detection -> ActionSpell; [7] = true -> ignore command button 7, 0 is the Top Left button 11 the bottom right
endfunction



public function ActionSubMenuHero takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
        // requires EnableSubMenu
        // what to display inside hero skill menu        
        //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
endfunction
public function ActionSubMenuBuilt takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
        // what to display inside built menu
        //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
endfunction
public function ActionDefaultData takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
        // what to display with manual written data
        //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
endfunction
public function ActionSpell takes integer buttonIndex, ability abi, unit u, integer abiCode, integer level, integer unitCode returns boolean
    // this is the place you can change the displayed data
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), I2S(BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED)))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)))+"s")
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), R2SW(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level),1,1)+"s")
    //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), I2S(BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level)))

    return true
endfunction

public function ActionItemSpell takes integer buttonIndex, ability abi, unit u, integer abiCode, integer level, integer unitCode, item it returns boolean
    // Update displayed Text
    // this is the place you can change the displayed data
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), I2S(BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED)))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)))+"s")
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), R2SW(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level),1,1)+"s")
    //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), I2S(BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level)))
    return true
endfunction

// ==========
// Confg Ende
// ==========


ChangeLog


V8c) use ui scale option
V8b) hide unwanted slots more correct.
V8a) vjass -> V7 SetWidgetSlot
V8 Lua) TasToolTipBox.SetObjectSlot & TasToolTipBox.SetUnitData support an table instead of an text/icon, Bug fix with item display.
V7 Lua) TasToolTipBox.SetObjectSlot supports specific items. specific unit commandbuttonIndex based data
V6b Bug Fix
V6a inventory items & autodetected spells display the spellCodes slotData
V6 slots inside default Tooltip.
V5 can setup Text/Icon for objectCodes.
V4c&d&e&f improved api/setup comments, fixed a bug with Hide0Text
V4a AddBatch - Hero Learn assumes now fill card from top left, Filter -coords
V4

can detect built & Hero Learn sub menu, this does not work 100% in all cases
can manual set data for default, subMenu Built & Hero Learn​
V3 Improved Skill detection (can ignore ItemSkills in the command card detection)
V2

Hide the box in more cases like shops
Can make default Tooltip repos itself when Box is not shown
Works now for Inventory Items​

Tags: Custom UI, Spell Info, Tooltip​
Previews
Contents

TasToolTipBox (Map)

Reviews
Antares
Nice system for displaying additional spell information. Very customizable. Approved
Updated vjass to V3)
Improved Skill detection (can ignore ItemSkills in the command card detection)

Updated Lua to V4)
can detect peon built & Hero Learn sub menu, this does not work 100% in all cases
can manual set data for default, subMenu Built & Hero Learn
need to do it when you want to know stuff inside built or shops .
Manual data overpowers the ability detection.

uploaded map still includes Lua V3 because V4 differs quite from V3.

In the demo map only the 4 melee workers goblin shop and townhall have manual data.
goblin shop has colisions hence it will show wrong infos even when working.



not sure how to do the vjass V4 version with the data setup.

edit: Update both to V4a)
V4a AddBatch - Hero Learn assumes now fill card from top left, AddData Filters -coord abilities

vjass uses now an array and loops it to find the index of an unitcode in the system, but each dataset needs 12 slots. therefore the vjass version only supports upto 32k/12 unitcodes -> ~2.6k
 
Last edited:
Lua:
--[[
function TasToolTipBox.AddData(array, unitCode, objectCode)
    make unitCode use inside array objectCode as manual data
    uses x/y coords of objectCode, therefore with colisions you get unwanted results
]]
This is quite confusing. What is array and what are the possible options? You need to list them.
"make unitCode use inside array objectCode as manual data" Please try to rephrase that sentence.

The frames for ability tooltips are working well. For the build tooltips, the names in the tooltip box seem to get clipped on many of them. I also don't quite understand the intent here. Is this working as intended? What is the use of listing the name of the object again?

For the TasToolTipBox table, you should separate configurables from non-configurables. I don't know what to with ExcludSlots = {[7] = true}, so I don't want to touch it. Same for EventCount, TimerUnit, LastAction, and TimerCount. Separate these visually from the configurables.

I noticed that when I turned off Hide0Text, the ability tooltips remained displayed when I hovered over a build button from one of the workers. Also, a small comment about what this does would be appreciated. It took me some time to get what it does.

For the Icon table, you could do a dictionary with "range", "cooldown" etc. keys or put a comment behind it which index is pointing to which info.

It would be great if the order of the items could be customized. As far as I understand it, if you want cast time displayed, you need to display all other values and you can't pick and choose. Shrinking down the tooltip box and removing holes when some of the items aren't being displayed could be a nice option for the config.

A nice system that enables the display of spell information automatically and with just a few clicks, but there appear to be a few bugs and some features are not explained well.

Awaiting Update
 
Updated to 4c added some comments to the api and setup.

I have to tell that this system is a port from my map and the whole submenu stuff is not part of the design goal for my map. They were added as Afterthought because for a general system they are likely needed.
This is quite confusing. What is array and what are the possible options? You need to list them.
"make unitCode use inside array objectCode as manual data" Please try to rephrase that sentence.
yes, bad explained will add more info. I think one should use the batch version below which has examples. In reality one copy pastes the sold Items/Units Learn field from object Editor.

The frames for ability tooltips are working well. For the build tooltips, the names in the tooltip box seem to get clipped on many of them. I also don't quite understand the intent here. Is this working as intended? What is the use of listing the name of the object again?
The names are an example and proof of concept that it also works in built menu. The text is clipped because each Icon slot only displays a limited amount of space on screen (~0.06 x-screen space) This Size limits is caused by the Size of "TasTooltipBoxInfo" which is 0.06/0.015 from fdf. one could change that in map script but I did not implement that.


For the Icon table, you could do a dictionary with "range", "cooldown" etc. keys or put a comment behind it which index is pointing to which info.
The idea is that this indexes match the indexes one uses when one writes onto the text frames inside the this.Action functions, and as user of this System one can change the action functions. With keys, i would suggest a meaning which i dont want to do.

It would be great if the order of the items could be customized. As far as I understand it, if you want cast time displayed, you need to display all other values and you can't pick and choose. Shrinking down the tooltip box and removing holes when some of the items aren't being displayed could be a nice option for the config.
One can customize the icons and the order. Thats what the this.Action functions are about one sets the displayed texts one could set the icon textures but I dont.
I prefere when the positions are static. Then the position itself has a meaning by itself and one does not need to interpret the icon. When one packs and reorganizes them one needs to learn for each ability what Slot 1, 2, ... mean. While with fixed slot indexes, the first is always MissileSpeed.
 
Right, it's slowly coming together for me. I think I get now what's going on with most of the options. Listen, you have a --config start and a -- config end and then there is more config stuff below it.

You could put the functions directly into the table definition, like:
Lua:
--[...]
        ,FilterItemSkills = true -- true items are never in the command card in your map
        ,EnableSubMenu = true -- true creates events/timer; changing it after the Init run is not supported/recommented.        
        ,YPos = 0.17

        ,ActionSubMenuHero = function(buttonIndex, data, unit, unitCode)
            -- requires EnableSubMenu
            -- what to display inside hero skill menu        
            BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
            return true
        end,

        --[...]

and then have all the non-configurable parts after local this = TasToolTipBox line.

On the ExcludSlots line, maybe mention that 0 is the bottom-left button.

"unitCode will use inside array, objectCode as manual data."

I still don't understand that sentence. It would really help if you used an AI to proof-read your descriptions.

In the this.Action functions, type annotations would help with making it clearer what each parameter means. I assume data is the type id? I'm unfamiliar with the GetObjectName function. Does it work with unit ids, ability ids etc.?

I know I could figure this out by digging into your code, but I'm giving you the average user experience of someone as dense as me.

What about the fact that the "Blacksmith", "Town Hall" field is hidden when you hover over the build buttons when you have Hide0Text disabled. Is that a bug?
 
Updated Lua to 4d)
moved the action functions into the config
added Emmy Annotation for the action functions
mentions that buttonIndex 0 is topLeft and 11 bottomRight, i think that is overkill as that is just command card coords.
reworded TasToolTipBox.AddData

What about the fact that the "Blacksmith", "Town Hall" field is hidden when you hover over the build buttons when you have Hide0Text disabled. Is that a bug?
The hover system does not work for disabled command buttons. Normal Gold/Mana costs are not displayed for such aswell.
 
mentions that buttonIndex 0 is topLeft and 11 bottomRight, i think that is overkill as that is just command card coords.
It's still worth clarifying because some people do not know that by heart or the index could start at 1 in your system because of Lua's 1-based indexing.

The hover system does not work for disabled command buttons. Normal Gold/Mana costs are not displayed for such aswell.
That's not what I'm refering to. Here is the tooltip for Town Hall with and without "Hide0Text" flag enabled.

The first info is no longer visible.
 

Attachments

  • disabled.png
    disabled.png
    1.2 MB · Views: 27
error.png
Please use the full type names or put an ---@alias somewhere in your script.

If the unitCode/abiCode variables are integers, unitId/abiId would be better, less confusing variable names. These are the names that Blizzard uses for their functions.

There is a small bug with the frame position when FixedPos = false. When you hover over one with a TasTooltipBox and move the mouse over one without a box, if you do it really fast, it doesn't adjust the position. When you do it slower, it does. Not a big deal, but maybe you can fix that.

For the vJASS version, please also make sure that the config is clearly delimited from the rest.

Other than that, looking good.
 
Level 37
Joined
Aug 6, 2015
Messages
786
Can i please ask for a small change that would allow the system to easily do the next thing.
Give any value+icon for various object descriptions. (would be very useful imo)

In my case - I want to make special upgrades in a forge that would require a custom resource, and I want to show that custom resource in the box) - it is just i cannot do that easily - and I can see the potential in this system to allow me to do such thing
Ex12.png
 
Last edited:
The framework to do this was already mostly done, one still would need to use frame setText/Texture to do it.
In the Lua version one would register the tech/item/unit whatever that is with:
TasToolTipBox.AddData or TasToolTipBox.AddDataBatch

then inside the function ActionDefaultData one checks if data is equal to your custom object and uses BlzFrameSetText & BlzFrameSetTexture to do it

I could add a system to handle that for wanted data the custom slots displays wanted text + Icon, so that when the hovered data for example is Scroll of Speed it would give slot 1 text and wanted icon.
The setup probably would look something like this in the Lua version
Code:
SetDataDisplay('Hpal', {
[1] = {"200". iconPath}
[4] = {"100", iconPath2 }
})
 
Level 37
Joined
Aug 6, 2015
Messages
786
The framework to do this was already mostly done, one still would need to use frame setText/Texture to do it.
In the Lua version one would register the tech/item/unit whatever that is with:
TasToolTipBox.AddData or TasToolTipBox.AddDataBatch

then inside the function ActionDefaultData one checks if data is equal to your custom object and uses BlzFrameSetText & BlzFrameSetTexture to do it

I could add a system to handle that for wanted data, so that when the hovered data for example is Scroll of Speed it would give slot 1 text and wanted icon.
The setup probably would look something like this in the Lua version
Code:
SetDataDisplay('Hpal', {
[1] = {"200". iconPath}
[4] = {"100", iconPath2 }
})
I would greatly appreciate it, would a jass version be possible in this case too?
 
Updated to V5)
One can now setup Text & Icon that is displayed in a wanted slot for an wanted object Editor object. Which is displayed when hovered and the Object Editor was added with AddData function.
Works only when Data of Learn, Built and Default is used and setuped for the current unit.

call TasToolTipBox_SetObjectSlot('hpea', 3, "120", "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")

TasToolTipBox.SetObjectDisplay('hpea', 3, "120", "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")

vjass can only hold data for 32k/InfoCount objectCodes and the slot starts with 0.
Lua slotdata starts with Index 1.

in vjass this feature is called from within the system function. While in Lua this feature is called from the callbacks.
 
Level 37
Joined
Aug 6, 2015
Messages
786
Updated to V5)
One can now setup Text & Icon that is displayed in a wanted slot for an wanted object Editor object. Which is displayed when hovered and the Object Editor was added with AddData function.
Works only when Data of Learn, Built and Default is used and setuped for the current unit.

call TasToolTipBox_SetObjectSlot('hpea', 3, "120", "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")

TasToolTipBox.SetObjectDisplay('hpea', 3, "120", "ReplaceableTextures/CommandButtons/BTNBrilliance.tga")

vjass can only hold data for 32k/InfoCount objectCodes and the slot starts with 0.
Lua slotdata starts with Index 1.

in vjass this feature is called from within the system function. While in Lua this feature is called from the callbacks.
Thank you for the update

I have added 200 prestige cost to research , however i have another text - can you explain why it appears? And how can is safely remove it.

Regarding the unit cost - is it possible to add some sort of option like a boolean to check for MimicCost, if MimicCost = True
make the icon + cost to move to coordinates after the base cost in the default tooltip and the bottom tooltip border will not be shown (MimicCost would be set for each object separately)

Screenshot_21.png
 
Last edited:
the text comes from the callbacks inside
public function ActionSubMenuHero
public function ActionSubMenuBuilt
public function ActionDefaultData

this line does it , remove it.
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))

It was not my goal to add the Slots into the default Tooltip. I can try to make that, it will take some time and from my view this would be limited to 3 slots.
 
Level 37
Joined
Aug 6, 2015
Messages
786
the text comes from the callbacks inside
public function ActionSubMenuHero
public function ActionSubMenuBuilt
public function ActionDefaultData

this line does it , remove it.
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))

It was not my goal to add the Slots into the default Tooltip. I can try to make that, it will take some time and from my view this would be limited to 3 slots.
3 slots are good enough, making such implementations would be amazing!!

I tried to remove it , but then a empty row is till maintained instead of it.
 
Updated to V6)
new Feature: Slots inside the default UI in the same row as the resource costs tooltip, works without fdf when wanted.
^^ is setuped with function SetObjectSlot when one uses a -slotIndex.
The amount of slots in the default tooltip is setuped with InTooltipInfoCount, default 3. I think more wont fit.
in vjass this value limits the amount of objects that can use this to 32k/InTooltipInfoCount.
NoFDF = true. Without fdf the custom box wont work so also set InfoCount to 0 probably.
Pic2 Tooltip Slots.jpg
 
Level 37
Joined
Aug 6, 2015
Messages
786
Updated to V6)
new Feature: Slots inside the default UI in the same row as the resource costs tooltip, works without fdf when wanted.
^^ is setuped with function SetObjectSlot when one uses a -slotIndex.
The amount of slots in the default tooltip is setuped with InTooltipInfoCount, default 3. I think more wont fit.
in vjass this value limits the amount of objects that can use this to 32k/InTooltipInfoCount.
NoFDF = true. Without fdf the custom box wont work so also set InfoCount to 0 probably.
View attachment 493136
Looks very nice and opens a lot of possibilities for the visibility clearance of custom mechanics
Screenshot_19.png

Screenshot_11.png


tenor (1).gif
 
Level 37
Joined
Aug 6, 2015
Messages
786
Updated to V6)
new Feature: Slots inside the default UI in the same row as the resource costs tooltip, works without fdf when wanted.
^^ is setuped with function SetObjectSlot when one uses a -slotIndex.
The amount of slots in the default tooltip is setuped with InTooltipInfoCount, default 3. I think more wont fit.
in vjass this value limits the amount of objects that can use this to 32k/InTooltipInfoCount.
NoFDF = true. Without fdf the custom box wont work so also set InfoCount to 0 probably.
View attachment 493136
Can I ask for some additional features if possible?
  • Option to set text to -4/-5 (will be useful to not have empty spaces for objects that do not have all three costs of gold/lumber/food)
  • Option to tie tooltips to specific units

Screenshot_32.png



Also , i am not sure - either i did something wrong or it is not supported by the system, I cannot set a custom value for an item.
Screenshot_21.pngScreenshot_19.png
Screenshot_23.png

Screenshot_11.png
 
Last edited:
Option to tie tooltips to specific units
dont really want to, call SetObjectSlot in GetLocalPlayer block.

Also , i am not sure - either i did something wrong or it is not supported by the system, I cannot set a custom value for an item.
oh, i did not add this feature to items in inventory (only inside shop), nor auto detected spells. easy to do need to insert 1 line for each.
fine, I add the inventory thing and the autodetect spell
But i wonder, does one want to display the same thing in inventory as one wants in shop.
Edit: I guess item & spell should display the spellCode. for item the active ability

Edit: Updated to V6a)
inventory items and autodetected spells can display SetObjectSlot data of the spellCode. They only do in Reforged and in vjass when REFORGED = true
 
Last edited:
Level 37
Joined
Aug 6, 2015
Messages
786
dont really want to, call SetObjectSlot in GetLocalPlayer block.
:sad:
oh, i did not add this feature to items in inventory (only inside shop), nor auto detected spells. easy to do need to insert 1 line for each.
Would be nice to have it in inventory too.
fine, I add the inventory thing and the autodetect spell
:thumbs_up:
But i wonder, does one want to display the same thing in inventory as one wants in shop.
Dividing them would allow for more flexibility imo.
 
Level 37
Joined
Aug 6, 2015
Messages
786
So there is a small bug.

In the screen below, I have two units that can be trained in one building.
Only the footman is added to have 100 cost.
But if you hover fast between units, the cost will also be shown for the Peasant.
Sometimes the icon will disspear, sometimes not.
JASS:
library TasToolTipBoxUserInit initializer init_function requires TasToolTipBox, Ascii
    public function init_function takes nothing returns nothing
    
call TasToolTipBox_AddDataBatch(null, 'htow', "h000")
call TasToolTipBox_SetObjectSlot('h000', -3, "100", "RenownIco2.tga")

    endfunction
endlibrary

Screenshot_27.png
Screenshot_5.png
 
Updated to V6b)
Fixed that data/slots of previous hovered was shown.



Option to set text to -4/-5 (will be useful to not have empty spaces for objects that do not have all three costs of gold/lumber/food)
you can increase a global setup Variable, then you can use index -4/-5.
public integer InTooltipInfoCount = 3 // how many additional slots next to the default ResourceCost slots

But maybe you mean something different, than what I think you mean.

Option to tie tooltips to specific units
I dont wanted to do this because then I need to clear up data.
Okay, i will work on it.
Edit: I could split an array in an 3d, unit - commandButtonIndex - slotIndex setup in vjass. Would be limted to 32k/(12*SlotCount (default 11)) ~ 242 units.
 
Last edited:
Level 37
Joined
Aug 6, 2015
Messages
786
Updated to V6b)
Fixed that data/slots of previous hovered was shown.




you can increase a global setup Variable, then you can use index -4/-5.
public integer InTooltipInfoCount = 3 // how many additional slots next to the default ResourceCost slots

But maybe you mean something different, than what I think you mean.


I dont wanted to do this because then I need to clear up data.
Okay, i will work on it.
Edit: I could split an array in an 3d, unit - commandButtonIndex - slotIndex setup in vjass. Would be limted to 32k/(12*SlotCount (default 11)) ~ 242 units.
Thanks for the update, I am not sure how would the specific object work but wouldn't 24 be enough? (One for each player)(Since we don't need to save data, because we can modify it at any point, we can just show it when we need it, so when a player hovers above s specific object , just call some sort of a func that only shows the tooltip we define right at that moment, and if players stops hovering, just clear the tooltip slot.
 
Updated Lua version to V7)
TasToolTipBox.SetObjectSlot supports specific items. use an item instead of objectCode.
can use TasToolTipBox.ClearObjectSlot(item) to remove stored item data when it is removed when one wants.

modified ActionItemSpell to support this above

can setup data/slots for specific units commandbuttonIndex based

TasToolTipBox.SetUnitData(unit, buttonIndex, slotIndex, text, icon)
TasToolTipBox.ClearUnitData(unit[, buttonIndex])
auto used on none hero death

modified ActionDefaultData & ActionSpell



vjass version 7 will be some other day.

Thanks for the update, I am not sure how would the specific object work but wouldn't 24 be enough? (One for each player)(Since we don't need to save data, because we can modify it at any point, we can just show it when we need it, so when a player hovers above s specific object , just call some sort of a func that only shows the tooltip we define right at that moment, and if players stops hovering, just clear the tooltip slot.
Thanks for your suggestion.
One could do this, would mean you have to update it on every selection or check current unit selection. I'd prefere some other approach.
 
Level 37
Joined
Aug 6, 2015
Messages
786
Thanks for your suggestion.
One could do this, would mean you have to update it on every selection or check current unit selection. I'd prefere some other approach.
If it's not affecting the game performance a lot, could still make it this way.

Something like this. (maybe with a help of a unit indexer if needed to improve it)
  • ObjectEx
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set SelectedUnit = (Triggering unit)
      • -------- Footman --------
      • -------- A tooltip will be created for a specific Footman , for his ability 'Defend' that states that defend costs 25 stamina. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SelectedUnit Equal to Footman 0072 <gen>
        • Then - Actions
          • -------- Defend Ability --------
          • Set TooltipObject = 'Adef'
          • -------- Stamina --------
          • Set ResourceSlot = 1
          • Set ResourceIcon = ReplaceableTextures\CommandButtons\BTNBloodDrop.blp
          • Set ResourceDescr = 25 stamina
          • -------- CallTheFunc --------
          • Custom script: Custom script: call TasToolTipBox_SetObjectSlot(udg_SelectedUnit, udg_TooltipObject, udg_ResourceSlot, udg_ResourceDescr, udg_ResourceIcon)
        • Else - Actions
      • -------- Paladin --------
      • -------- A tooltip will be created for a specific Paladin, for his ability 'Heal' that states that heal costs 25 stamina and 15 faith. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SelectedUnit Equal to Paladin 0068 <gen>
        • Then - Actions
          • -------- Heal Ability --------
          • Set TooltipObject = 'AHhb'
          • -------- Stamina --------
          • Set ResourceSlot = 1
          • Set ResourceIcon = ReplaceableTextures\CommandButtons\BTNBloodDrop.blp
          • Set ResourceDescr = 25 stamina
          • Custom script: Custom script: call TasToolTipBox_SetObjectSlot(udg_SelectedUnit, udg_TooltipObject, udg_ResourceSlot, udg_ResourceDescr, udg_ResourceIcon)
          • -------- Faith --------
          • Set ResourceSlot = 2
          • Set ResourceIcon = ReplaceableTextures\CommandButtons\BTNMagicLariet.blp
          • Set ResourceDescr = 15 faith
          • Custom script: Custom script: call TasToolTipBox_SetObjectSlot(udg_SelectedUnit, udg_TooltipObject, udg_ResourceSlot, udg_ResourceDescr, udg_ResourceIcon)
          • -------- CallTheFunc --------
        • Else - Actions
 
Last edited:
Updated Lua version to V8)
fixed: Item buttons did show slots of previous hovered after switching fast between 2 inventory item buttons.

new setup ArrayUseUserData = true & upgrade for
function TasToolTipBox.SetObjectSlot(objectCode, slotIndex, text, icon)
text & icon can be string or table. As table it reads either table[item] or table[GetItemUserData(item)], depends on the setup ArrayUseUserData

function TasToolTipBox.SetUnitData(unit, buttonIndex, slotIndex, text, icon)
text & icon can be string or table. As table it reads table[unit] or table[GetUnitUserData(unit)], depends on the setup ArrayUseUserData

Using an array will auto update the value when it is changed as it reads that array every time it displays it.
Like in this gui example. At 0s for an unit and item an GUI array is used as text and Icon. Then when pressing ESC Key the values are changed and the Text & Icon will update.
  • At 0s V8Unitdata Lua
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 5555.00 seconds the text: Press ESC to change...
      • Set Unit = Blutmagier 0001 <gen>
      • -------- Custom Unit Value should do your unit indexer. --------
      • Unit - Set the custom value of Unit to 3
      • -------- Write entries for the unit Index --------
      • Set Icons[(Custom value of Unit)] = ReplaceableTextures\CommandButtons\BTNHeroArchMage.blp
      • Set Texts[(Custom value of Unit)] = 2221
      • -------- use the array variable that will always display the current value of unit inside the array --------
      • Custom script: TasToolTipBox.SetUnitData(udg_Unit, 8, -1, udg_Texts, udg_Icons)
      • Set Item = Schamanen-Totem 0072 <gen>
      • Item - Set the custom value of Item to 5
      • Set Icons[(Custom value of Item)] = ReplaceableTextures\CommandButtons\BTNGrunt.blp
      • Set Texts[(Custom value of Item)] = 1
      • Custom script: TasToolTipBox.SetObjectSlot(udg_Item, -2, udg_Texts, udg_Icons)
  • ESC V8Unitdata Lua
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set Unit = Blutmagier 0001 <gen>
      • Set Texts[(Custom value of Unit)] = 33
      • Set Item = Schamanen-Totem 0072 <gen>
      • Set Icons[(Custom value of Item)] = ReplaceableTextures\CommandButtons\BTNGuldan.blp
      • Set Texts[(Custom value of Item)] = 1+
 
Last edited:
Level 37
Joined
Aug 6, 2015
Messages
786
  • At 0s V8Unitdata Lua
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 5555.00 seconds the text: Press ESC to change...
      • Set Unit = Blutmagier 0001 <gen>
      • -------- Custom Unit Value should do your unit indexer. --------
      • Unit - Set the custom value of Unit to 3
      • -------- Write entries for the unit Index --------
      • Set Icons[(Custom value of Unit)] = ReplaceableTextures\CommandButtons\BTNHeroArchMage.blp
      • Set Texts[(Custom value of Unit)] = 2221
      • -------- use the array variable that will always display the current value of unit inside the array --------
      • Custom script: TasToolTipBox.SetUnitData(udg_Unit, 8, -1, udg_Texts, udg_Icons)
      • Set Item = Schamanen-Totem 0072 <gen>
      • Item - Set the custom value of Item to 5
      • Set Icons[(Custom value of Item)] = ReplaceableTextures\CommandButtons\BTNGrunt.blp
      • Set Texts[(Custom value of Item)] = 1
      • Custom script: TasToolTipBox.SetObjectSlot(udg_Item, -2, udg_Texts, udg_Icons)
  • ESC V8Unitdata Lua
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set Unit = Blutmagier 0001 <gen>
      • Set Texts[(Custom value of Unit)] = 33
      • Set Item = Schamanen-Totem 0072 <gen>
      • Set Icons[(Custom value of Item)] = ReplaceableTextures\CommandButtons\BTNGuldan.blp
      • Set Texts[(Custom value of Item)] = 1+
  • I am a bit confused by how to assign a tooltip to a specific object in the GUI that is tied to a unit - for example, a specific spell or a trained unit in the barracks.
  • In the map provided example, I didn't understand what stands for the spell ID of the Blood Mage.

  • Would be nice to have a Unit Indexer also added to the map. (after all many systems on hive that make use of it also implement it in their spell/system as a default)
  • And a Jass version too please :peasant-bowing:
 
Last edited:
Updated to V8a)
Which updates vjass version to V7. It can now set data for specific units & items.
JASS:
function TasToolTipBox_SetWidgetSlot takes widget u, integer buttonIndex, integer slotIndex, string text, string icon returns nothing
       sets custom wanted data for an unit or item for that buttonIndex.
       buttonIndex is 0 to 11 for command buttonIndexes.
       buttonIndex can be a spellCode like 'AHbz' then the buttonIndex is calced from the data.
       slotIndex like TasToolTipBox_SetObjectSlot
       for items always use buttonIndex 0
       the first use of this will use a hashtable

    function TasToolTipBox_RemoveSlot takes widget u returns nothing
        removes all SetWidgetSlot of u, u should be an item or unit
    function TasToolTipBox_RemoveWidgetSlot takes widget u, integer buttonIndex, integer slotIndex returns nothing
        removes one data entry SetWidgetSlot of u, u should be an item or unit
 
Level 37
Joined
Aug 6, 2015
Messages
786
Updated to V8a)
Which updates vjass version to V7. It can now set data for specific units & items.
JASS:
function TasToolTipBox_SetWidgetSlot takes widget u, integer buttonIndex, integer slotIndex, string text, string icon returns nothing
       sets custom wanted data for an unit or item for that buttonIndex.
       buttonIndex is 0 to 11 for command buttonIndexes.
       buttonIndex can be a spellCode like 'AHbz' then the buttonIndex is calced from the data.
       slotIndex like TasToolTipBox_SetObjectSlot
       for items always use buttonIndex 0
       the first use of this will use a hashtable

    function TasToolTipBox_RemoveSlot takes widget u returns nothing
        removes all SetWidgetSlot of u, u should be an item or unit
    function TasToolTipBox_RemoveWidgetSlot takes widget u, integer buttonIndex, integer slotIndex returns nothing
        removes one data entry SetWidgetSlot of u, u should be an item or unit
So there is a bug present, when hovering between a unit with assigned value and one without, it will show a green border with 0 value. (also I noticed it is only bugged if moving to specific slots (for example in the image below)

A custom value is assigned to a Footman, if moving to the units with the red arrows it will lead to the bug, if moving to the units with the green arrows there will be no bug shown.
  • Set Unit = Barracks 0000 <gen>
  • Custom script: call TasToolTipBox_SetWidgetSlot(udg_Unit, 6, -2, "60" ,"ReplaceableTextures\\CommandButtons\\BTNHelmutPurple.blp")

Screenshot_52.png
 

Attachments

  • TasToolTipBox V8a.w3x
    45.8 KB · Views: 3
Updated to V8c)
uses ui scale options.


This was done by coping the scale of ("ConsoleUIBackdrop", 0)
JASS:
set scale = BlzFrameGetWidth(BlzGetFrameByName("ConsoleUIBackdrop", 0))/0.8
if scale > 0.1 then
        call BlzFrameSetScale(BlzGetFrameByName("TasTooltipBox", 0), scale) 
        call BlzFrameSetScale(BlzGetFrameByName("TasTooltipBoxInsideParent", 0), scale) 
endif
 
Top