There are three ways to initiate acting. The first is by use of the SNePSUL command perform.
(perform
actnode context-specifier)
Causes the actnode to be performed. Deductions and
assertions triggered during the performance will be made in the
specified context.
* (perform (build action say object1 "Hello" object2 "there")) Hello there CPU time : 0.15(How the say action is defined will be explained below.) The other two ways to initiate action are during inference:
* (describe
(assert whenever (build agent Stu state is location here)
do (build action say object1 "Hello" object2 "Stu.")))
(M3! (DO (M2 (ACTION SAY) (OBJECT1 Hello) (OBJECT2 Stu)))
(WHENEVER (M1 (AGENT STU) (LOCATION HERE) (STATE IS))))
(M3!)
CPU time : 0.04
* (describe
(assert when (build agent Stu state is location here)
do (build action say object1 "I see" object2 "you're here.")))
(M5! (DO (M3 (ACTION SAY) (OBJECT1 Hello) (OBJECT2 Stu)))
(WHEN (M2 (AGENT STU) (LOCATION HERE) (STATE IS))))
(M5!)
CPU time : 0.03
* (add agent Stu state is location here)
Hello Stu
I see you're here
CPU time : 0.06
The difference between when and whenever is that if the
proposition p is disbelieved (see below) and
readded, the act controlled by whenever will be performed
again, but the act controlled by when won't.
* (perform (build action disbelieve
object1 (build agent Stu state is location here)))
CPU time : 0.18
* (add agent Stu state is location here)
Hello Stu
CPU time : 0.02
* (describe (assert if (build agent who state is location here)
do (build action say object1 "Who's" object2 "here?")))
(M7! (DO (M6 (ACTION SAY) (OBJECT1 Who's) (OBJECT2 here?)))
(IF (M5 (AGENT WHO) (LOCATION HERE) (STATE IS))))
(M7!)
CPU time : 0.19
* (deduce agent who state is location here)
Who's here?
CPU time : 0.12