Useful World of Warcraft macros

posted in world of warcraft with 0 comments

I recently returned to a healing alt character in World of Warcraft, and I’ve come up with some useful and multifunctional macros to share. I have mild RSI in my right arm that was exacerbated by click-targeting, so to prevent problems I moved the bulk of my abilities to @mouseover macros, with fallback for self-targeting.

BindPad is used to manage and directly keybind macros. I copy Arthas/Masserah’s WTF folder to a new character, and it has sometimes caused problems and deleted macros. BindPad stores macros separately to the WTF folder, and allows me to quickly import and set up profiles regardless of server or character.

Mount macro: bound to x

/petfollow
/dismount [mounted]
/cast [mod:shift] Ghost Wolf
/cast [mod:alt,@mouseover,help,exists,nodead] Water Walking
/cast [mod:alt] Water Walking
/cast [nomod,swimming] Abyssal Seahorse
/castrandom [nomod,flyable] Ashes of Al'ar, Onyxian Drake, Thundering Onyx Cloud Serpent, Armored Red Dragonhawk
/castrandom [nomod] Raven Lord, Ultramarine Qiraji Battle Tank, Vicious War Wolf, Swift Zulian Panther, Ashhide Mushan Beast

This is my mount-movement macro. I recall my pet, with shift jump into Ghost Wolf, with alt cast Water Walking, and with nomod I cast an area-appropriate mount: Swimming? Seahorse. Flying? Ashes et al. Battleground? Ground mount. If you use a Death Knight you substitute Path of Frost for Water Walking, or Dispersion or Angelic Feather for Ghost Wolf as a Priest.

Target macro: Bound to tab

/cleartarget
/targetenemyplayer

As an Enhancement Shaman, in a brawl I only care about those other players I can reach. Tab targeting in World of Warcraft works as follows:

  1. Target the closest player/monster directly in front of the player.
  2. Pick the next target from players/monsters in a widening cone in front of the player. The cone is roughly 90° wide-45° to the left and 45° to the right.

This macro skips step 2, so tab target will only ever pick the closest player to my character.

Friendly and hostile purge: shift + d

/cast [harm,nodead,exists] Purge
/cast [@mouseover,help,nodead,exists] Cleanse Spirit
/cast Cleanse Spirit

Shaman have both offensive and defensive purge abilities. This firstly cleanses the hostile target, then a friendly @mouseover target, then finally a friendly target.

Friendly healing: bound to f

/cast [@mouseover,help,exists,nodead] Healing Surge
/cast Healing Surge

Just as with purging, when I get five Maelstrom Weapon stacks I need to throw out heals to my teammates and I. This heals my mouseover target, and falls back to healing myself.

Although these are only a few macros, hopefully they give you an idea of how to macro and combine spells and abilities in a manner that is RSI-friendly!

by Mark -

Learning Sass and re-designing the site

posted in the website with 0 comments

I’m moving to Sass for my CSS. I tried, but didn’t enjoy, DRY. The principles of DRY are sounds, and there are countless use cases and successful stories, but the philosophy doesn’t fit my needs. Plus, honestly, if I have to refactor my CSS and learn a new skill, I would rather learn Sass first. I can learn the philosophy as I learn the tool.

I’ve been prompted in this by the appearance of the website. I don’t feel comfortable with it anymore. I like clean and white typography, but that doesn’t reflect what I want… Last week I added the <pre> style I created for Alanna (example block here) to the site. I found that the colours were a better reflection of what I wanted than coal grey, blood red, and white.

So redesign and Sass.

by Mark -

x to y of z search results

posted in code with 0 comments

I’m the dozen hundredth person to code this solution. I am always rebuilding my site on an ongoing basis-see a better way, code a better way. Today I’ve worked on the search results template. I want to be able to sort results, and have a counter for the results in the manner of “results x to y of z”:

It is pretty easy. Three numbers are needed:

  1. Current page number.
  2. Number of posts displayed per page.
  3. Total count of search results.

