<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dade's Blog</title>
	<atom:link href="http://blog.deadbadger.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.deadbadger.org</link>
	<description>the eternal ramblings of a deranged mind</description>
	<lastBuildDate>Tue, 02 Mar 2010 11:59:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CodeIgniter Templating</title>
		<link>http://blog.deadbadger.org/2010/03/02/codeigniter-templating/</link>
		<comments>http://blog.deadbadger.org/2010/03/02/codeigniter-templating/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 11:59:21 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=215</guid>
		<description><![CDATA[These tutorials and code snippets for CodeIgniter are, sadly, in no particular order as these are things I&#8217;m discovering as I go and thus they are all over the place. After using CI for a little while, I recently stumbled across the gem that is Templating. There are some extensive documentation on template usage in [...]]]></description>
			<content:encoded><![CDATA[<p>These tutorials and code snippets for CodeIgniter are, sadly, in no particular order as these are things I&#8217;m discovering as I go and thus they are all over the place. After using CI for a little while, I recently stumbled across the gem that is Templating. There are some extensive documentation on template usage in CI, but here&#8217;s one or two to get you going! :)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000000; font-weight: bold;">class</span> Template_Test <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			parent<span style="color: #339933;">::</span><span style="color: #004000;">Controller</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$template</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">common</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTemplate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$template</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;message&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'alert'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$template</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;message&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index_alert'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'notify'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$template</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;message&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index_notify'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parse</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'temp_index'</span><span style="color: #339933;">,</span><span style="color: #000088;">$template</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file: template_test.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: ./system/application/controllers */</span></pre></div></div>

<p>Then create the views&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Charset&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{board_vendor_name} Development Team&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;language&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Accept-Encoding&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;gzip,deflate&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Encoding&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;gzip&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;X-UA-Compatible&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;chrome=1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Template Test<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
		{message}
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>This is some sample text<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;alert&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;alert&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;notify&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;notify&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Pay special note to the {message} part. :)</p>
<p>Now two other views, one called index_notify.php and the other called index_alert.php..</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-color:rgb(20,100,30);color:rgb(255,255,255);&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>NOTIFY TEST!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-color:rgb(100,20,30);color:rgb(255,255,255)&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>ALERT TEST!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Test the script and see the results! I admit this is all ugly as hell, and basic as a shack made of newspapers, but you can at least see how it works. Now, go forth and play with templating!</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=215&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2010/03/02/codeigniter-templating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter &#8211; A quick introduction</title>
		<link>http://blog.deadbadger.org/2010/02/24/codeigniter-a-quick-introduction/</link>
		<comments>http://blog.deadbadger.org/2010/02/24/codeigniter-a-quick-introduction/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 17:07:05 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=207</guid>
		<description><![CDATA[Here's a quick bit of code to create some tables with CI/Doctrine.]]></description>
			<content:encoded><![CDATA[<h2>CodeIgniter and Doctrine combined</h2>
<p><strong>Creating a Table</strong></p>
<p>Here&#8217;s a quick bit of code to create some tables with CI/Doctrine. I&#8217;ll assume at this point that you have CI set up to point to your database and such. If not, you will need to go to the system/applications/config/database.php file and change the settings there.</p>
<p>This is the model.. so create user.php in your models folder of codeigniter. This is using doctrine too, so please read the documentation on integrating doctrine to codeigniter before proceeding.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">class</span> User <span style="color: #000000; font-weight: bold;">extends</span> Doctrine_Record <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setTableDefinition<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">225</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'unique'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'true'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">225</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">225</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'unique'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'true'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">actAs</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Timestampable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTableName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// this is where the magic begins...</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasMutator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'_hash'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    protected <span style="color: #000000; font-weight: bold;">function</span> _hash<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pw</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$salt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'randomstring'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// this can be a simple string. i prefer to md5 it.</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_set<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__'</span><span style="color: #339933;">.</span><span style="color: #000088;">$salt</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'~1337#'</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'!'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file: user.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: /system/applications/models */</span></pre></div></div>

<p>Let&#8217;s review the code. First we have the class declaration. This creates a class called User. With CodeIgniter you would normally extend Model, but in this case because we&#8217;re using Doctrine we have to extend Doctrine_Record (much like active record, for those familiar with it.) Then we create the setTableDefinition() method, which gives the database the necessary column data. $this->hasColumn(name,type,options={}); where name is the column name, type is the column type (eg. whether it&#8217;s a text column, clob, integer, and so on.) Refer to the Doctrine documentation for more information on data types. Lastly we have options, which include things like unique, default, and so on.</p>
<p>Fairly simple to grasp, wouldn&#8217;t you say?</p>
<p>Now, the next method is the setUp(), which does the setting up of our database table to input the columns. actAs(&#8216;Timestampable&#8217;); creates two fields called &#8216;created_at&#8217; and &#8216;updated_at&#8217;. setTableName(name) should be obvious &#8211; it&#8217;s the name of our table. In this case, user. Then the magic. Mutators. hasMutator(column,mutator) means you can set a column name and apply a block of code to it. In this case we&#8217;re creating a password hashing system, so our mutator is called _hashpw.</p>
<p>We then define a protected function to the model to actually carry out the hash. This is so that the form doesn&#8217;t just input a user&#8217;s password and store it as-is on the server. Big no-no on the security front right there. Anyway, let&#8217;s move on quickly and review what the hashing actually does.</p>
<p>$salt &#8211; this variable acts as our condiment to the hashing. It can be a string you define, or as I have done you can run an md5 encryption on a random string for added oomph. It&#8217;s really not necessary, but I like to be safe than sorry. This then becomes a complicated string that we can use later.<br />
$this->_set(column,string) &#8211; sets our column &#8216;password&#8217; with a string, which may seem complicated at first, but really it&#8217;s not. First I like to create an opening string, then attach the salt, then a middle string to bridge the md5($pw) and then an ending string.</p>
<p>Let&#8217;s imagine for a moment that our final $salt = md5(&#8217;string&#8217;) comes to &#8216;WTFPWN&#8217; and our md5($pw) becomes &#8216;WTFBBQ&#8217;, our final string will be something like&#8230;<br />
&#8220;__WTFPWN~1337#WTFBBQ!&#8221; Simple. :)</p>
<p>Now our controller to create the tables. Here we go!</p>
<p>db_tools.php&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">class</span> Db_Tools <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;h2&gt;Database Tools&lt;/h2&gt;
      &lt;form method=&quot;POST&quot; action=&quot;&quot;&gt;
      &lt;input type=&quot;submit&quot; name=&quot;cr_usrTab&quot; value=&quot;Create User Table&quot;&gt;&lt;br/&gt;
      &lt;input type=&quot;submit&quot; name=&quot;cr_admUsr&quot; value=&quot;Create Admin User&quot;&gt;&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cr_usrTab'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Doctrine<span style="color: #339933;">::</span><span style="color: #004000;">createTablesFromModels</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Database tables created.'</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cr_admUsr'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#91;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'admin'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'email'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'admin@baseurl.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$adm</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$adm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fromArray</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$adm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Admin user created.'</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file: db_tools.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: /system/applications/controllers */</span></pre></div></div>

<p>This bit is magic, and I love it. Firstly we create a controller as normal and populate it with a simple index() method which fires when you navigate to http://localhost/index.php/db_tools/ &#8211; and all the index is to begin with is an echo of a h2 title, and a form with two submit buttons; one to create the tables in your db, and another to populate the table with an admin user.</p>
<p>Note the submit button names are the same as the if statements. $this->input->post(name) gets the submit/post name you just clicked. If it relates to what it governs, the script will fire. Again, really simple stuff.</p>
<p><strong>Doctrine::createTablesFromModels();</strong> &#8211; a magical line of code that says &#8220;I want to create tables, so I will look for ALL files in the models folder that extends the Doctrine_Record class and run the operations listed in each one to create the tables.&#8221; Truly a time-saving line of code for working with larger projects with multiple Doctrine_Record models. Then we echo that the database has been created.</p>
<p>The admin user creation is also a very simple idea. Firstly we create an array called $data, and within this array we have the column => value as you can see. Then we assign the a new class User() to $adm and then we can extend from that. $adm->fromArray(arr_name) takes all the values in the above array and populates them into the User class, then we simply save() it and echo that this has completed successfully.</p>
<p>Navigate to http://localhost/index.php/db_tools/ and test it. Any error messages will be very clear as to what the problem is. If you have problems you can always shout me though. Have a crack at it and see what you can do. :) Remember, the documentation of these systems are your very best friends.</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=207&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2010/02/24/codeigniter-a-quick-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Continuing PHP Saga&#8230;</title>
		<link>http://blog.deadbadger.org/2010/02/09/the-continuing-php-saga/</link>
		<comments>http://blog.deadbadger.org/2010/02/09/the-continuing-php-saga/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 22:05:51 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wamp]]></category>
		<category><![CDATA[wampserver]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=203</guid>
		<description><![CDATA[Upon starting my social network engine in pure PHP, I quickly abandonned it for CodeIgniter, which then fast become CodeIgniter &#038; Doctrine. I have to say, I&#8217;m less suicidal when it comes to PHP now and this is a good thing, since PHP is the easiest language for ease of edit, access, and collaboration &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Upon starting my social network engine in pure PHP, I quickly abandonned it for CodeIgniter, which then fast become CodeIgniter &#038; Doctrine. I have to say, I&#8217;m less suicidal when it comes to PHP now and this is a good thing, since PHP is the easiest language for ease of edit, access, and collaboration &#8211; cos I&#8217;m not going to teach others how to use Ruby on Rails when they have no grounding knowledge in that but do in PHP&#8230; so here goes.</p>
<p>What is PHP &#038; Doctrine? Well, Doctrine is a tasty PHP5 ORM that works quite nicely with CI, and CI is a tasty little MVC framework for PHP. All in all, it&#8217;s tasty. We&#8217;ll see how things go from here.</p>
<p>As a side note, for those starting out in development of such projects should check out wampserver.com and download wamp for windows. It quickly and easily installs and runs an Apache webserver, MySQL server, and slaps PHP on there for you too. Not bad, I&#8217;d say.</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=203&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2010/02/09/the-continuing-php-saga/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; Why!?</title>
		<link>http://blog.deadbadger.org/2010/01/23/php-why/</link>
		<comments>http://blog.deadbadger.org/2010/01/23/php-why/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 12:27:28 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=201</guid>
		<description><![CDATA[Having recently picked up a project that was side-lined for a while I&#8217;ve come to the realisation that PHP is not a language I like, and I&#8217;m as rusty as hell with it. The project is a community engine for achievements. I won&#8217;t go into great deal just yet, but it requires a forum, a [...]]]></description>
			<content:encoded><![CDATA[<p>Having recently picked up a project that was side-lined for a while I&#8217;ve come to the realisation that PHP is not a language I like, and I&#8217;m as rusty as hell with it. The project is a community engine for achievements. I won&#8217;t go into great deal just yet, but it requires a forum, a facebook-like functionality but without the crap that unfortunately the community have added to it, and a lot of code.</p>
<p>I&#8217;ve opted to do this from scratch, as I&#8217;m not really satisfied with the other community engines out there for PHP. As a result, I&#8217;ve run into the problem of work load. It&#8217;s a big project and one that I&#8217;m passionate about, but the lack of will to live whilst using PHP is one that bothers me.</p>
<p>I over exaggerate a little. It&#8217;s not as bad as I make out, this PHP lark, but I feel that there are better engines out there for achieving this type of project in a lot shorter space of time. I&#8217;m going to create this site/community on 2 or 3 different languages/frameworks. First will be pure and plain PHP, the next will be the CodeIgniter framework for PHP, and lastly Ruby on Rails. This means a bit more work than before, but in actual fact the hardest part of it all is the planning. Once I have the site running under one system, it&#8217;ll be easy enough to implement it into others.</p>
<p>Still, it&#8217;s a big job and nowhere near off the ground in terms of the code side. The ideas and planning has been there some time. We&#8217;ll see how it goes.</p>
<p>For the time being, I&#8217;m going to be cheeky and ask for all the PHP nuts out there that I know to give me a shout if they&#8217;re interested in giving me some pointers and helping with the intricacies of PHP programming.</p>
<p>Rubyists also wanted for much the same. I cannot offer pay, but you will get my e-kudos; and that, my friends, is invaluable. <3</p>
<p>Thanks in advance!</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=201&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2010/01/23/php-why/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dragon Age Modding &#8211; Area Tutorial</title>
		<link>http://blog.deadbadger.org/2009/12/05/dragon-age-modding-area-tutorial/</link>
		<comments>http://blog.deadbadger.org/2009/12/05/dragon-age-modding-area-tutorial/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 23:25:03 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[Dragon Age]]></category>
		<category><![CDATA[Modding]]></category>
		<category><![CDATA[age]]></category>
		<category><![CDATA[area]]></category>
		<category><![CDATA[dragon]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[toolset]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[waypoint]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=164</guid>
		<description><![CDATA[Welcome to the first instalment of my Dragon Age tutorials. I will assume that you've looked at the toolset already and have a basic understanding of how the viewports work and how to navigate (mainly for this mod) the terrain window; such as camera panning, rotation, and so on. If not, I suggest you have a play around, though be careful not to create/save anything into the Single Player campaign as problems can occur this way.]]></description>
			<content:encoded><![CDATA[<p><span style="color:rgb(255,20,20)">Apparently there was some mixed up information so my section on how to assign Module and Module Owner is a little wrong. For this tutorial, they should both be the module name (ie. tutorial). Sorry for the mix-up. I will re-write this article when I have some more time to cut down on the wall of text into a more concise explanation.<br/><br/>dade-</span></p>
<p>Welcome to the first instalment of my Dragon Age tutorials. I will assume that you&#8217;ve looked at the toolset already and have a basic understanding of how the viewports work and how to navigate (mainly for this mod) the terrain window; such as camera panning, rotation, and so on. If not, I suggest you have a play around, though be careful not to create/save anything into the Single Player campaign as problems can occur this way.</p>
<p>Firstly, you want to create a tutorial module. To do this, go to <em>File > Manage Modules</em>. This will bring up a window much like the image below.<br />
<div id="attachment_165" class="wp-caption none" style="width: 334px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/manage_module.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/manage_module.PNG" alt="A list of modules, both core and custom created." title="Manage Modules" width="324" height="387" class="size-full wp-image-165" /></a><p class="wp-caption-text">A list of modules, both core and custom created.</p></div>As you can see, this lists all the modules that are stored on the local machine, from the default to the custom created. Core, Demo, and Single Player are all default with the game. These you should leave well alone, and instead you want to create a new module.</p>
<p>When you create a new module, you&#8217;ll be greeted with the following window:<br />
<div id="attachment_171" class="wp-caption none" style="width: 456px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/new_module.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/new_module.PNG" alt="Creating a new module" title="New Module" width="446" height="414" class="size-full wp-image-171" /></a><p class="wp-caption-text">Creating a new module</p></div>The fields you need to focus on for the purposes of this tutorial are <strong>Name</strong> and <strong>UID</strong>. Name is, obviously, the name of your module. This can be anything you like, and can contain spaces. UID is the module&#8217;s Unique Identifier. I&#8217;ve yet to find where this is referenced, but for the sake of module &#8220;best practices&#8221; I would give this a unique and descriptive name. For this tutorial, you can simply put <strong>tutorial</strong> into both fields.</p>
<p><strong>OK</strong> that and then highlight and <strong>Open</strong> your newly created module. The first time the module is loaded after creation you may find that it takes a little time to respond. Be patient, and when it&#8217;s fully loaded you will have a completely blank module to play with. Go ahead and create a new <strong>Area</strong>. Do this by going to <em>File > New > Area</em>. This will open up a window like so&#8230;<br />
<div id="attachment_175" class="wp-caption alignnone" style="width: 404px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/new_area1.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/new_area1.PNG" alt="Creating a new area" title="New Area" width="394" height="236" class="size-full wp-image-175" /></a><p class="wp-caption-text">Creating a new area</p></div><strong>Resource Name</strong> should be the name of your area. It is a good idea that for each module you create, you specify and stick to a naming convention for assets that you create, such as Areas, Monsters and so on. For this I will say use &#8220;tut_&#8221; as a prefix. Go ahead and call your map <strong>tut_flemhut_ext</strong>.</p>
<p><strong>Folder</strong> is the location your area will be saved once created. If you look on the Palette Window on the right of the screen (enabled by default) you will see a folder tree view. Leaving <strong>Folder</strong> as / will create your area in the root of the Area tab. I&#8217;d suggest not putting your custom content in the root as this can get extremely confusing for larger mods later on. Go ahead and put <strong>/Tutorials</strong> in there.</p>
<p><strong>Module</strong> is the module that you are creating the asset for. In this case, you should leave it as <strong>tutorial</strong>, or whatever you&#8217;ve called the module for this tutorial.</p>
<p><strong>Owner Module</strong> confused me at first, but upon further reading I&#8217;ve discovered that this is specifying which module should be able to access the asset. I&#8217;ve set this to Core Game Resources. Anything that we set to be owned by &#8220;CGR&#8221; can be accessed by any other module. Obviously if you only want the asset accessible in a specific module, you will want to set this option accordingly.</p>
<p>Leave <strong>State</strong> as NONE and leave the tickbox as it is. This option literally acts like when you finish installing a program and tell the installer to &#8220;Run program when installer exits&#8221;. A quick explanation about checking in and out resources. When working on a mod with several people who are scooting about left and right modifying different files here and there, you will get to a point where your modifications to one object conflicts with another developer in your team. To counter this problem, the toolset has a <strong>Check In</strong> and <strong>Check Out</strong> feature. When a file is checked it creates a local copy of the file for that developer to chop and change and do what is needed on their part; for instance a programmer adds his/her script to a monster while another developer adds some armour and changes the appearance of that monster. When these two finish with their task, they <strong>Check In</strong> which merges their changes with the master copy saved on the module. Both of the changes are seen, and the monster now has scripts and some items and a new look with the least bit of hassle for either developer. :)</p>
<p>If you have multiple developers working on a single module, you can view the history of check ins/outs by going to <em>View > Resource History</em>. Notes are recommended when checking in resources so that others can see what it was you changed. Not essential, but it&#8217;s good to get into the habit of it.</p>
<p><em>NOTE: If you are familiar with using Git and/or GitHub you may be familiar with the way this kind of collaborative development works. It is essentially the same.</em></p>
<p>So now you have a blank area&#8230; what to do with it!? Well, you want to make sure the area is open so that you can see some of its meta data in the Object Inspector (enabled by default) in the bottom right of the window. You will see a whole list of variables and (possibly) confusing settings&#8230;<br />
<a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/object_inspect.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/object_inspect.PNG" alt="Object Inspector" title="Object Inspector" width="379" height="497" class="alignnone size-full wp-image-179" /></a></p>
<p><strong>Area Layout</strong> lets you load a pre-made <strong>Level</strong>. Click in the input box on yours and then the &#8220;Triple Dot&#8221; button that appears. This will open up a list of the game&#8217;s areas that you have been walking around in the single player campaign. Load up <strong>ost101d</strong> which is Flemeth&#8217;s Hut Exterior.</p>
<p><strong>Name</strong> can be anything you wish, though something relevant would be ideal.</p>
<p>The last important thing we need on this is <strong>Resource Name</strong>. You will notice in the above picture it is called <strong>dbare_flemhut_ext</strong>. Swap the <strong>dbare_</strong> with <strong>tut_</strong>.</p>
<p>You will notice whilst editing that Object Inspector that a map has loaded. As a default the camera will be faced down at the exact centre of the area. Navigate North a little and rotate the camera so that you can see Flemeth&#8217;s hut front. Right click the ground and place a waypoint, then another. These will be our spawn locations, but before we start editing the finer points of transitions we&#8217;ll create/place everything that&#8217;s needed.</p>
<p>You will see on the front of Flemeth&#8217;s hut that there&#8217;s a little niche where a door should be. Now here comes the magic from BioWare, and one of the hundreds of reasons why I love this engine. Open up Placeables (Palette Window, Table icon) and select the Area Transitions > genip_at_normal and place it just in front of Flemeth&#8217;s hut. You will notice that there is a blue ball on the side of the door, which is the reference point for doorways. It&#8217;s magic, I tells ya!! Drag the ball on the door to near the one on the door frame and let go.</p>
<p>BOOM! No need to faff about aligning and re-aligning. The engine knows which way the door should sit, and whether or not it&#8217;s rotated the right way. Anyway, now that the excitement&#8217;s over and we have our first area kitted out with waypoints and a door, we want to create another area. Follow the steps as before, but call it &#8220;_int&#8221; for interior, and load the <strong>Area Layout</strong> called <strong>ost102d</strong>. This is Flemeth&#8217;s hut interior, as seen in the campaign.</p>
<p>Go ahead and add a door to the interior, and place a single waypoint here. Rotate and move your waypoints so that you have something along the lines of&#8230;<br />
<div id="attachment_182" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/flemhut_ext.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/flemhut_ext-300x184.PNG" alt="tut_flemhut_ext layout" title="Flemeth&#039;s Hut Exterior" width="300" height="184" class="size-medium wp-image-182" /></a><p class="wp-caption-text">tut_flemhut_ext layout</p></div></p>
<p>And the interior should look like&#8230;<br />
<div id="attachment_186" class="wp-caption alignnone" style="width: 552px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/flemhut_int.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/flemhut_int.PNG" alt="tut_flemhut_int layout" title="Flemeth&#039;s Hut Interior" width="542" height="487" class="size-full wp-image-186" /></a><p class="wp-caption-text">tut_flemhut_int layout</p></div></p>
<p>Select the left-hand waypoint in our <em>exterior</em> and go to its Object Inspector. The waypoint&#8217;s inspector looks like this:<br />
<div id="attachment_188" class="wp-caption alignnone" style="width: 386px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/waypoint_obi.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/waypoint_obi.PNG" alt="Tag is important here" title="Waypoint Object Inspector" width="376" height="413" class="size-full wp-image-188" /></a><p class="wp-caption-text">Tag is important here</p></div></p>
<p>As the caption says, Tag is the important field here. This one we will call <strong>mod_start</strong>. This will be the point where we initially spawn upon loading our mod. You may specify a name if you wish. I would personally advise you do so, even if to fully explain the tag; for instance with our mod_start waypoint we could give the name a value of <strong>Module Starting Location</strong> or something similar.</p>
<p>Our second exterior waypoint will act as our transition anchor. This will become clear soon. This one I named <strong>wpt_flemhut_ext</strong>. Now open the Object Inspector for our door, which will look like this:<br />
<div id="attachment_190" class="wp-caption alignnone" style="width: 386px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/door_obi.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/door_obi.PNG" alt="Settings for our area transition" title="Door Object Inspector" width="376" height="413" class="size-full wp-image-190" /></a><p class="wp-caption-text">Settings for our area transition</p></div><br />
Everything for this door can be left as default, even the Tag of the door; however, for larger scale mods I would advise change these tags too&#8230; less confusion when you try to debug and need to find a single door in a city area. ;) For simplicity&#8217;s sake, set the tag to <strong>atdr_flemhut_ext</strong>.</p>
<p><em>Note: In the next tutorial I will be going over custom area transitions. :)</em></p>
<p>One last thing with our door transition is to set its variables. In the Object Inspector window, click on the &#8220;Open&#8221; button (triple dot) to get this:<br />
<div id="attachment_191" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/trans_var.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/trans_var-300x119.PNG" alt="The variables for a certain resource, in this case, a transition." title="Resource Variables" width="300" height="119" class="size-medium wp-image-191" /></a><p class="wp-caption-text">The variables for a certain resource, in this case, a transition.</p></div><br />
Sort the Name column so that you have <strong>PLC_AT_DEST_AREA_TAG</strong> which is the area tag of our destination. Seeing as this is our exterior door, we want to point this to the interior, which should be <strong>tut_flemhut_int</strong> and set the <strong>PLC_AT_DEST_TAG</strong> as <strong>wpt_flemhut_int</strong>.</p>
<p>That should be it for the interior. OK that window and switch to our interior. Again, we want to name our waypoint and set the transition of the door. The interior waypoint has to be the same as the exterior door&#8217;s variable <strong>PLC_AT_DEST_TAG</strong>, which in our case is <strong>wpt_flemhut_int</strong>. Now change the interior door&#8217;s variables to point to the waypoint outside.</p>
<p><strong>PLC_AT_DEST_AREA_TAG = tut_flemhut_ext</strong><br />
<strong>PLC_AT_DEST_TAG = wpt_flemhut_ext</strong></p>
<p>I hope that made sense. Basically you need to point the object to its opposite side, which is where naming becomes essential to save time and headaches.</p>
<p>Right! Almost done. The last thing we need to do is save and then &#8220;Check In&#8221; both the areas we&#8217;ve created. The easiest way to do this is to right-click the tab in the main view port and then click Check In. You will see that the resource you&#8217;re trying to check in is highlighted, and there is a comment box below. I normally put something like this:<br />
<div id="attachment_193" class="wp-caption alignnone" style="width: 340px"><a href="http://blog.deadbadger.org/wp-content/uploads/2009/12/commit.PNG"><img src="http://blog.deadbadger.org/wp-content/uploads/2009/12/commit.PNG" alt="Initial check in/commit - basic info about what was created/modified" title="Check In" width="330" height="166" class="size-full wp-image-193" /></a><p class="wp-caption-text">Initial check in/commit - basic info about what was done</p></div></p>
<p>Repeat this with both areas, and once done you want to go to <em>File > Manage Modules</em> again and under <strong>Starting Area</strong> select our exterior map, then set the <strong>Starting Waypoint</strong> to our mod_start. OK that, select Open on our Module again, and finally we&#8217;re ready for the export and test. :D</p>
<p>Go to <em>Tools > Export > Export with dependent resources</em>. Give this some time, as it can take a moment or two to export all the necessary files. Once done, we want to do two more exports, but this time we want <em>Tools > Export > Export Module XML</em> and <em>Tools > Export > Export Manifest XML</em>.</p>
<p>Once all these steps are done, open up the game and (hopefully) the newly created mod will be filed under Other Campaigns on the main menu. :)</p>
<p><strong>NOTE: If whilst testing you find that you spawn outside the map, or do not spawn at all, check that the transition door are named and pointing to their corresponding waypoints. Also, if you placed a waypoint on uneven ground, you want to lift it just a fraction so that it doesn&#8217;t go through the floor. If you are still having problems, leave a comment and I&#8217;ll try to answer your queries.</strong></p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=164&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2009/12/05/dragon-age-modding-area-tutorial/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>OFP:DR LUA Tutorial 1</title>
		<link>http://blog.deadbadger.org/2009/10/24/ofpdr-lua-tut-1/</link>
		<comments>http://blog.deadbadger.org/2009/10/24/ofpdr-lua-tut-1/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 12:52:51 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[LUA]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[flashpoint]]></category>
		<category><![CDATA[mission]]></category>
		<category><![CDATA[OFP:DR]]></category>
		<category><![CDATA[operation]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=154</guid>
		<description><![CDATA[A quick mission created for Operation Flashpoint: Dragon Rising. Some sample code and "concept" code added for awesomeness. :D]]></description>
			<content:encoded><![CDATA[<p>:edit &#8211; 12 Nov 09: I&#8217;ve rewritten the lua scripts for this mission and will now share it with you. I will assume you know how to create a simple mission and set up the entities in the map panel. If not, please refer to one of the many tutorials on the OFP:DR mission editor forums.</p>
<p>First thing&#8217;s first, you need to create your playing field and set up your entities. You will need the following:</p>
<p>- 3 vehicles (destructible ones)<br />
- 1 level script<br />
- 1 mission objective<br />
- 1 fireteam</p>
<p>You will need to set up your Mission Objective marker and set the objective text and everything like that, then you want to select the Fireteam&#8217;s echelon and Jump to a character within the fireteam. Set control mode to &#8220;player&#8221; and leave the rest as AI or multiplayer. Whichever you wish. Rename the trucks to truck1, truck2, and truck3 (this is just for ease of naming, you can do whatever names you want). Once everything is set up you want to enter the following code to the level.lua panel:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- onMissionStart().. place everything you want to initialise at the BEGINNING of the mission here..</span>
<span style="color: #808080; font-style: italic;">-- such as setting up primary start objectives like &quot;rendezvous with such and such&quot;</span>
<span style="color: #b1b100;">function</span> onMissionStart<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
	OFP:setObjectiveState<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;trucks&quot;</span>, <span style="color: #ff0000;">&quot;IN_PROGRESS&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">-- sets objective &quot;trucks&quot; to in prog. makes sense..</span>
	OFP:setObjectiveMarkerVisibility<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;trucks&quot;</span>, <span style="color: #b1b100;">true</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">-- trucks objective marker set to visible</span>
	tP <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">;</span> <span style="color: #808080; font-style: italic;">-- sets variable tP to 0 - more on this soon</span>
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- custom method, not built into OFP:DR API</span>
<span style="color: #808080; font-style: italic;">-- what it does...</span>
<span style="color: #808080; font-style: italic;">-- when progressCheck() is run</span>
<span style="color: #808080; font-style: italic;">-- if value of tP is 3 then set objective &quot;trucks&quot; to complete</span>
<span style="color: #b1b100;">function</span> progressCheck<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #b1b100;">if</span> tP <span style="color: #66cc66;">==</span> <span style="color: #cc66cc;">3</span> <span style="color: #b1b100;">then</span>
		OFP:setObjectiveState<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;trucks&quot;</span>, <span style="color: #ff0000;">&quot;COMPLETED&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #b1b100;">end</span>
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- the onDeath method can be used in two ways</span>
<span style="color: #808080; font-style: italic;">-- either onDeath_truck1() etc etc and create new blocks for each entity on the kill list.. OR!</span>
<span style="color: #808080; font-style: italic;">-- create an array/table of victims and place everything into a single block statement</span>
<span style="color: #b1b100;">function</span> onDeath<span style="color: #66cc66;">&#40;</span>victim, killer<span style="color: #66cc66;">&#41;</span>
	victim <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>truck1, truck2, truck3<span style="color: #66cc66;">&#125;</span> <span style="color: #808080; font-style: italic;">-- sets array with all three kill targets' entity names</span>
	tP <span style="color: #66cc66;">=</span> tP + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">;</span> <span style="color: #808080; font-style: italic;">-- each time a victim in the above list is killed tP is incremented</span>
	OFP:displaySystemMessage<span style="color: #66cc66;">&#40;</span>tP..<span style="color: #ff0000;">&quot;/3 trucks destroyed&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span> <span style="color: #808080; font-style: italic;">-- display console message &quot;value of tP&quot; out of 3 destroyed...</span>
	progressCheck<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">-- run the block we created above, so when tP increments to a value of 3 (when all are dead) the mission completes.</span>
<span style="color: #b1b100;">end</span>
<span style="color: #808080; font-style: italic;">-- easy stuff, eh!?</span></pre></div></div>

<p>My map screen looks like this, and my code is as above&#8230;.</p>
<p><img src="http://deadbadger.org/dade-/tut1.png" /></p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=154&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2009/10/24/ofpdr-lua-tut-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Desktop UI</title>
		<link>http://blog.deadbadger.org/2009/07/28/desktop-ui/</link>
		<comments>http://blog.deadbadger.org/2009/07/28/desktop-ui/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 10:50:13 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Informatics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=149</guid>
		<description><![CDATA[Okay, so without going into much detail about this, I&#8217;m design a desktop UI for an OS. It&#8217;s not going to be used as an OS, but I want it to feel like one. So, for instance, when you open a browser page it gives some &#8216;pseudo-internet&#8217; pages. Like a spoof OS, if you like.
What [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so without going into much detail about this, I&#8217;m design a desktop UI for an OS. It&#8217;s not going to be used as an OS, but I want it to feel like one. So, for instance, when you open a browser page it gives some &#8216;pseudo-internet&#8217; pages. Like a spoof OS, if you like.</p>
<p>What I want is some input from anyone that reads this blog. Ideas are welcome for features, look, animation, etc.</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=149&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2009/07/28/desktop-ui/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blogging in the car</title>
		<link>http://blog.deadbadger.org/2009/03/21/blogging-in-the-car/</link>
		<comments>http://blog.deadbadger.org/2009/03/21/blogging-in-the-car/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 20:24:56 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/2009/03/21/blogging-in-the-car/</guid>
		<description><![CDATA[Just been to the Apple Store’s Genius Bar with my mate Phil to replace his iPhone. The strangest thing… the girl that was serving us saw Phil’s email address (@deadbadger.org) and commented on how he came up with the name, which pointed the finger at me for setting up the site.
Well anyway, conversations led to [...]]]></description>
			<content:encoded><![CDATA[<p>Just been to the Apple Store’s Genius Bar with my mate Phil to replace his iPhone. The strangest thing… the girl that was serving us saw Phil’s email address (@deadbadger.org) and commented on how he came up with the name, which pointed the finger at me for setting up the site.</p>
<p>Well anyway, conversations led to a bit of Badger Trivia. Apparently if you hit a badger with your car, you have to report it to the police because they’re protected or something. The enemy are well entrenched in the government now! This is a bad day for the Anti-Badger Coalition! Men! To arms!</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=123&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2009/03/21/blogging-in-the-car/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Samsung NC10 :: A New Toy</title>
		<link>http://blog.deadbadger.org/2009/03/09/samsun-nc10-a-new-toy/</link>
		<comments>http://blog.deadbadger.org/2009/03/09/samsun-nc10-a-new-toy/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 01:08:53 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/?p=113</guid>
		<description><![CDATA[Anyway, it's a bloody nice laptop! I'm proper chuffed about it.]]></description>
			<content:encoded><![CDATA[<p>Yes, I went and did something I didn&#8217;t think I would ever have done. I bought myself a netbook &#8211; a bloody Samsung one at that.</p>
<p>While I&#8217;m no fan of Netbooks due to their size and power, I have to say that I&#8217;m pleasantly surprised by this one. It&#8217;s fast, very fast, and can load up Windows XP in a matter of seconds, as opposed to Vista&#8217;s minutes. Added to this, it has a fully fledged SATA-II hard disk drive in it, which other models of the same variety do not &#8211; they have tiny little flash drives. Dirty flash drives.</p>
<p>The NC10 is not the smallest of netbooks, strutting into the ring with a 10&#8243; widescreen display running at 1024 x 600 resolution, and weighs in at roughly 1.5kg. Not bad, I say.</p>
<p>There is a built on webcam, the keys are 17.7mm wide, which makes for decent fast paced typing. What every geek does!</p>
<p>The power consumption on this beast is very efficient too, though I haven&#8217;t fully tested this yet as I&#8217;ve only just recently got it and it needs to go through my rigorous cycle of battery prepping.</p>
<p>Anyway, it&#8217;s a bloody nice laptop! I&#8217;m proper chuffed about it.</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=113&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2009/03/09/samsun-nc10-a-new-toy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blogging from my phone</title>
		<link>http://blog.deadbadger.org/2009/03/05/blogging-from-my-phone/</link>
		<comments>http://blog.deadbadger.org/2009/03/05/blogging-from-my-phone/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 18:05:25 +0000</pubDate>
		<dc:creator>dade-</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[g1]]></category>
		<category><![CDATA[phone]]></category>

		<guid isPermaLink="false">http://blog.deadbadger.org/2009/03/05/blogging-from-my-phone/</guid>
		<description><![CDATA[I&#8217;m such a geek, but it means I can do this stuff while on the road or at a place without internet connection! Good fun
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m such a geek, but it means I can do this stuff while on the road or at a place without internet connection! Good fun</p>
<img src="http://blog.deadbadger.org/?ak_action=api_record_view&id=112&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.deadbadger.org/2009/03/05/blogging-from-my-phone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
