SRL Archive - Outdated Tutorials

Not-so-well known SCAR shortcuts.


Macro_FTW

2009-06-19 18:53:49

Hello, and welcome to my tutorial. :D

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. :p

If you are stuck as to which function to use, then press F1 while SCAR is open [and selected, obviously. :rolleyes:]. 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:

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! :D

Have to move 100 lines of code ahead 2 spaces? Going insane about it? You have 2 options.


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! :)

Coh3n

2009-06-19 21:19:33

Nice work, there were actually a couple things in there I didn't know about. XD I'm sure this will help a lot of people :)

Rep+ :)

noidea

2009-06-19 21:23:32

I figured out the ab thing once, but forgot. nice guide.

Macro_FTW

2009-06-19 22:21:39

Thanks to both of you. ^_^

~Macro_FTW

Sabzi

2009-06-25 17:24:49

CTRL + SHITF + I will always intend selected code one and CTRL + SHIFT + U is the same back. I am using this always. Found in:
http://www.villavu.com/forum/showthread.php?t=3293
I knew all of it from others siggys :D, nice tut though.
Rep+

Da 0wner

2009-06-25 17:34:18

Most of these are well-known. But I've known about all of them for a while :p.

Macro_FTW

2009-06-25 23:48:05

From: Sabzi
CTRL + SHITF + I will always intend selected code one and CTRL + SHIFT + U is the same back. I am using this always. Found in:
http://www.villavu.com/forum/showthread.php?t=3293
I knew all of it from others siggys :D, nice tut though.
Rep+

Thanks. Added your suggestion. :D

From: Da 0wner
Most of these are well-known. But I've known about all of them for a while :p.

Meh, if a few people learn a few new things, it was worth it anyway. :p

~Macro_FTW