Page 1 of 1

Program generated logic statements? - Solved

Posted: Sun Jul 19, 2020 9:10 pm
by DR White
I attached a very simple example of what I am trying to do.

I am trying to write a program which generates logic statements.
But, after several hours, I have had no progress.

Maybe someone can help?

Thanks,

David

Re: Program generated logic statements?

Posted: Sun Jul 19, 2020 10:09 pm
by bn
Hi David,

I tried this with merge. Maybe that works for you. And maybe there are easier ways of doing this.

(I moved the scriptLocal variable into the handler for testing reasons so I have no remnants from previous runs)

Code: Select all

on mouseDown pButtonNumber
   local MasterLogic, MasterLogicTest
   put ("[[" & "i41_00" & "]]" & " and " &  "[[" & "i51_01" & "]]") into MasterLogic 
   put "true" into i41_00
   put "false" into i51_01
   
   put merge(MasterLogic)into MasterLogicTest
   
   -- test MasterLogic for a true ststement, as varables i41_00 and i51_01 change 
   -- But, the contents of MasterLogic which is ("i41_00" & " and " & "i51_01") must not change
   
   put the value of MasterLogicTest into temp -- temp contains logical value
   
   
   --- just a stop point to check value of MasterLogicTest
   put 1 into x
   
end mouseDown
Kind regards
Bernd

Re: Program generated logic statements?

Posted: Sun Jul 19, 2020 10:53 pm
by DR White
Bernd,

That works GREAT!!

I thought there was a function like "merge", but I did not know the name of the function and could not find that type of function in the dictionary.

The LC forum is the BEST,

David

Re: Program generated logic statements? - Solved

Posted: Sun Jul 19, 2020 11:02 pm
by bn
Thanks David,

I just simplified "MasterLogic". I don't use merge often and I made it too complicated.

Code: Select all

put "[[i41_00]] and [[i51_01]]" into Masterlogic
Works just as well and is a lot easier.

Kind regards
Bernd