Magic Cards

January 30, 2016

Hello,

I’ve had a request to amend the functionality of the magic cards. You can now set the “Type” text independently of the colour. This means the magic cards are now multilingual.

Filed under: Warhammer Quest — admin @ 2:45 pm

Generic Card Creation

September 24, 2015

I’m considering putting together a tool so people can create any type of card for any type of game. I’m thinking about having basic card types so WHQ will be included but what other games should have basic cards? I’ll be adding a facility so that cards can be saved for editing later and possibly making the listings public/private, maybe even a voting system.

What do people think? Leave me a comment and let me know.

Filed under: Uncategorized — admin @ 9:39 am

The card builders are back up and running, sorry for any inconvenience caused.

Filed under: Warhammer Quest — admin @ 11:02 pm

I’d been looking for a way of using the jQuery UI datepicker the same way that the Google Analytics datepicker works. Unfortunately I hadn’t found any solutions that I really liked. After a little more searching I found a tantalising piece of code that is already part of the jQuery UI Date Picker.

The piece of code is actually and Option, in this instance beforeShowDay. As the name suggests this piece of code is executed before the day is drawn. What I’ve done is pass the date of the day being drawn into the function and compared the date with some values I recorded earlier.

Based on some simple logic an array is returned (see the jQuery UI API documentation for more details), this important part for us is the class being added to the day (red for one selected period, blue for the second and split if any of the dates intersect.).

Now is this is great I can draw different coloured selected regions based on some stored dates. Now to make the ranges changeable.

I went back to the dates I was already storing. I knew that using the onSelect option I could use the date returned to my advantage. I stored the selected date in the object I’m using to hold the date ranges. But how to define the start and end?

I created a couple of input fields (a start and end) and a variable to track which field was being populated. On select the “selected field” is highlighted and the corresponding element in the date object is filled. Once the selection of a date is complete the focus is advanced to the next field.

The next step was simple I added a checkbox whose state determined if we were populating the first date range or another and added a couple more input boxes.

The resulting code you can find below and you can download a working example of the date picker. I think it’s a good starting point and you may wish to expand it’s functionality.

var dateRanges={
		"StartDate": new Date( 2013,11,18 ),
		"EndDate": new Date(2013,11,25), 
		"CompStartDate": new Date(2013,11,10 ),
		"CompEndDate": new Date(2013,11,17)
	};
var selection=1;
var range=1;
var compare=0;
var textMonths=new Array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );

