Tooltip - LuaTexts

Sample tooltip

(former CowTip_LuaText)

Allows to configure the content of unit-tooltips with custom Lua-Codes.

It uses a modified version of PitBull4's LuaText-ScriptEnv.
Some functions were removed.
Some new were added.
Some were modified to better suite for tooltips.

If Cowtip is installed it automatically disables cowtips built-in dogtag-based text-module.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of profalbert profalbert Sep 02, 2010 at 20:07 UTC - 0 likes

    Name(...) always returns some string. If it would return nil it would break texts.

    You can check for an empty string easy:

    local name = Name(unit .. "target")
    if name == "" then
      return "NO TARGET"
    else
      return "ELSE"
    end
    
  • Avatar of rakkarage rakkarage Sep 02, 2010 at 19:13 UTC - 0 likes

    the code for target contains "if not name"

    local name = Name(unit .. "target")
    if not name then
      return "NO TARGET"
    else
      return "ELSE"
    end
    

    does not work... [not name] is never true... for myself or npcs standing around dal this check never returns no target? is it intended to be a check if mouseovertarget exists? is it broken (returns space instead of empty string?) or is there another way to check that? i am not 100% sure why unit .. "target" is used sometimes and "mouseovertarget" is used others?

    or actually i guess you need to use strlen to check for empty string?

    local name = Name(unit .. "target")
    if strlen(name) == 0 then
      return ""
    elseif UnitIsUnit("mouseovertarget", "mouseover") then
      return Colorize("> Self!", 255, 255, 255)
    elseif UnitIsUnit("mouseovertarget", "player") then
      return Colorize("> You!", 255, 255, 0)
    elseif UnitIsUnit("mouseovertarget", "pet") then
      return Colorize("> Pet!", 255, 255, 0)
    elseif UnitIsUnit("mouseovertarget", "target") then
      return Colorize("> Same!", 0, 255, 0)
    else
      return Colorize(name, SmartClassColor(unit .. "target"))
    end
    

    seems to work

    Last edited Sep 02, 2010 by rakkarage
  • Avatar of profalbert profalbert Aug 29, 2010 at 23:28 UTC - 0 likes

    All libs should be included in the newest version (a proper Ace3-port)

  • Avatar of rakkarage rakkarage Aug 28, 2010 at 17:36 UTC - 0 likes
    Quote:

    You can use "NameRealm" to show Name and server.

    thanks! when i use NameRealm, the - after name shows for local people in group or raid sometimes even though there is no realm name

    also noticed this:

    Message: Interface\AddOns\CowTip_LuaText\LuaText.lua:4: Cannot find a library instance of "AceTimer-3.0".

    but not being included in cowtip or cowtip_luatext?

    switched to nolib anyway... i guess is better

    thanks a lot for your help and all your great addons and code

    Last edited Aug 30, 2010 by rakkarage
  • Avatar of profalbert profalbert Aug 28, 2010 at 06:48 UTC - 0 likes

    You can use "NameRealm" to show Name and server.

  • Avatar of rakkarage rakkarage Aug 28, 2010 at 00:57 UTC - 0 likes

    NameFull shows server and title
    Name shows neither
    possible to show only server, not title?
    thanks

  • Avatar of rakkarage rakkarage Aug 24, 2010 at 23:26 UTC - 0 likes
    local name = Name(unit .. "target")
    if name and UnitIsUnit("mouseovertarget", "mouseover") then
      return Colorize("> Self!", 255, 255, 255)
    elseif name and UnitIsUnit("mouseovertarget", "player") then
      return Colorize("> You!", 255, 255, 0)
    elseif name and UnitIsUnit("mouseovertarget", "pet") then
      return Colorize("> Pet!", 255, 255, 0)
    elseif name and UnitIsUnit("mouseovertarget", "target") then
      return Colorize("> Same!", 0, 255, 0)
    elseif name then
      return Colorize(name, SmartClassColor(unit .. "target"))
    else
      return ""
    end
    

    with no other addons (cowtip & luatext & libs) loaded i can quickly mouse over the player frame and half the time it shows '> Self!' and half the time it shows my name
    or with pitbull player, target, targettarget shows rakka but targettargettarget shows self instead and all random
    should i be using something other then mouseovertarget?

    thanks a lot

    EDIT: it's just a delay...? i can replicate it every time. when i first mouseover myself i get name for 1 second till something catches up and mouseovertarget = mouseover then >self! shows

    Last edited Aug 30, 2010 by rakkarage
  • Avatar of profalbert profalbert Aug 24, 2010 at 21:23 UTC - 0 likes
    if UnitIsUnit('mouseovertarget', 'target') then
      return "> Same Target!"
    else
      return ""
    end
    

    works for me.

    A non-empty tootlip-line should not return nil.

    Last edited Aug 24, 2010 by profalbert
  • Avatar of rakkarage rakkarage Aug 24, 2010 at 18:58 UTC - 0 likes

    thanks works great!

    does anyone know how can i do this?

    if UnitIsUnit('mouseovertarget', 'target') then
    return '> Same Target!'
    end

    errors when i use 'mouseovertarget' wowwiki says its valid?

    http://www.wowwiki.com/UnitId

    this is my old target text that i am trying to convert. i guess i have to use UnitIsUnit instead of IsUnit but what do i use instead of Target or 'mouseovertarget'?

    [Alpha(0.5)][Outline][(if IsUnit(Target, 'mouseover') then 'Self!':White elseif IsUnit(Target, 'player') then 'You!':Yellow elseif IsUnit(Target, 'target') then 'Your Target!':Green elseif IsUnit(Target, 'pet') then 'Your Pet!':Yellow else Target:Name:HostileColor(unit=Target) end):Prepend('> ')]

    thanks!

    Last edited Aug 24, 2010 by rakkarage
  • Avatar of profalbert profalbert Aug 23, 2010 at 20:49 UTC - 0 likes

    Sorry, could not quite make it out and then forgot tbh. Now I understand you problem: it is that the Talent-line was not really empty when talents are unknown, it contains the formatting-stuff for the icon.

    I modified the default-talent-text, so that it works as you described (I think).

Facts

Date created
Sep 15, 2009
Category
Last update
Sep 12, 2013
Development stage
Release
License
All Rights Reserved
Curse link
Tooltip - LuaTexts
Downloads
17,484
Recent files

Authors