Calculate the top count-range number first (y in ‘x to y of z’):

$page_number * $posts_per_page;

Then the bottom count-range number:

$count_low  = ($count_high - $posts_per_page) + 1;

And finally round the top count-range if it is over the total:

$count_high = ($count_high > $total_results) ? $total_results : $count_high;

Here is the completed function. You can just drop this into your functions.php as-is.

function search_results_count($page_num, $total_results) {
    $page_num = ($page_num == 0) ? 1 : $page_num;
    $posts_per_page = get_option('posts_per_page');
    $count_high = $page_num * $posts_per_page;
    $count_low  = ($count_high - $posts_per_page) + 1;
    $count_high = ($count_high > $total_results) ? $total_results : $count_high;
    echo 'Results ' . $count_low . ' to ' . $count_high . ' of ' . $total_results;
}

Execute it with this line in search.php:

<?php global $wp_query; search_results_count(get_query_var('paged'), $wp_query->found_posts); ?>

It will output this string (for example):

Results 1 to 10 of 158

by Mark -

Linux course post-mortem

posted in code with 1 comment

CHANGE ME

There was a dearth of classes going on at 091 Labs over the summer, so I stepped up to the plate at the start of August and advertised a Linux programming class, spread over four weeks: Learn the fundamentals of programming through the Bourne Again Shell, and all its queerness and oddities of syntax. The first class was held on August 19 in the hackerspace with the three successive classes each held on the following Monday. The crowd was small, and only shrunk, but compared to some classes I’ve attended and run, they were pretty attentive.

I, me, myself, I too learned a lot from this class, both in and out of Bash: Why certain things were handled by Bash in a certain manner (subshells comes to mind-I’ve been using them since day one, but never really thought about how they worked); how to perform tasks I thought difficult or weird (advanced awk and sed operations); how to parse the material for the class in an understandable manner; and odd as it is to admit, how to make eye contact and just interact in a relaxed and confident manner, given how long I’ve been avoiding just this.

The Bash part of the learning was fun, and I can comfortably say that I came out of each week with a better understanding than I did going in. The case structure, variables, oddities, efficiently testing items, parsing integers, math operations, and even some binary operations too were all items I picked up from basically scratch.

I’ve also built up a good body of material that I can just turn around and give to someone who wants to learn the Bourne shell, as simply as just sharing the Google Drive folder with them. The slides are concise if sparse, and cover the fundamental operations without delving into anything Linux-specific: You can follow through the slides and examples through Terminal on OS X, or Cygwin on Windows.

On the classes themselves, I learned some things: A Facebook event is where workshops go to die; Facebook users are as conditioned to ignore event invitations as they are blinking advertisements. The 091labs.com blog post, word of mouth through members and friends, and repeated postings on the 091 Labs twitter and Facebook accounts were what brought people in the door.

I did some things right, and others wrong:

  • I should have had printed handouts with exercises and solutions available.
  • A split-screen terminal (Terminator) was excellent: I could simultaneously show creation and execution without having to either tab away or change desktop.
  • Offering Cygwin and SSH access was a fantastic idea. It saved me from having to mess with people installing Linux for the first time.
  • Problems with Windows’ line-endings cost me time and frustration. Everything seems coded okay, but then you run it and whoops. Ditto this and people deciding to try vim despite my stern warnings away from it.
  • RE the above: Next time I need to mandate a good text editor for Windows and OSX, either Sublime Text. If you use Notepad or Wordpad or TextEdit-or any kind of rich text editor for that matter, you deserve to be shunned.
  • Relying on slides for the first week of solutions limited me and only served to fluff out the slideshow. Coding and uploading solutions separately allowed me to append notes at length.

The final workshop is tomorrow, and instead of a segue into C#, I will probably stick with more real-world examples of scripts, give more exercises, and invite my students to offer up problems for me to handle programmatically.