jQuery(document).ready(function(){

	jQuery("#selectDates").datepicker({
					
		changeMonth: true,
		dateFormat: 'yy/mm/dd',
		numberOfMonths: 3,
		beforeShowDay: function (date){
						
			if (date >= dateRanges.StartDate && date <= dateRanges.EndDate ) 
			{
								
				if (date >= dateRanges.CompStartDate && date <= dateRanges.CompEndDate && compare==1 )
				{
								
					return [true, 'split', ''];
								   
				}
								
				return [true, 'red', ''];
								
			}
							
			if (date >= dateRanges.CompStartDate && date <= dateRanges.CompEndDate && compare==1 ) 
			{
							
				if (date >= dateRanges.StartDate && date <= dateRanges.EndDate )
				{
								
					return [true, 'split', ''];
								   
				}                
								
				return [true, 'blue', ''];
								
			}       
							
			return [true, '', ''];
							
		},
		onSelect: function( selectedDate ){

			parts=selectedDate.split('/');

			if ( selection==1 )
			{

				if ( range==1 )
				{

					dateRanges.StartDate = new Date( parts[0], (parts[1]-1), parts[2] );

					jQuery('#fldRangeStart').val( dateRanges.StartDate.getDate()+' '+textMonths[dateRanges.StartDate.getMonth()]+' '+parts[0] );

				}
				else
				{

					dateRanges.CompStartDate = new Date( parts[0], (parts[1]-1), parts[2] );

					jQuery('#fldCompStart').val( dateRanges.CompStartDate.getDate()+' '+textMonths[dateRanges.CompStartDate.getMonth()]+' '+parts[0] );                    

				}

			}

			if ( selection==2 )
			{
						
				if ( range==1 )
				{
				
					dateRanges.EndDate = new Date( parts[0], (parts[1]-1), parts[2] );

					jQuery('#fldRangeEnd').val( dateRanges.EndDate.getDate()+' '+textMonths[dateRanges.EndDate.getMonth()]+' '+parts[0] );

				}
				else
				{

					dateRanges.CompEndDate = new Date( parts[0], (parts[1]-1), parts[2] );

					jQuery('#fldCompEnd').val( dateRanges.CompEndDate.getDate()+' '+textMonths[dateRanges.CompEndDate.getMonth()]+' '+parts[0] );

				}

			}

			selection=selection==1 ? 2 : 1;

			if ( selection==2 )
			{

				if ( range==1 )
				{

					jQuery('#fldRangeEnd').addClass('focusBorder');  
					jQuery('#fldRangeStart').removeClass('focusBorder');

				}
				else
				{

					jQuery('#fldCompEnd').addClass('focusBorder');
					jQuery('#fldCompStart').removeClass('focusBorder');

				}

			}
			else
			{

				if (range==1 )
				{

					jQuery('#fldRangeStart').addClass('focusBorder');
					jQuery('#fldRangeEnd').removeClass('focusBorder');

				}
				else
				{

					jQuery('#fldCompStart').addClass('focusBorder');
					jQuery('#fldCompEnd').removeClass('focusBorder');

				}
			
			}
			
		}

	});

	jQuery('#fldRangeStart').click(function(e){

		e.preventDefault();
		selection=1;
		range=1;
		jQuery('#fldRangeStart').addClass('focusBorder');  
		jQuery('#fldRangeEnd,#fldCompStart,#fldCompEnd').removeClass('focusBorder');

	});

	jQuery('#fldRangeEnd').click(function(e){

		e.preventDefault();
		selection=2;
		range=1;
		jQuery('#fldRangeEnd').addClass('focusBorder');  
		jQuery('#fldRangeStart,#fldCompStart,#fldCompEnd').removeClass('focusBorder');

	});    

	jQuery('#fldCompStart').click(function(e){

		e.preventDefault();
		selection=1;
		range=2;
		jQuery('#fldCompStart').addClass('focusBorder');  
		jQuery('#fldCompEnd,#fldRangeStart,#fldRangeEnd').removeClass('focusBorder');

	});

	jQuery('#fldCompEnd').click(function(e){

		e.preventDefault();
		selection=2;
		range=2;
		jQuery('#fldCompEnd').addClass('focusBorder');  
		jQuery('#fldCompStart,#fldRangeStart,#fldRangeEnd').removeClass('focusBorder');

	});    

	jQuery('#fldRangeStart').addClass('focusBorder');			
				
	jQuery('#fldCompare').click(function(){
				
		compare=compare==1 ? 0 : 1;
				
		if ( compare==1 )
		{

			jQuery('.compfields').show();
			jQuery('#selectDates').datepicker('refresh');
			
		}
		else
		{
		
			jQuery('.compfields').hide();
			jQuery('#selectDates').datepicker('refresh');
			
		}
				
	});

	jQuery('#fldRangeStart').val( dateRanges.StartDate.getDate()+" "+textMonths[dateRanges.StartDate.getMonth()]+" "+dateRanges.StartDate.getFullYear() );
	jQuery('#fldRangeEnd').val( dateRanges.EndDate.getDate()+" "+textMonths[dateRanges.EndDate.getMonth()]+" "+dateRanges.EndDate.getFullYear() );
	jQuery('#fldCompStart').val( dateRanges.CompStartDate.getDate()+" "+textMonths[dateRanges.CompStartDate.getMonth()]+" "+dateRanges.CompStartDate.getFullYear() );
	jQuery('#fldCompEnd').val( dateRanges.CompEndDate.getDate()+" "+textMonths[dateRanges.CompEndDate.getMonth()]+" "+dateRanges.CompEndDate.getFullYear() );				
	
	jQuery('.compfields').hide();
	
});
.red a
{

	background: #ff0000 none 0 0 no-repeat !important;

}

.blue a
{

	background: #0000ff none 0 0 no-repeat !important;
	color: #fff !important;

}

.split a
{

	background: #ff00ff none 0 0 no-repeat !important;

}
		
.datedsps
{

	width: 75px;
	font-size: 11px;

}

.focusBorder
{

	border: 2px solid #ff0000;

}
-

Compare Previous Period

-

Filed under: Programming — Tags: , , , , , , — admin @ 2:50 pm

What we all need right now

September 22, 2011

What we all need right now is to feel better about our selves. I know that sounds hard with the economic situtation the way it is but hear me out. Take what you’ve heard about banks and money and put them on the back burner because what really matters is people; you, me, bankers even politians. You might be thinking what do people have to do with money well….everything, the people trading on the floors of our markets are people just like you and me. What they need right now is the feel better about themselves, to feel happy and confident about what they’re doing. When they aren’t happy the markets struggle.

How do we ordinary people fit in, unsurprisingly money, we spend it and it makes the economy go round, I understand this is difficult because we’re all worried about what will happen to our jobs. In lies the problem we are making things worse by not spending, the countries growth requires us to buy things, lets face it the money is making you any more in the bank is it? You might as well have the things you want.

So how can we feel better, my first thought is an easily accessible one, more pop music, so roll on X Factor give us something fun to listen to. Or how about some home improvements maybe the BBC will give us some new shows to enjoy, where we live has a great impact on how we feel so a spruce up might do just the job.

I imagine you can think of lots of other ways of feeling better but it’s what we should all be aiming for.

Filed under: Thoughts for the day — admin @ 7:17 pm

