Removing # from mob names

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

blamstick
orc pawn
orc pawn
Posts: 27
Joined: Sat Sep 06, 2003 6:50 pm

Removing # from mob names

Post by blamstick » Sat Feb 07, 2004 11:29 pm

Wondering if someone can tell me how to remove the # from in front of the named mobs names because I want to do this kind of command -

/g $target(name,clean) is at $target(hp,pct) Health

If it's a named mob it would show up like '#Dread Skeleton is at 50% Health'

Wanted to check if the first character is a # and remove it if it is. I'm just not as saavy with coding as some of you are. thanks.

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Re: Removing # from mob names

Post by Gumby » Sun Feb 08, 2004 10:06 am

blamstick wrote:Wondering if someone can tell me how to remove the # from in front of the named mobs names because I want to do this kind of command -

/g $target(name,clean) is at $target(hp,pct) Health

If it's a named mob it would show up like '#Dread Skeleton is at 50% Health'

Wanted to check if the first character is a # and remove it if it is. I'm just not as saavy with coding as some of you are. thanks.
Heh, what's with all the self flagellation these days?

Skeleton junk, this is a quicky pulled from one of my scripts that should work... overly fancy but cut and paste /shrug.

Code: Select all

/if $left(1,"$target(name,clean)"=="#" {
   /g $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health
} else {
   /g $target(name,clean) is at $target(hp,pct) Health
}
G

blamstick
orc pawn
orc pawn
Posts: 27
Joined: Sat Sep 06, 2003 6:50 pm

Post by blamstick » Mon Feb 09, 2004 7:57 pm

It works great thanks much. Only found one error which I corrected here -
the if statement needed to include a closing parenthesis for the $left statement.

Code: Select all

Sub Main
/if $left(1,"$target(name,clean)")=="#" {
/echo $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health 
}
/return

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Mon Feb 09, 2004 9:59 pm

Heh right you are... and here I was about to ask if Bad Karma tested it prior to tossing it up on the snippets forum :)

Thanks,

G

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Tue Feb 10, 2004 1:16 am

lol

:oops:

I'm still trying to get caught up on the month's worth of backlogged posts I've missed!

I'll go edit it now.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

Zxeses
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 07, 2003 4:17 pm

Post by Zxeses » Tue Feb 10, 2004 10:51 am

How many brain surgeons does it take to change a light bulb?


Did you try

Code: Select all

/g %T is at $target(hp,pct) health
?