I'm trying to add a scripting capabilty to my C++ Builder Windows app that will allow users to create and run scripts written in Basic. I'm using C++ Builder R12 and TMS Scripter v7.36. I am new to Scripter and have rudimentary knowledge of Delphi but have been using C++ Builder since R1.
I provide the user interface - the scripts do not need to create their own forms. TatBasicScripter appears to be adequate for what I need & I have everything working well except for watchlists. Users can single-step etc but I haven't been able to figure out how to access variables defined in the user's script. There's a sample program in the demo folder ...demos\basic\debugger that refers to a watchlist but doesn't seem to actually implement one.
The scripter manual states that user vars defined with a "DIM" statement will be considered global. I'm using OptionExplicit = true which then requires that declaration.
I tried using IDEEngine along with the IDEWatchList component but that doesn't like tying into TatBasicScripter. And attempts to use a script component other than TatBasicScripter fail to accept a script in Basic. I saw an older reference to that issue but the suggested workaround didn't work.
I also tried the ScriptInfo->Variables and ScriptInfo->Globals properties.
I've looked through everything I could think of for an example of accessing a script variable from the "host" program and found a few suggestions but all seemed to refer to earlier versions of Scripter. I'm sure I'm missing something obvious here.
Hello @Coelho_John, welcome to TMS Support Center!
Correct. You should be using TIDEScripter for that, which I recommend, thus you can use the Scripter IDE and all the features that come with it, including watch list.
If they are declared above all the declaration of all sub functions.
In this case you should explicitly tell the component you are using Basic language, by clearing all scripts and then adding a new script in Basic syntax.
Maybe you can provide a simple example of a script and the code you are trying to use, is there a chance your script variables are not global?
Are you able, for example, to access the list of functions declared in the script?
Thank you for the response. I will try using TIDEScripter again and will respond again when I have some results. I am using about 25 methods of my own via Script->DefineMethod, so my Basic-language examples don't look too much like typical Basic programs.
The Basic script is:
DIM A
DIM B
A = 1
B = 5
A = A + B
ShowMessage(A)
Scripter reports a syntax error on the first '=' character. If I replace that with := then the error moves ot the next line. This leads me to believe that the script is being interpreted as a Delphi program. i suspect I'm missing something simple here.
(I looked through the samples but all
of the samples showing scripts written in Basic use TatBasicScripter).