Hi guys,

Trying to make a little helper tool for an online game that I play. The game
has a very complex crafting system, and I'm trying to put together something
to allow me to select an item I can craft and find out:
a) all the things I need to make that item, all the way back to the raw
materials, and
b) all the things I can then make from that item.

I've accomplished (b) no problem. Works beautifully. I can accomplish (a)
back one step. Then I try to make that recursive to step all the way back to
the beginning of the sequence and it throws a "500 null" error. So I did
some reading and found out that this is an error that means something has
gone wrong so fundamentally early in the code that it doesn't even know how
to display the error. I found a suggestion of putting a <cfflush> just after
the application setting, but that hasn't helped.

Here are the two functions at play here. If someone can give me any
suggestions about what I may have done wrong, I'd be very grateful.

    <cffunction name="downTree" hint="Returns the details of everything
needed to make an item" access="public" returntype="array" output="no">
        <cfargument name="aItems" type="array" required="no" default="">

        <cfscript>
            var result = arrayNew(1);
            var i = 1;
            var qItem = "";

            qItem = getItemMadeBy(aItems[1].id);

            if (qItem.recordcount) {
                result[1] = structNew();
                result[1].id = qItem.id;
                result[1].item = qItem.item;
                result[1].skill = qItem.skillname;
                result[1].makes = arguments.aItems;

                downTree(result);
            }
        </cfscript>

        <cfreturn result>
    </cffunction>

    <cffunction name="getItemMadeBy" hint="Gets the items needed to make a
given item" access="public" returntype="query" output="no">
        <cfargument name="item" type="string" required="no" default="">

        <cfquery datasource="#application.dsn#" name="qResults" debug="yes"
result="qItemResult">
            SELECT    i.id, i.item, s.skillname
            FROM    di_item i
                    INNER JOIN di_itemItem ii ON i.id = ii.madeWithID
                    INNER JOIN di_skill s ON i.skill = s.id
            WHERE    ii.itemID = <cfqueryparam cfsqltype="cf_sql_integer"
value="#arguments.item#">
        </cfquery>
        <cfreturn qResults>
    </cffunction>



I've removed the recursive call at the end of the first function so that you
can see the thing in (sort of) action at
http://frontandback.com.au/DarkIsles/index.cfm?do=main.craftTree - select an
item such as "a wooden spool of thick thread" (the last item in the list).
It will dump out all of the things that you can make from this item, and the
things you can make from those items and so on.It will also show the item
that the thread is made from. What I need is for it to go multiple steps
back, however.

Hope this all makes sense...

Cheers,

Seona.

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaus...@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to