A recent design I had to build required that each list item in a menu (WordPress) be a different colour. After some head scratching I came up with a method using jQuery.

We start off be making sure our counter is 0. Then loop through each list item. We can get the current item number from jQuery and which element we are currently acting on. Setting the colour variable to be 1 + i means we count from 1 up to the total number of list items. I’m using modulo operator to loop the numbers after 8. Using jQuery we can then add class to the current element. The class could contain any CSS operation. I used this for a spectrum of colours.

    colour=0;
	
	$('.nav ul li').each( function(i, elem) 
	{
	
		colour=1+(i%8);
	
		$(elem).addClass('listitem'+colour);
			
	});
Filed under: Programming — Tags: , , , — admin @ 8:29 pm

Using jQuery and CSS we can change the colour of alternate rows in a table. The code below will lock on to each table row and change the background colour on alternate rows. I’m making the change with CSS but you could always add a CSS class instead.

    jQuery('table tr').each(function(i, domEle)
	{
	
         /* skip the first row (probably your headings) */
	  if ( i!=0 )
	  {
	  
                /* if i / 2 has no remainer set the background to this */ 
		if ( i%2==0 )
		{
	  
	      jQuery( domEle ).css('background-color','#dcddde');
		
		}
		else  /* if i / 2 does have a remainder change the colour to this */
		{
		
		  jQuery( domEle ).css('background-color','#f3f3f4');
		
		}
	  
	  }
	
	});

If you want add a class instead replace


jQuery( domEle ).css('background-color','#f3f3f4');

/* with */

jQuery( domEle ).addClass('odd');
Filed under: Programming — Tags: , , , , , , — admin @ 8:19 pm

Lazy Sunday

June 12, 2011

Today has been kind of a lazy day so I’ve got a couple of things out the way.

First off you’ve probably noticed the re-styling of the site. Feel free to let me know what you think.

Secondly; I’ve added 4 more Warhammer Quest card makers, Magic Cards, Monster Events Cards, Unexpected Event Cards and Treasure Cards. Again let me know what you think.

Filed under: Warhammer Quest — Tags: , , , , — admin @ 4:36 pm

G Max download

April 24, 2011

If you’ve been trying to download the version of G Max 1.2 hosted by Turbosquid you’ll have been frustrated by a bad link. After a bit of playing around, this is link you need to download G Max.

G Max is a cut down version of Discreets 3d Studio max. G Max is designed to allow developers to build 3d models for use in video games. You can download tutorials and help guides at Turbosquids G Max page

Filed under: Uncategorized — admin @ 11:11 am

If you’re like me and have designers handing you wonderful looking designs to build, then you’ve probably encountered the situation where they’ve used an Apple font with no true type font available. I’ve scoured the internet looking for useful tools and methods to convert from one to the other. I’ve compiled the ones I use below.

You’ll need a linux box for most of these although you could try cygwin.

Convert Postscript Type 1 font to TTF

This is the first part of a two step procedure. T1unmac can convert postscript type 1 fonts to pfb files. If you’re scratching you’re head the PS1 fonts are usually name “._FontName” (they’re probably hidden so you’ll need to “show hidden files”). The command words like this

t1unmac --appledouble ._FontName > FontName.pfb

This will return a .pfb file that you can use in the next step.

The next step is to use FontForge to convert to .pfb file into a True Type Font. Save the code before as convert.pe I can’t take credit for the script I found it on the FontForge website.

#!/usr/local/bin/fontforge
i=1
format=".ttf"
while ( i<$argc )
  if ( $argv[i]=="-format" || $argv[i]=="--format" )
    i=i+1
    if ( i<$argc )
      format = $argv[i]
      if ( format!=".ttf" && format!=".otf" && \
	  format!=".pfb" && format!=".svg" )
	Error( "Expected one of '.ttf', '.otf', '.pfb' or '.svg' for format" )
      endif
    endif
  else
    Open($argv[i])
    if ( $order==2 && (format==".otf" || format==".pfb" ))
      SetFontOrder(3)
      SelectAll()
      Simplify(128+32+8,1.5)
      ScaleToEm(1000)
    elseif ( $order==3 && format==".ttf" )
      ScaleToEm(2048)
      RoundToInt()
    endif
    Generate($argv[i]:r + format)
  endif
  i = i+1
endloop

You use the script like this

convert.pe --format ".ttf" *.pfb

This will find all files that end .pfb and convert them to .ttf files. The script can also output .svg and .otf.

Split a .dfont file

Another type of Apple font archive you could've encountered is a dfont file. These files can be split into their components (usually .ttf files) using the command fondu. The command you use for this is.

fondu FontName.dfont

This will output the content into the current folder.

Filed under: Programming — Tags: , , , , , , , — admin @ 8:23 pm

About me

Jonathan Spicer

My CV

My curriculum vitae and a wealth of other facts about me.

Warhammer Quest tools

Flickering flame effect Flickering flame effect Flickering flame effect

Powered by WordPress