class Call_IntentionAction extends IntentionAction { canHandle(intention:Term, ai:RuleBasedAI) : boolean { if (intention.functor.is_a(ai.o.getSort("verb.call")) && intention.attributes.length == 3) return true; if (intention.functor.name == "#not" && (intention.attributes[0] instanceof TermTermAttribute) && (intention.attributes[0]).term.functor.is_a(ai.o.getSort("verb.call")) && (intention.attributes[0]).term.attributes.length == 3) return true; return false; } execute(ir:IntentionRecord, ai:RuleBasedAI) : boolean { this.ir = ir; let intention:Term = ir.action; let requester:TermAttribute = ir.requester; // execute the memorize action: console.log(ai.selfID + " call: " + intention); if (intention.functor.name == "#not") { intention = (intention.attributes[0]).term; // ask about the name of the character: let question:Term = Term.fromString("perf.q.query("+requester+", X, name("+intention.attributes[1]+",X))", ai.o); let action:Term = new Term(ai.o.getSort("action.talk"), [intention.attributes[0], // this is "self" new TermTermAttribute(question)]); ai.intentions.push(new IntentionRecord(action, null, null, null, ai.timeStamp)); ir.succeeded = true; } else if (intention.attributes[2] instanceof ConstantTermAttribute) { // see if we were waiting for an answer to this question: if (requester instanceof ConstantTermAttribute) { let context:NLContext = ai.contextForSpeakerWithoutCreatingANewOne((requester).value); let pattern1:Term = Term.fromString("perf.q.query("+requester+", X, name("+intention.attributes[1]+",X))", ai.o); let pattern2:Term = Term.fromString("perf.q.predicate("+requester+", verb.know($PLAYER,#and(#query(Y), name($PLAYER,Y))))", ai.o); for(let i:number = 0;i"; } static loadFromXML(xml:Element, ai:RuleBasedAI) : IntentionAction { return new Call_IntentionAction(); } }