Hello,

I have two templates:
(deftemplate room
  (slot name)
  (multislot exits)
  (slot button))

(deftemplate exit
  (slot name)
  (multislot rooms)
  (slot x (default 0))
  (slot y (default 0))
  (slot heading)            ;into corridor (from first to last)
  (slot open (default YES))
  (slot found (default NO))
  (slot button)
  (slot id(default 0)))

I read in a fact file of rooms and exits, and I then generate a map of 
buttons for each.  I try to store the button external reference in the 
"button" slot, and I think I am successful, but there is an unexpected side 
effect.  Just before the suspected modify statement, if I printout the x and 
y values, the are all zero as they should be.  However, when I check (at 
;here) the x values have become external references to buttons.  Why?
Here's the rule:
(defrule create-mapPanel (declare (salience 20))
  (mode initialize)
  (map (nodes $?nodes)(width ?w)(height ?h))
  ?fact <- (create-map)
  =>
  (bind ?*mapPanel* (new Panel))
  (set ?*mapPanel* layout (new GridLayout ?h ?w))
  (foreach ?node $?nodes
    (if (or (eq "R" (sub-string 1 1 ?node)) (eq "H" (sub-string 1 1 ?node)) 
(eq "N" (sub-string 1 1 ?node)))
      then (bind ?e (run-query get-room-fact ?node))
      else (bind ?e (run-query get-exit-fact ?node)))
    (while (?e hasNext)
      (bind ?token (call ?e next))
      (bind ?factid (call ?token fact 1)))
    (modify ?factid (button (bind ?*b* (new Button ?node))))            
;modify that causes unexpected change
    (if (eq "D" (sub-string 1 1 ?node))                             ;here
      then (printout t ?node "-")                                   ;here
           (printout t " x=" (call ?factid getSlotValue "x"))               
;here
           (printout t " y=" (call ?factid getSlotValue "y") crlf))         
;here
    (if (eq NULL ?node)
      then (?*b* hide)           
      else (?*b* addActionListener (new ActionListener 
room-prompt-button-handler (engine))) 
           (?*b* setBackground (get-member java.awt.Color white)))
    (?*mapPanel* add ?*b*))
  (retract ?fact)
  (assert (need-gui)))             



---------------------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to