Friday, 13 September 2013

World of Warcraft - Macro - Target Announce

This macro will place a skull raid mark on your target and announce your co-ordinates and the health of the target to the general channel.

/stopmacro [dead][noexists]
/run SetRaidTarget("target",0)
/1 {triangle} %t is up {triangle}
/run SetMapToCurrentZone()local x,y=GetPlayerMapPosition("player")s=(format("{triangle}  %.0f,%.0f {triangle} ",x*100,y*100)..((math.floor((UnitHealth("target")/UnitHealthMax("target"))* 100)).." % {triangle}"))SendChatMessage(s,"CHANNEL",nil,1)
/run SetRaidTarget("target",8)

The macro will not announce if you have no target or your target is dead.

If you want to announce to a different channel change the number 1 on line 3 & 6.

You can change the raid target mark from skull to another by changing 8 on line 7.

You can also change the raid icon in chat by replacing triangle on lines 3,4,5 & 6.

World of Warcraft - Macro - Add Rares to NPCscan - Timeless Isle


This macro will add all the Timeless Isle rares' to NPCscan.

You will have to split the following macro up into smaller chunks unless you have a macro addon that will extend your macro limit beyond the 255 WoW limit.


/npcscan add 73158 Gander
/npcscan add 73160 Steelhorn
/npcscan add 73161 Furyshell
/npcscan add 72909 Gu'chi
/npcscan add 72245 Zesqua
/npcscan add 71919 Zhu-Gon
/npcscan add 72193 Karkanos
/npcscan add 72045 Chelon
/npcscan add 71864 Spelurk
/npcscan add 73854 Cranegnasher
/npcscan add 72048 Rattleskew
/npcscan add 72769 Jadefire
/npcscan add 73277 Leafmender
/npcscan add 72775 Bufo
/npcscan add 73282 Garnia
/npcscan add 72808 Tsavo'ka
/npcscan add 73166 Spineclaw
/npcscan add 73163 Python
/npcscan add 73157 Rock Moss
/npcscan add 73170 Osu
/npcscan add 73169 Jakur
/npcscan add 73171 Champion
/npcscan add 73175 Cinderfall
/npcscan add 73173 Urdur
/npcscan add 73172 Flintlord
/npcscan add 73167 Huolon
/npcscan add 72970 Golgannar
/npcscan add 73279 Evermaw
/npcscan add 73281 Vazuvius
/npcscan add 73174 Archiereus
/npcscan add 72032 Zvezdan

World of Warcraft - Macro - Add Rares to NPCscan - Isle of Thunder

This macro will add all the Isle of Thunder rares' to NPCscan.

You will have to split the following macro up into smaller chunks unless you have a macro addon that will extend your macro limit beyond the 255 WoW limit.

/npcscan add 50358 Haywire Sunreaver Construct 
/npcscan add 69664 Mumta
/npcscan add 69996 Ku'lai the Skyclaw
/npcscan add 69998 Goda
/npcscan add 69997 Progenitus
/npcscan add 70000 Al'tabim the All-Seeing
/npcscan add 69999 God-Hulk Ramuk
/npcscan add 70001 Backbreaker Uru
/npcscan add 70002 Lu-Ban
/npcscan add 70003 Molthor
/npcscan add 70530 Ra'sha

Sunday, 11 August 2013

RegEx - Regular Expresions

I have been playing with RegEx in Java more and more, and it is fun working out how they work and even built some myself.

I needed RegEx to perform checks on strings to validate password and email strings.

Finding RegEx to check if a string has either capitals, lowercase or numbers was quite easy :-

Capital = ".*[A-Z].*";
Lowercase = ".*[a-z].*";
Number = ".*[0-9].*";

Finding Email validation RegEx was a bit harder as there are many different compositions, some being quite loose and others being way to precise.

After a lot of testing I settled on this one :-

Email = "\\b(?!,|/)(\\w+)(?!,|/)((-?\\w+)*)?(?!,|/)(\\.{1})?(\\w*)?@{1}(\\w*)(?!,|/)((-?)(\\w*)?)(?!,|/)(\\.{1}\\w+){1,2}\\b";

But finding a RegEx to find a symbol in a string was a bit harder still.

I read many many forums and tutorials and tried many many different compositions.

I even built an array of every RegEx I had built for each individual symbol using a break before each symbol to ensure no meta characters slipped by :-

@ Symbol = ".*[\\@].*"

Then I looped through he array and tested against my test stings.

Sure it worked, but what a lot of code for something that I though should have been quite straight forward.

Then after far too many hours I looked at this problem from a different angle, if I could not reliably test a string for a symbol why not test a string for a character that was not a capital, lowercase, whitespace, underscore or number.

So I built the following :-

 Regex = ".*[^A-Za-z0-9!@#$%^&*()_+=-{}~`].*";

In RegEx ^ = not, similar to Java ! = not.

This works but once again I am still defining each symbol.

So I kept working and testing until I built :-

BetterRegex = ".*[^A-Za-z0-9\s].*";

It took me far to long but wow I had some fun.

Now it is time to relax ... relax and eat chocolate.