The other place that it might be is in the line

 (if (= (call ?u getTypeID) ?*SCV_ID*) then ...

because the "=" function does a comparison by *value*, so it would likely
use Value.getValue().

What do your ID's look like?  Are they numbers or strings, or something
else?
If they are strings, then you need to use "eq" not "=".  If they are some
object, then the type has to implement Comparable so that the value
comparison can be made.

Also, there might be some side effects of the "call" function that you keep
using.  Particularly that Jess returns coerces Arrays into lists.  Really,
you only need it for calling static methods on classes.  See the
Description for call
<http://www.jessrules.com/jess/docs/71/functions.html#call>in the jess
docs.  ".. *When calling Java methods, arguments are promoted and
overloaded methods selected precisely as for
new<http://www.jessrules.com/jess/docs/71/functions.html#new>.
The return value is converted to a suitable Jess value before being
returned. Array return values are converted to lists.* "

On Tue, Mar 13, 2012 at 1:43 AM, Hunter McMillen <mcmil...@gmail.com> wrote:

> Thanks for your response Wolfgang,
>
> Yes, getMyUnits() returns an ArrayList<Unit>; I don't believe this likely
> to be the problem since I have these in other rules that are functioning.
> More debugging shows that the error is occurring in routine
> Value.stringValue. Do you see anywhere where I am trying to get the string
> value of a list?
>
> Hunter
>
>  On Mon, Mar 12, 2012 at 9:38 AM, Wolfgang Laun 
> <wolfgang.l...@gmail.com>wrote:
>
>> Are you sure that
>>   (?*bwapi* getMyUnits)
>> returns a list?
>>
>> Jess' foreach isn't quite as tolerant as for in Java 1.5 and later.
>> You may have to return an java.util.iterator.
>>
>> -W
>>
>>
>> On 10/03/2012, Hunter McMillen <mcmil...@gmail.com> wrote:
>> > I am receiving the error in the subject line when one of my rules is
>> > firing. I can't seem to find any other forum posts about it, here is my
>> > rule:
>> >
>> > (defrule build-supply-depot
>> > (minerals (value ?x&:(> ?x 100)))
>> > =>
>> > (try
>> > (foreach ?u (?*bwapi* getMyUnits)
>> > (if (= (?u getTypeID) ?*SCV_ID*) then
>> > (bind ?p (call get-next-build-tile()))
>> > (call ?*bwapi* drawCircle ?p.x ?p.y 100 111 FALSE FALSE)
>> > (call ?*bwapi* build (?u getID) ?p.x ?p.y
>> > (UnitType$UnitTypes.Terran_Supply_Depot ordinal))
>> > (break)))
>> > catch
>> > (printout t (call ?ERROR toString) crlf)
>> > )
>> > )
>> >
>> > and here is the exact error message:
>> >
>> >         while executing (foreach ?u (call ?*bwapi* getMyUnits)
>> >                                    (if (= (call ?u getTypeID) ?*SCV_ID*)
>> > then
>> >                                    (bind ?p (call get-next-build-tile ))
>> >                                    (call ?*bwapi* drawCircle ?p.x ?p.y
>> 100
>> > 111 FALSE FALSE)
>> >                                    (call ?*bwapi* build (call ?u getID)
>> > ?p.x ?p.y (UnitType$UnitTypes.Terran_Supply_Depot ordinal))
>> >                                    (break))).
>> >
>> >   Message: '' is a list, not  a string.
>> >
>> > But the error doesn't give me a line number.
>> >
>> > Any help would be appreciated.
>> > Thanks,
>> > Hunter McMillen
>> >
>>
>> --------------------------------------------------------------------
>> To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
>> in the BODY of a message to majord...@sandia.gov, NOT to the list
>> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov
>> .
>> --------------------------------------------------------------------
>>
>>
>


-- 
*Jason C. Morris*
President, Principal Consultant
Morris Technical Solutions LLC
President, Rules Fest Association
Chairman, IntelliFest 2012: International Conference on Reasoning
Technologies
--------------------------------------------
phone: +01.517.304.5883
skype: jcmorris-mts
email: consult...@morris-technical-solutions.com
mybio: http://www.linkedin.com/in/jcmorris


<http://www.intellifest.org%20>
www.intellifest.org
Invent * Innovate * Implement at IntelliFest!

Reply via email to