In the end it was fun, the money brought in helped the hackerspace, and I can port this material to other programming languages (C#, probably) with minimal effort. B++, would run again.

by Mark -

Building up mental inertia

posted in me with 0 comments

I’ve sunk myself into virtual worlds and escapist fantasies since last September. There was World of Warcraft (a lot of it), fantasy, novels, and the Internet as a whole to run off into while I had my breakdown. It was great. Brilliant. I need to stop now, and get back in line with the real world.

My WoW subscription runs out today, and I’m going to let it lie for a while. I’m back in Galway for a few days, to get some design and coding work done on Bigworldia. I might even have found a place to stay down here for the summer. Yay. Tomorrow I go to the doctor’s office and apply to change my G.P. to our family doctor. Something something Mark something something happy pills.

Okay.

The last year of college is a complete writeoff; I never went in, I didn’t sit any exams, and I barely even read any of the emails the campus and lecturers sent out. I in no way believe I am going to able to sit any repeat examination come July and August. I am instead just going to go repeat the year in September.

I’ve still had no contact with the children, or with Mariah, since she refused me access to them. It it something I have the means to fight, so I’ve made the choice to let it all go for now. Pack up the photographs, put them away, let it lie, and hope that one or the other decides to contact me when they’re older. I can’t get a divorce in Ireland until August 2017, which I plan to do the moment that month rolls around.

Bigworldia, as it stands, is now running in Monogame, on Linux. XNA was killed off by Microsoft, but Monogame has an active and passionate development community. I’m going to roll with this for the summer and see where I go. :D

by Mark -

School update

posted in college with 0 comments

I wrote code for the first time since last summer, and with coding, comes some fairly hard choices what to do with myself after the summer. I’ve burned a lot of bridges over the last year, burned them very well indeed. College, over the past year, has been a complete loss.

I’ve been on time and in class for less than ten days out of ~130 of the two semesters gone, and I have zero idea of what the content of the year gone has been, although from those days that I have been in, it doesn’t seem ridiculous advanced; call any difficulty to be that of quantity, not quality.

Now, the choices:

  1. Write the last year off as a loss to depression, scrape up ~€1300 between now and Hallowe’en. I have some web work to finish, and could probably canvas more, so this isn’t as ridiculous as proposition as it seems.
  2. Cut my loss, admit academic defeat, and seek work in Galway. I’m passably good at Adobe Photoshop, HTML, CSS, and design, and I plan to move back to Galway for the summer anyway come May.

There isn’t an easy choice either way. Sligo is soul-crushingly boring, completely lacks in any social outlet for an introvert who doesn’t like pubs, and has marginally fewer amenities than, say, an arbitrary square kilometre of the Mojave Desert; the course material at college is shallow, full of gaping holes (see: my rants about the math from last September) and irrelevant crud, but it is a foundation I still absolutely need if I am going to do any work with code.

On the other hand, Sligo is a ridiculously beautiful county with plenty of outdoor activities.

There’s an excellent resource in Galway in the form of 091 Labs and its eclectic cadre of unwashed nerds, but that isn’t a substitute for Real Learning™.

In short, Sligo doesn’t have a lot that I want, but it has everything I need.

by Mark -

[XNA] Collisions (and a general update)

posted in code, college with 0 comments

One of the coolest things in older video games (read: Asteroids) for me was the wrap: The sprite moves off the screen and smoothly appears on the far side. Imagine my crippling disappointment this morning when I started playing around will collision detection and discovered that it is basically eight lines of code:

if (rectangle1.X + rectangle1.Width < 0)
	rectangle1.X = gameWidth;
if (rectangle1.X > gameWidth)
	rectangle1.X = 0 - rectangle1.Width;
if (rectangle1.Y + rectangle1.Height < 0)
	rectangle1.Y = gameHeight;
if (rectangle1.Y > gameHeight)
	rectangle1.Y = 0 - rectangle1.Height;

Beyond this, the project is slowly coming together. I’ve created several learning sub-projects in order to come up to speed with different facets of the project. The end is starting to come into sight, but the biggest work will be in tying everything together into a moderately-polished game.

by Mark -

[XNA] Muzak II

posted in code with 0 comments

I did some basic soundtrack-handling last night. I ran into problems getting it to run before I discovered that Content.Load(bar) can only be called from the main class. That was a bit of a pisser, and it forced me to rewrite my class. I am defending its existence on the grounds of potential extensibility.

class Muzak
{
	Song song;

	public Muzak()
	{
	}

	public void Next(Song inputSong)
	{
		// Import song.
		song = inputSong;
		MediaPlayer.Play(song);
	}

	public bool Playing()
	{
		// Is it playing?
		if (MediaPlayer.State == MediaState.Playing)
		return true;
		
		return false;
	}

	public void Pause()
	{

		if (MediaPlayer.State == MediaState.Playing)
		MediaPlayer.Pause();
	}

	public void Resume()
	{
		if (MediaPlayer.State == MediaState.Paused)
		MediaPlayer.Resume();
	}

	public string Name()
	{
		// Song name.
		return song.Name;
	}

	// Parse code stolen from RB Whitaker.
	// URL: http://rbwhitaker.wikidot.com/playing-background-music
	public string Parse(TimeSpan timeSpan)
	{
		int minutes = timeSpan.Minutes;
		int seconds = timeSpan.Seconds;

		if (seconds < 10)
		return minutes + ":0" + seconds;
		else
		return minutes + ":" + seconds;
	}

	// These next four methods all do the same thing in different combinations.
	// While I partially duplicate existing features, I wanted something extensible.
	public string Elapsed()
	{
		return Parse(MediaPlayer.PlayPosition);
	}

	public string Length()
	{
		return Parse(song.Duration);
	}

	public string Time()
	{
		return Elapsed() + " / " + Length();
	}

	public string NameTime()
	{
		return Name() + " " + Time();
	}
}

by Mark -

Problem #19 non-solution

posted in code with 0 comments

I’ve been having way too much fun with these:

using System;

public class Nineteen
{
	static void Main()
	{	
		
	}

	// Days in one month. Assumes "1-12" input.
	static int daysMonth(int year, int month)
	{
		int[]  a = new int[13] {0,31,28,31,30,31,30,31,31,30,31,30,31};
		int    b = 0;

		if ((leap(year)) && (month == 2))
			b = 29;
		else 
			b = a[month];

		return b;
	}


	// Days in one year period.
	static int days(int year)
	{
		int a = 0;

		if (!leap(year))
			a = 365;
		if (leap(year))
			a = 366;
			
		return a;
	}

	// Days in period. Inclusive.
	static int daysCen(int a, int b)
	{
		int c = 0;

		for (int i = a; i < = b; i++)
		{
			if (!leap(i))
				c += 365;
			if (leap(i))
				c += 366;
		}

		return c;
	}

	// Is the current year a leap year?
	static bool leap(int year)
	{
		bool a = false;

   	if (year % 400 == 0)
   		a = true;
   	else if (year % 100 == 0)
   		a = true;
   	else if (year % 4 == 0)
   		a = true;
   	else
   		a = false;

   	return a;
	}
}

by Mark -

Project Euler Problem #9

posted in code with 0 comments

Okay, this one was tough. Not in the computation – it took me about an hour to refine and submit my solution once I Googled the algorithm; my real problem was in completely understand the requirements of the question, and what it implied. I looked up the Pythagorean triplet, and the history of it.

using System;

public class Nine
{
	static void Main()
	{
		int a = 0;
		int b = 0;
		int c = 0;

		for (int i = 2; i < 50; i++)
			for (int j = 1; j < i; j++)
			{
				a = (i * i) - (j * j);
				b = 2 * i * j;
				c = (i * i) + (j * j);

				if (a + b + c == 1000)
				{
					Console.WriteLine("\n{0}\n", a * b * c);
					break;
				}
			}
	}
}

by Mark -