evaluate the "it" variable in an external
alex at mindlube.com
Mon Dec 22 01:58:56 EST 2003
On Dec 21, 2003, at 11:30 PM, Mark Wieder wrote:
> Sorry - I thought you were having problems getting the "it" variable
> from your external, so I figured the easiest thing to do was to put
> the answer in a global variable and retrieve it that way. Maybe I'm
> misunderstanding your question.
> Obviously I don't see all the code context here, but I would think
> that a better way to do this would be to get the user input from
> Transcript, then make a call into the external, passing the user
> string as an argument.
My external is for the CLIPS expert system engine that has it's own
programming language and can fire various messages and events within
it's own environment. On the transcript side, it isn't known ahead of
time that user input will be required. The transcript controlling the
external just looks something like:
clipsEval "(load other state of model)"
put clipsRun() into tNumberOfRulesFired
During clipsRun(), a C XCMD, the CLIPS engine runs for a bit and
decides what actions to take, which could possibly involve getting more
responses from the user, but maybe not.
CLIPS does have a messaging model and I can use messages to hand off
control back to transcript, get user response, and then call an XCMD
again to push the user response back into CLIPS. I've done that before-
and it works fine for *some* situations.
But the situation I'm working on now are the CLIPS functions (read) and
(readline) which simply get keyboard input in STDIN in a command-line
app. There is no equivalent thing in a Rev GUI app, I think, and so I
am writing a CLIPS user function that requests the Rev engine to popup
a dialog and ask the user for some input.
What I originally tried to do was these various failed attempts at
directly getting the it value from the external, which was what I was
SendMCMessage("ask info \"your input\"", &retval);
response = GetVariable("it", &retval); // nothing
response = GetGlobal("it", &retval); // nothing
SendMCMessage("ask info \"your input\"; put it into tmpVar", &retval);
response = GetVariable("tmpVar", &retval); // nothing
I hope this explains why I'm doing such a bizarre thing trying to get
the it variable back into my external. :-)
Alex Rice <alex at mindlube.com> | Mindlube Software |
what a waste of thumbs that are opposable
to make machines that are disposable -Ani DiFranco
More information about the Use-livecode