Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
LordJashin

The All-In-One Beginners Guide To SCAR Divi!

Recommended Posts

The All-In-One Beginners Guide to SCAR Divi!

 

If nothing else you should definetly read this - http://wiki.scar-divi.com/index.php?title=The_Official_SCAR_Scripting_Guide

 

Table Of Contents

1. What is SCAR Divi

2. A Brief History of SCAR Divi

3. What can SCAR Divi do

4. Getting SCAR Divi on your computer

5. Hello World!

6. The SCAR Divi Interface/Macroing Development Environment

7. SCAR Divi's Include Manager & Current Includes

8. SCAR Divi's AutoCompletion/Code Hints and Selecting a Client

9. SCAR Divi's Advanced Debugging

10. SCAR Divi Full Scripting/Coding Tutorial

11. Resource Links for SCAR Divi and the forums, Tuts/Resources/etc.

 

1. What is SCAR Divi

 

SCAR Divi is a powerful macroing environment that allows users to write scripts with the goal of automating repetitive tasks on a windows based machine.

SCAR Divi supports Windows Systems only mostly being: Windows XP, Windows Vista, Windows 7, and Windows 8.

 

nDBZ5.png

 

2. A Brief History of SCAR Divi

 

"SCAR was originally created by Kaitnieks (Aivars Irmejs) in 2003 with the purpose of replacing his previous creation AutoRune, a program designed to automate tasks in RuneScape. The program rapidly evolved into a very powerful color based macroing application and was used not only for RuneScape, but also to automate other games and tasks not related to gaming. Late 2006 Kaitnieks retired from the scene and passed on the task of developing SCAR to Freddy1990 (Frédéric Hannes), who up to this day still develops SCAR. When the development was passed on, SCAR was renamed to SCAR Divi. Divi is the Latvian word for "two", as now 2 people had developed the program." So SCAR is like 10+ years old! It is very stable!

 

s2v9d.gif

 

3. What can SCAR Divi do

 

The links provided may be outdated, because SCAR Divi's wiki and tutorials/guides may not be totally up to date or complete. But I provided the ones that when "I checked", they were correct/up to date mostly.

- Uses a Pascal/Delphi syntax language that has support for Arrays, and more (See the Official SCAR Scripting Guide)

