Re: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess

"Friedman-Hill, Ernest" <[email protected]> Wed, 11 Jul 2012 13:20:03 +0000
Newsgroups gmane.comp.java.jess
Message-ID <[email protected]>
In your setup() method, do something like

Rete engine =3D new Rete();
			try {
    engine.store("AGENT", this);
    engine.batch("ex.clp");
    Value v =3D engine.executeCommand("(assert(ACLMessage(contenu A)))");
    engine.executeCommand("(run)");
    ...

Then in Jess code, you can get access to the "Test1" object by calling

    (fetch "AGENT")

And call Java methods on that object as needed. I'm afraid I can't help
any more than that, since you haven't told us anything about what
"activating a behavior" might entail.



On 7/11/12 7:36 AM, "lyes" <[email protected]> wrote:

>Hello,
>
>I wish activate a behavior of agent from jess.
>
>Exemple :=20
>
>My class Agent
>--------------
>public class Test1 extends Agent{
>=09
>	protected void setup() {
>
>               System.out.println ("Agent " + getLocalName()+ " I am her=
e
>");
>
>               Rete engine =3D new Rete();
>			try {
>				 engine.batch("ex.clp");
>				Value v =3D engine.executeCommand("(assert(ACLMessage(contenu A)))")=
;
>				engine.executeCommand("(run)");
>			=09
>			} catch (JessException e) {
>				// TODO Auto-generated catch block
>				e.printStackTrace();
>			}
>    }
>
>
>        public class MyAction extends OneShotBehaviour {
>
>		@Override
>		public void action() {
>		=09
>			// TODO Auto-generated method stub
>
>                             System.out.println ("Agent " +
>getLocalName()+
>" I am here ");
>		=09
>		}
>	=09
>	}
>}
>
>My file ex.clp
>--------------
>(deftemplate ACLMessage  (slot contenu))
>(defrule test (ACLMessage (contenu A)) =3D> [// i wish activate behaviou=
r
>MyAction Defined in Agent java  for excute instructions//])
>
>Please Help me.
>Thank's=20
>
>
>--
>View this message in context:
>http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp=
46
>54077.html
>Sent from the Jess mailing list archive at Nabble.com.
>
>--------------------------------------------------------------------
>To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
>in the BODY of a message to [email protected], NOT to the list
>(use your own address!) List problems? Notify [email protected]=
v.
>--------------------------------------------------------------------



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected]=
.
--------------------------------------------------------------------