Thread Tools Display Modes
06-19-10, 07:56 PM   #1
linguini
A Fallenroot Satyr
Join Date: Jun 2010
Posts: 20
Cool truncating lua Name(unit) in pitbull4

basically, i want to shorten people's names to only under 10 characters. For example, if the name(unit) is "grandmaster's training dummy," i want it to only show "grandmaste."

im just using a simple script of return '%s',Name(unit)

im sure this is super easy to solve, so thanks in advance!
  Reply With Quote
06-19-10, 09:29 PM   #2
mankeluvsit
An Onyxian Warder
 
mankeluvsit's Avatar
Join Date: Sep 2008
Posts: 354
if you're using pitbull4, it uses dog tags, so.... [Name:Truncate(num)] num is your number, so 10.
  Reply With Quote
06-19-10, 09:50 PM   #3
linguini
A Fallenroot Satyr
Join Date: Jun 2010
Posts: 20
my pitbull 4 isnt using dogtags

Last edited by linguini : 06-19-10 at 09:59 PM.
  Reply With Quote
06-19-10, 10:51 PM   #4
Starinnia
Ninja Code Monkey
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 84
Code:
return string.sub(Name(unit), 1, 10)
  Reply With Quote
06-19-10, 11:00 PM   #5
linguini
A Fallenroot Satyr
Join Date: Jun 2010
Posts: 20
Originally Posted by Starinnia View Post
Code:
return string.sub(Name(unit), 1, 10)
thanks so much
  Reply With Quote
06-20-10, 01:29 AM   #6
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
How do you write that in Stuf? I don't get Stuf's syntax >.>
  Reply With Quote
06-20-10, 01:58 AM   #7
blkdrgn
A Warpwood Thunder Caller
 
blkdrgn's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 91
Originally Posted by Ferous View Post
How do you write that in Stuf? I don't get Stuf's syntax >.>

For stuf its very simple..All you have to do is shorten the width of "text1" or whatever text option your name you wish to shorten is.
just set it to very short, and drag the slider up, I use about 25% of the width of the health bar, that shows most player names, and longer bosses, and npc names are cut off.

Hope that helps.

EDIT. I would like to figure out the code for shortening names with abbreviations though"

death bringer saurfang would be d.b.saurfang..
loot crazed diver would be l.c.diver...and so on..

I was able to do this with shadowed unit frames, however I have moved to stuff and would like to impiment this back if possible.

Last edited by blkdrgn : 06-20-10 at 02:53 AM.
  Reply With Quote
06-20-10, 04:26 PM   #8
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Yeah but it shows "..." At the end. >.>
Originally Posted by blkdrgn View Post
For stuf its very simple..All you have to do is shorten the width of "text1" or whatever text option your name you wish to shorten is.
just set it to very short, and drag the slider up, I use about 25% of the width of the health bar, that shows most player names, and longer bosses, and npc names are cut off.

Hope that helps.

EDIT. I would like to figure out the code for shortening names with abbreviations though"

death bringer saurfang would be d.b.saurfang..
loot crazed diver would be l.c.diver...and so on..

I was able to do this with shadowed unit frames, however I have moved to stuff and would like to impiment this back if possible.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » truncating lua Name(unit) in pitbull4


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off