- Defines for the compiler (SCAR Divi's defines)

- Use your Keyboard and Mouse to do things for you (Mouse & Keyboard functions)

- Find images/colors on your computer screen (Bitmap/Color/dtm/etc functions)

- It has a Window API for Finding/Interacting with Windows/Programs (Window/Client functions)

- Text/font (GetTextAt/load font functions) (not documented in wiki yet)

- Integer/Boolean/Extended (decimal)/Box/Point/Colors (like clBlack)/other Types (type functions) (Arrays with these types, functions)

- Strings (String functions)

- Interact with SQLite3 databases (Database functions)

- Math (Math functions)

- ZLib Compression (Compression functions)

- Supports the use of Forms (form functions)

- MD5 Hashing (Hashing functions)

- Various Conversions for Types and Colors (Conversion functions)

- Internet, TCP, HTTP, and proxy (Internet functions)

- Hex, & Base64 Encoding (Encoding functions)

- Clipboard copy & paste (Clipboard functions)

- Time/Date/etc (Time functions)

- INI files (INI functions)

- Rewrite/Create/Delete Files/Folders (File functions)

- Regex matching (Regex functions)

- Some Sound usage (Sound functions)

- Settings (Not SCAR Divi's settings) (Settings functions)

- Command line access (See Command Line paramters)

- System (Not much) (System functions)

- Debugging (Debug functions)

 

These are the ones just listed from the wiki. There is still a lot of undocumented/not up to date things SCAR Divi can do!

- Auto completion of code with (CTRL+Spacebar)

- Code hints

- Functions to minimize, set as top, minimize to tray, and others for SCAR Divi's window

- Use functions from Windows through API Calls

- Make your own plugins (Delphi, C++, other) to extend SCAR Divi's functionality

- Print your code

- Grab colors/bitmaps from the screen with a tool

- Change the client (targeted) window's title

- Save screenshots

- Has changeable hotkeys, change image to string conversion for use in your code

- Debug & messages box, color history, function list, and target client information

- Form & DTM Editor

- Find & replace code

- Step by Step debugging has variable list

- Up to date coordinates in the bottom left hand corner based on the client (targeted) window

- go to line numbers, change highlighted colors

- Updating

- Built in Firewall

 

And much more to offer.

 

4. Getting SCAR Divi on your computer

 

No SCAR Divi does not contain any malware, or viruses and anything that says so is a false positive. I've had SCAR Divi for a long time,

I've had no problems, and usually my anti virus has no problems with it either. You might have to add it to your "exceptions" list if it bothers

you or doesn't allow you to use SCAR Divi.

First download SCAR Divi from http://www.scar-divi.com or http://www.scar-divi.com/?page=download then install it on your windows based system.

 

If you need help follow my tutorial on Downloading & Installing SCAR Divi.

Or watch Freddy's (the creator of SCAR Divi)

 

5. Hello World!

 

Run this code in SCAR Divi to produce your first Hello World for SCAR Divi!:

 

[scar]

program New;

begin

WriteLn('Hello World!');

end.

[/scar]

 

You should see Hello World! in the Debug Box:

 

voZGE.png

 

 

 

6. The SCAR Divi Interface/Macroing Development Environment

 

88pf0.png

 

Click to enlarge the image and learn all the parts to the SCAR Divi interface!

 

That covers most of the basics. But then we have the menu bar (File, View, Tools) and all of those buttons. I will only cover the buttons under the Tools tab as the rest should be self explanatory

 

baugX.png

 

The Tools menu offers a variety of things to help you out.

1. You can Redefine SCAR's built in keyboard shortcuts (or hotkeys)

2. Save a screenshot

3. Pick Color and Pick Bitmap, again as seen on SCAR's toolbar

4. Convert a Picture to string (only Bitmap pictures I think to a String for use in your script)

5. String to Picture (a string from SCAR, not sure if legacy strings from SCAR 3.34 or before are supported?)

6. Update Bitmaps, I think this updates your bitmap strings to the new string method (better)

7. DTM Editor, this is for use with using DTM functions such as FindDTM, and etc.

8. Form Editor, to make forms for use with SCAR Divi

9. Explore all the folders inside the SCAR Divi Root folder

10. Associate .scar files with SCAR Divi

11. Export the script to an HTML web page

12. Options (these are the options for SCAR Divi)

 

SCAR Divi's Hotkeys (shortcuts):

CTRL + N : New Script

CTRL + O : Open Script

CTRL + S : Save Script

CTRL + T : New Tab

CTRL + W : Close Tab

CTRL + Alt + W : Close All Tabs

CTRL + F : Find text

F3 : Find next

F7 - Step Into (debugging)

F8 - Step Over (debugging)

CTRL + R : Replace text

Shift + Control + i : Indent text

Shift + Control + u : Un-Indent text

CTRL + G : Go to line number

CTRL + M : Minimize SCAR to system tray

CTRL + C : Copy text

CTRL + X : Cut text

CTRL + V : Paste text

F1 : To open the SCAR Divi Online Manual (wiki.scar-divi.com)

 

The rest of the hotkeys you can redefine yourself, here are the defaults:

 

rBDRT.png

 

Settings box for SCAR Divi

 

bvhU8.png

 

In there you can change settings for

1. The Editor and its highlighting

2. The Firewall

3. Use API Calls in SCAR Divi

4. misc, and more stuff

 

7. SCAR Divi's Include Manager & Current Includes

 

SCAR Divi's Include Manager reachable by (File->Include Manager in SCAR Divi):

 

krXXK.png

 

You can Install/Remove/Update Includes that will install themselves into SCAR Divi's Includes folder

which is reachable by going to Tools->Explore->Includes Folder. Once Installed you can use some of

the functions provided by these includes. But you need to include the files in your script. This is why they

are called includes because you include them into your script on SCAR Divi to use that include or library.

In order to learn about this, and use this. Go to the SCAR Divi Full Scripting/Coding Tutorial section on this page.

Freddy's tutorial on using the Includes Manager.

 

Current Includes offered and what they provide:

 

OSI - Official SCAR Include: This provides tons of functionality & tools for SCAR Divi! But this is mainly geared toward automation of a

popular game called Runescape®.

Created By: Wanted.

OSI Wiki: wiki.scar-divi.com/osi

OSI Repository on Github: https://github.com/OSI1/OSI1

OSI Repository on SCAR Divi website: http://svn.scar-divi.com/osi/

 

MSSL - Massive SCAR Scripting Library: This provides tons of functionality for SCAR Divi as well. Much

more than OSI but it still needs more documentation, and hasn't reached version 1 yet. Needs some work.

Created By: Janilabo

SVN Repository located here: http://svn.scar-divi.com/mssl/

 

GMRL - Game Macro Resource Library: Has some nice plugins for SCAR Divi to extend functionality but its

main proponent SPS is currently not working.

Created By: ShadowRecon

SVN Repository: http://subversion.assembla.com/svn/gmrl/

 

There's others, but most aren't updated/worth mentioning.

 

8. SCAR Divi's AutoCompletion/Code Hints and Selecting a Client

 

In SCAR Divi you have one way to auto complete code, and give Code hints to you about parameters. Place your cursor and click

inside of the editor. Code hints are seen when you put the first left parentheses when using a function/procedure, and the parameters of the function will be shown.

 

Shortcuts:

CTRL+Space: Brings up the auto completion list

- Up and Down Arrows: will move up and down the list for you

- Enter: With the auto completion list open, hit Enter to auto type the highlighted item for you

- . A period to open an Objects list of variables/functions/other

 

Bringing up the auto completion list with CTRL+Space, using Enter and Up and Down arrows:

 

iPT9N.gif

 

Using a period to open Objects list of variables with Auto completion:

 

aYNgh.gif

 

Using Code Hints:

 

2MXLk.gif

 

Selecting a client with the crosshairs in SCAR Divi:

 

pzNmJ.gif

 

9. SCAR Divi's Advanced Debugging

 

If you pause your script while it is running with the Pause Script button - PwU1S.png

Your SCAR Divi should look like this. SCAR Divi Debugging Interface:

 

AeMon.png

 

Click to enlarge the image and learn all the parts to the SCAR Divi Debugging Interface!

 

 

When your Script in SCAR Divi is paused the Pause button will be dimmed because the Script cannot be paused again if it is already paused! StepInto and StepOver, will move the blue line down, so you can go through your script a Step at a time. StepInto will go into functions and procedure if it runs into them on the blue line. StepOver will go over the functions and procedures called and not go into them.

 

There is also a way to set Break Points. Where your script will automatically stop at that break point! You can have several Break Points as well. How to make a break point:

 

XhBqQ.png

 

Also note if you right click inside the editor you can add Bookmarks to specific lines:

 

7z9Gd.png

 

If you need help, check out Freddy's (the creator of SCAR Divi)

 

10. SCAR Divi Full Scripting/Coding Tutorial

 

Read The Official SCAR Scripting Guide!

 

zDeUi.png

 

This is an error from SCAR Divi!

You need to know what the errors are and what they mean.

Freddy's FAQ on Errors

 

Things Not Covered in the Official SCAR Scripting Guide:

- Tons of things including procedures, and functions

- Including files, and Compiler Directives

- forwarding, and API calls

- etc.

 

Procedures:

 

[scar]

program New;

 

procedure WriteIt(Text: string);

begin

WriteLn(Text);

end;

 

begin

WriteIt('Passing a string into writeIt''s text parameter!');

end.

[/scar]

 

Procedures always start with the procedure bolded keyword.

So format: procedure NameOfProcedure(Parameter declarations);

Format without params: procedure NameOfProcedure;

Procedures always go in the head of the script. (Before the main loop or the begin end. block)

But when you want to use a procedure, you call it and you might have to pass params into it. You can do

this inside of other procedures/functions after that procedure or in the main loop.

 

Functions:

 

[scar]

program New;

 

function WriteIt(Text: string): string;

begin

WriteLn(Text);

Result := 'stringgggggggggggggg result';

end;

 

begin

WriteIt('booooooooo');

end.

[/scar]

 

Functions always start with the function bolded keyword.

So format: function NameOfFunction(Parameters): TypeOfResult;

Format without params: function NameOfProcedure: TypeOfResult;

Functions always go in the head of the script. (Before the main loop or the begin end. block)

But when you want to use a function, you call it and you might have to pass params into it. You can do

this inside of other procedures/functions after that function or in the main loop.

Note: The Result variable is set to a string. We said that the result of the function would

be a string! So thus the result variable has to be set to a string in this case!

You don't have to use the Result variable if you don't want to. But then your function would be

just like a procedure, it would return no value!

Functions return a value or values set by the result variable inside of the function!

So I could set a string variable to store the value returned by the WriteIt function!

 

Just remember that in the head section of the script. The order of things matters! If something tries to call a function

that isn't declared until later in the script. It will throw an error!

 

Including files and using Defines (Compiler Directives):

 

You can include SCAR files into your script as libraries of code. Inside of the include file

Just remember that in the head section of the script. The order of things matters! If something tries to call a function

that isn't declared until later in the script. It will throw an error!. There is no begin end. block

inside an include, because they are meant to be included for use in your script not to run a script!

 

[sCAR]

program New;

 

{$DEFINE Testing}

{$I Test/Test.scar}

 

function WriteIt(Text: string): string;

begin

WriteLn(Text);

 

end;

 

begin

WriteIt('booooooooo');

end.

[/scar]

 

{$DEFINE NameOfDefine} This is the format for defining something! Like Freddy has defines for SCAR Divi, for different versions!

Freddy's defines for SCAR though are already active depending on your SCAR version

Then you have {$IFDEF} {$ENDIF} {$ELSE} and others to use like you could do:

{$IFDEF Testing}. Note: that compiler defines can go just about anywhere in the script including the Main Loop!

{$I Test/Testing.scar} This line will look to see if there is a folder inside SCAR Divi's includes folder called Test. And

tries to include the functions and procedures from the Testing.scar file. Remember this goes by what SCAR Divi has set

for its includes folder: SCAR Divi's Includes Folder/Test/Testing.scar

Same rules of ordering apply to including files as well!

 

-- Will add more to this later

 

11. Resource Links for SCAR Divi and the forums, Tuts/Resources/etc.

 

SCAR Divi Forums:

1. SCAR Divi Forum Rules

2. BB Code List

3. Tutorial Section

 

SCAR Divi:

1. SCAR Divi Wiki page

2. The Official SCAR Scripting Guide

3. SCAR Divi Change Log

4. SCAR Divi Development Roadmap

5. SCAR Divi Bug Tracker

6. SCAR Divi SVN

7. SCAR Titan SVN

8. SCAR Divi Download Page

9. SCAR Divi Current Download Archive (some)

10. SCAR Old Website before SCAR-Divi.com

11. Old SCAR Divi Download archive (pre~3.23)

12. List of Virtual Key Codes

 

-- Will add more to this later

~WIP

 

If any of the links are broken, or you need help, feel free to private message me, and I might help you, but I will definitely private message you back.

 

~LordJashin

Edited by LordJashin
  • Like 1
  • Confused 1

Share this post


Link to post
Share on other sites

Woah LJ!! :P Really good job with this guide.

It's 1 of the best guides I have ever seen for SCAR (and probably the best for Divi!)

 

Wish I could rep+++ you of this, but I need to spread more before I can do it, arrrarrrargh. :(

 

-Jani

Share this post


Link to post
Share on other sites

Thanks,

 

lucky the line limit wasn't lower. If it was like 5000-10000 lower I would've been sol

max thread line limit is like 25k

Share this post


Link to post
Share on other sites

This is the best start I could've done. However I would like this to look better. Best format I good get on this vbulliten. We still need more tutorials.

 

I'm going to start making my first script for OSI.

 

Gonna call it: OSI Bone Burier for rs2

 

that and me and Janilabo are going to make an efficient logging system. We should build into it everything imaginable. Screenshots too.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...