I am trying to make Pascal/Delphi "Units" for my scripts to use, but I think I don't understand the workflow in Stealth Client.
These are my questions:
- How does the compiler find "Unit" scripts when I reference them in the "Uses" statement?
- How do you troubleshoot Units? How am I supposed to compile or validate Units?
You can stop reading here if you like, but in case it helps, here are the details:
My Stealth Client version is v8.10.2 and I am running it on 64-bit Windows 7.
I wrote a Program script and a Unit like so:
Code: Select all
// Comments
// ...
// Comments
Program SpeedLooter;
Uses
SpeedLooterLib;
...
Code: Select all
Unit SpeedLooterLib;
interface
...
I have tried it with SpeedLooterLib.pas in Scripts\, then in Scripts\Uses\, and I get that same result every time.Compiler: [Error] at (21:2): Unit 'SpeedLooterLib' not found or contains errors
So I wondered if it was "not found" or if it "contains errors".
I've put it in the places I expect and named it as described in the docs. I try to investigate the "contains errors" possibility next.
I loaded the SpeedLooterLib.pas script as the active script and tried to compile/run it. The compiler gave me this error:
To exclude the possibility that I just don't understand Pascal syntax well enough, I try the same thing with the example files that came with Stealth Client in the Scripts\Uses\ folder. I get the same result:Compiler: [Error] at (1:1): 'BEGIN' expected
That experiment seemed important, so I took a screenshot:Compiler: [Error] at (1:1): 'BEGIN' expected
If that doesn't work, here's a Google Photos link:
https://photos.app.goo.gl/qTDRzDB6WoFszGpC7
Now if I replace the above SpeedLooter program with this:
Code: Select all
// Comments
// ...
// Comments
Program SpeedLooter;
Uses
CheckSave;
...
First, this suggests to me that it is possible to use Units (at all). I wasn't sure up to this point. It also suggests to me that the compiler CAN find files in the Scripts\Uses\ directory. That makes it seem more likely that the compiler IS actually finding the SpeedLooterLib.pas file/Unit when I try to use it.
I'd like better confirmation, hence why I asked, "How does the compiler find "Unit" scripts when I reference them in the "Uses" statement?"
By process of elimination, and assuming the "not found or contains errors" message is accurate, then my SpeedLooterLib unit has errors in it (and CheckSave.pas does not). However, I can't find out what they are.
If I try to compile or run ANY "Unit" file, the compiler will give me the "'BEGIN' expected" error. So this doesn't tell me what's wrong.
If I try to compile or run a "Program" script that "Uses" a unit, then it will give me the "Unit 'BlahBlahBlah' not found or contains errors" error. This tells me that something is wrong, but not what.
In either case, I can't get the compiler to proceed deeper into the SpeedLooterLib file and tell me where my mistakes are. Hence my other question, "How do you troubleshoot Units?"
Thank you!
- Chad