Not-so-well known SCAR shortcuts.
Hello, and welcome to my tutorial.
This is just a short tutorial on shortcuts/little known things in SCAR scripting/macroing to hopefully make things easier for you.
With that, let's begin!
I. Extensive Codehints.
Can't think of that procedure or function that you were going to put in your script? Don't know if it was FindTPA or FindTPAs? Don't want to search through 4-5 threads just to find it? Here's your shortcut!
Pressing ctrl+space in SCAR opens up a list of every function you can possibly use at that point, including the functions in your includes. (So if you've included SRL and Reflection, the list will contain all SRL and Reflection procedures/functions.) Not only that, but as you type a name, the list will get smaller; only containing procedures/functions starting with whatever you're typing.
Another small trick with this: you can click/press enter and the highlighted procedure is typed in automatically for you. This, as some can imagine, is helpful in quite a few cases. (It's far nicer to do ctrl+space, then type in RS_GetComp+enter than RS_GetCompassAngleDegrees)
II. The Wonderful Land of Oz
...Or the wonderful land of SCAR's API. Either one works.
If you are stuck as to which function to use, then press F1 while SCAR is open [and selected, obviously. ]. This brings up the SCAR API, which has most, if not all, of SCAR's built-in functions. These include the function header, which- for example- is:
function FindDeformedBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
Or whatever procedure's header you're looking for.
It also includes a description of the method, such as:
Works similar to FindBitmapToleranceIn but allows searching for partially covered or transformed bitmaps. If range is 0, it checks pixels at positions that match bitmap we are looking for; if Range is 1, it checks neighbor pixels as well, if range is bigger, it checks further. AllowPartialAccuracy allows accuracy that is not 100% match. accuracy returns accuracy of found bitmap to bitmap we are looking for. accuracy = 1.0 means it was 100% perfect match.
III. HotKeys
Simple hotkeys section.
To run a script, Ctrl + alt + R
To pause a script, Ctrl + alt + A
To stop a script, Ctrl + alt + S
To pick a color on the screen, Ctrl + alt + P
...Which can all be changed under tools -> redefine hotkeys
IV. Ms. Tabby. (I have no idea why I named this section that. O.o)
Ever had to indent about 100 lines of code by 4-6 spaces? I have. It is NOT fun. So, to help ease this pain, tab tricks shall be shown.
a. Getting 'up to speed'. If your current line is at an indent of 2 spaces, and it's supposed to be at 10 spaces, have no fear. You don't need to spam the space bar multiple times; the tab button brings your indent to the nearest indent in the current procedure that is greater than your current one. So, if I had the most incorrectly formatted minimethod [method, procedure, same thing] possible right here:
SCAR Code:
procedure MiniMethod;
begin
writeln('hi');
if(2<9)then
begin
writeln('I write good.');
end;
If you wanted to get writeln('I write good'); flush with begin, then you would tab three times (first to be with if(2<9)then, second to be at writeln('hi')/end;, third to be at begin), as opposed to spamming the "space" key like a squirrel on caffene. No offense intended to the squirrels of the world.
b. Mass moving. This is where you love the tab key forever and ever and ever and ever!
Have to move 100 lines of code ahead 2 spaces? Going insane about it? You have 2 options.
SCAR Code:
for Iterator:=0 to 100 do
begin
Click on line[i];
Press space twice;
end;
Which can take a few minutes...
Or, you can highlight the text and press 'tab' once. This brings ALL of the highlighted code up 2 spaces. This takes 10 seconds. [The same can be applied to moving the code back; Tab+Shift takes it back 2 spaces.]
Sabzi - Ctrl+Shift+I / Ctrl+Shift+U also work for indenting/unindenting code.
And that's about it for this short tutorial. If anyone wants to add anything at all, I will give you full credit and more than happily put it in the post. Happy scripting/macroing!
Last edited by Macro_FTW; 06-26-2009 at 03:47 AM.
Current Project: Catching up. XD. Potentially back for the summer, depending on how things go.