On Sat, 09 Feb 2008 14:05:25 +0900, Jonathon Hartoon wrote:

>  I am now trying to build in an
> inventory system, and smashing my face into the rocks.

Well, one approach would be to use a database.  By using a db from the 
get go you get the advantage of, well, organizing your data.  Then, you 
just connect to the db.

If you're using text files that's more fragile because one small change 
will cause other things to break.

I kinda, sorta, had thoughts along your line for a game, but was using 
_why's poignant ruby for inspiration :)

It's a bit rough (I don't do anything with the creatures once they're 
created), but the db part, for me, looks like:

require 'rubygems'
require 'fileutils'
require 'active_record'
require 'creature'
require 'dragon'
require 'instantiate'
include Instantiate


system("rm dwemthys.db")

ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.colorize_logging = true

ActiveRecord::Base.establish_connection(
    :adapter => "sqlite3",
    :dbfile  => "dwemthys.db"
)

ActiveRecord::Schema.define do
    create_table :creatures do |table|
	table.column :type,		:string
        table.column :life,		:integer
        table.column :strength,	:integer
        table.column :charisma,	:integer
        table.column :weapon,		:integer
    end
end




99.times do |index|
	creature = Instantiate.randomCreature
	p creature
	creature.save
end


http://dwemthys.googlecode.com/svn/trunk/db_crud_create.rb


HTH,

Thufir