Posts tagged: Code

World of Warcraft Macros – Fishing

By Brian, September 27, 2009 1:25 pm

One of the nice features of World of Warcraft is the ability to create custom macros to simplify common tasks in the game. I have a nice little on that you can place on a button for fishing.

What it does: If you do not have a fishing rod equipped, clicking the button will equip one. If a fishing rod is equipped, it will cast. If you hold down any modifier key it will re-equip your weapons.

Code (insert your object names where indicated in italics):

/equip [noequipped:Fishing Poles, nomodifier] fishing rod name;
/equip [modifier] main weapon name;
/cast [equipped:Fishing Poles, nomodifier] Fishing;

For example:

/equip [noequipped:Fishing Poles, nomodifier] Nat Pagle's Extreme Angler FC-5000;
/equip [modifier] Staff of Dark Mending;
/cast [equipped:Fishing Poles, nomodifier] Fishing;

If you are not using two handed weapons, you will need to enter an equip command for your offhand weapon as well:


/equip [noequipped:Fishing Poles, nomodifier] fishing rod name;
/equip [modifier] main weapon name;
/equip [modifier] offhand weapon name;
/cast [equipped:Fishing Poles, nomodifier] Fishing;

Happy fishing!

Painless Web 2.0 with jQuery

By Brian, November 28, 2008 1:04 pm

Allow me introduce you to my new favorite web tool: jQuery. jQuery is a handy java script that allows you to add AJAX functionality to your website without too much fuss at all.

After placing the jquery.js (obtained from jQuery.com) file in your website’s path (ex. yoursite.com/include/) you simply need to add two javascript references in your page header:

<script src='include/jquery.js'></script>
<script src='include/scripts.js'></script>

The scripts.js file is where all the custom functionality code goes. Here’s an example, where links clicked in a div named #nav will load the new content into the #content div without refreshing the whole page:

$(document).ready(function() {           // after page is loaded, this is called automagically $('#nav li a').click(function() {     var query = $(this).attr('href');                  // this is what appears in the href tag     $('#content').hide('slow',loadContent);            // hides the div, calls loadContent()

     function loadContent() {         $('#content').load(query,'',showNewContent()); // pull the request into the div     }                                                  // calls showNewContent()

     function showNewContent() {         $('#content').show('fast');                    // show the new page content     }     return false; // returning false indicates the event was processed });});

No change to the actual page markup was required to make this happen at all. A small hurdle I encountered working with jQuery was that having an event bound to content inside the div #content would cease to function once new content was brought in. The reason for this is that jQuery loads the event binding based on what is on the page at first load. The easy way to solve this is to add the Live Query plugin for jQuery. Put it in your include directory with the other two scripts, and reference the script after jQuery but before your site’s script:

<script src='include/jquery.js'></script>
<script src='include/jquery.livequery.js'></script>
<script src='include/scripts.js'></script>

You will need to perform the related event binding to use Live Query slightly different from a normal jQuery binding:

$(document).ready(function() {    // after page is loaded, this is called automagically $('#content a').livequery('click', function() {        // livequery auto-binds when tags change     var query = $(this).attr('href');                  // this is what appears in the href tag     alert('You clicked this link: ' + query);     return false; // returning false indicates the event was processed });});

Yup, it’s just that easy – and once again, no change was made to the page markup. There is no end to the applications of jQuery and it’s related plugins. Happy coding, and welcome to Web 2.0!

AdSense and Blogger Beta

By Brian, November 22, 2006 9:02 am

More tweaks this morning have led to the inclusion of an AdSense bar just between the header and the content as was there previously.

How did I do it?

I left layout mode and edited the HTML, where I found the .css element for the “header-wrapper” and “header” sections. I cloned them and renamed them – “billboard-frame” and “funkydj” respectively.

#billboard-frame {
    width:730px;
    margin:0 auto 1px;
}
#funkydj {
    margin: 0px;
    text-align: center;
}

Now scroll way down into the body of the HTML and find the “header-wrapper” tag. Below that div, you add a new section:


<div id="billboard-frame">
    <b:section class='funkydj' id='funkydj' maxwidgets='1' showaddelement='yes'>
    </b:section>
</div>

You can save, then go back to layout mode and add an HTML element into the new section you’ve created below the header. Voila!

Panorama Theme by Themocracy