The asterisks are part of the defglobal's name. You're not comparing to the
defglobal: you're binding the value in the slot to a new variable. It's not
legal to negate such a constraint in its first use, as the error message said.
You need to use
(unit (ID ?id) (typeID ?typeID) (player ~?*PLAYER_ID*))
From: Hunter McMillen <mcmil...@gmail.com<mailto:mcmil...@gmail.com>>
Date: Wed, 11 Jan 2012 14:38:31 -0500
Subject: JESS: [EXTERNAL] How to negate a variable when in lhs of a rule
I am trying to differentiate between Objects that belong to a certain user
inside two of my rules.
I have a variable created from Java like this:
engine.getGlobalContext().setVariable("PLAYER_ID", new Value(player.getID());
And I want to use this variable in rules to determine which objects belong to
This rule works fine when just using ?PLAYER_ID
(unit (ID ?id) (typeID ?typeID) (player ?PLAYER_ID))
But when I try to negate the variable I get an error, "First use of variable
(unit (ID ?id) (typeID ?typeID) (player ~?PLAYER_ID))
How can I specify anything other than ?PLAYER_ID on the lhs of a rule?