« Return to Thread: JESS: global variable comparisons with = and <>

Re: JESS: global variable comparisons with = and <>

by Chirag Vesuvala :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
Thanks Ana and Ernest,
It works now as it should!

/Chirag

On 29/03/2008, ANA TANASESCU <atanasescuro@...> wrote:
Hello again,
 
I followed Ernest's advice and I have modified your program. The only thing that I have done is that I put the test CE after the pattern matching.
 
Here it is the modified program:
 
(
reset)
(
defglobal ?*currentOpenToolbar* = MasterToolbar)
(
deftemplate toDisplayToolbar
(
slot toolbar)
(
slot visible))
 
(
defrule 1stTime
(
toDisplayToolbar (toolbar ?toolbar) (visible ?v&:(eq ?v TRUE)))
(
test (= ?*currentOpenToolbar* MasterToolbar))
=
>
(
printout t "1st Time" crlf)
(
bind ?*currentOpenToolbar* ?toolbar)
(
printout t "?*currentOpenToolbar is now " ?*currentOpenToolbar* crlf))
 
(
defrule SubsequentTime
(
toDisplayToolbar (toolbar ?toolbar) (visible ?v&:(eq ?v TRUE)))
(
test (<> ?*currentOpenToolbar* MasterToolbar))
=>
(
printout t "Not1stTime" crlf)
(
bind ?*currentOpenToolbar* ?toolbar)
(
printout t "?*currentOpenToolbar is now " ?*currentOpenToolbar* crlf))
 
(
watch all)
(
assert (toDisplayToolbar
(
toolbar PenToolbar)
(
visible FALSE)))
(
run)
(
assert (toDisplayToolbar
(
toolbar PenToolbar)
(
visible TRUE)))
(
run)
(
assert (toDisplayToolbar
(
toolbar Anothertoolbar)
(
visible TRUE)))
(
run)


Best regards,
Ana Tanasescu


OMG, Sweet deal for Yahoo! users/friends: Get A Month of Blockbuster Total Access, No Cost. W00t


 « Return to Thread: JESS: global variable comparisons with = and <>