SRL Archive - General

A Guide on the MSI Core!


Coh3n

2010-04-22 18:25:18

A Guide on the MSI Core!

Where all your questions will be answered…


Introduction:

  • This guide will outline and explain, in detail, each MSI core function individually. It was written by all the SL's, so you may notice a difference in writing style from time to time. If something is unclear, please post and one of us will update it. :)
  • Feel free to post about any questions you may have.

MSI Logs/
  • This folder will contain a .txt file or .txt files, which contain the debug text of the script at a certain time. This will have been written by the function in Debug.Scar called MSI_SaveLog;.
  • A new log is created each time the script is run.
  • Please Note: If you have not run the script yet or have just checked out, then this folder will have no logs.


MSI Progress Reports/
  • This folder will contain .txt file(s) of progress reports when using the script. It will save them under the file containing the date it was saved; this in turn will contain the times each progress report was written at. This will be written to the folder by the function: MSI_PrintSave(FileH, S : String);
  • Like the debug logs, a new text file will be created after each script start.
  • Please Note: If you have not run the script yet or have just checked out, then this folder will have no Progress Reports.

Skills/
  • This folder contains all the .scar/.simb files related to different skills in RuneScape. These files then contain functions and procedures related to that skill. For example MSI_WaitWhileChoppingEx; in Woodcutting.scar.
  • Visit this tutorial for a more in depth guide of all Skills/functions/procedures

The Core

Antiban.scar

  • procedure MSI_AntiBan(HowLong, ChancePerc: Integer);
  • {******************************************************************************}
    { Procedure MSI_AntiBan(HowLong, ChancePerc: Integer); }
    { By: Naum, edited by Coh3n, RM & Zyt3x }
    { Description: The AntiBan procedure to be used throughout the scripts. }
    {******************************************************************************}
    • This procedure will call the antiban feature. This includes: moving the mouse randomly in an arc-type style, examining inventory items using the 'examine' options, randomly changing to GameTabs and waiting before changing back, randomly right clicking for a few seconds, moving the compass to a random angle then moving it back and doing nothing.
    • This procedure uses two parameters; HowLong and ChancePerc which only accept whole numbers because they are integer data types. 'HowLong' dictates how long the antiban should last, in milliseconds e.g. 2000. Low times in the range of 0 to 5000 are recommended for use whilst walking, any thing more for other things.
    • The second parameter 'ChancePerc' is the chance out of 100 for antiban to be performed. Something adequate like 50 percent should be used for mediocre antiban usage, anything above or below that depending on what you want to do. The constant used for 'ChangePerc' is in Globals.scar and is called: ANTI_BAN_CHANCE. This is pre-defined to 10, thus meaning 10 times out of 100 it will perform antiban when used in MSI or any other script.
    • Usage:
      MSI_AntiBan(5800, 50);
      This performs antiban for 5.8 seconds if the probability of 50% chance is met (ChancePerc).
  • procedure MSI_FindRandoms;
  • {******************************************************************************}
    { procedure MSI_FindRandoms; }
    { By: Coh3n }
    { Description: Checks for random events }
    {******************************************************************************}
    • This procedure will call the FindNormalRandoms; in SRL. This procedure will try to solve any random MSI encounters. This will also add to the stats profile if the random was solved (or not) and which random it was.


Banking.scar

  • function MSI_OpenBank(which, walkIndex: Integer; tPin: String): Boolean;
  • {******************************************************************************}
    { function MSI_OpenBank(which, walkIndex: Integer; tPin: String): Boolean; }
    { By: Coh3n }
    { Description: Opens the bank 'which' (refer to bank constants). Will attempt }
    { to relocate if bank isn't found after 15 tries. }
    {******************************************************************************}
    • This is the main function that MSI uses for getting to any bank.
    • 'Which' identifies which bank we are trying to open, for example 'Bank_VEB'. This is used in conjuction with MSI_FindObject to find the bank booth.
    • 'WalkIndex' is the index, or tile, this function will try to walk to after 15 tries of opening the bank; to hopefully get to/near the bank we're trying to open.
    • 'TPin' is the pin number of your bank, this function will use InPin located in SRL/Bank to enter the pin.
  • Function MSI_Deposit(Items, Amount : TIntegerArray) : Boolean;
  • {******************************************************************************}
    { Function MSI_Deposit(Items, Amount : TIntegerArray) : Boolean }
    { By: Naum }
    { Description: Deposits an Item using the TItem type. Set Amount to [] to }
    { deposit all of every item }
    {******************************************************************************}
    • This is the main function that MSI uses for depositing items into a bank.
    • 'Items' accepts a TIntegerArray of items identified by consts in Globals.scar (this is covered later on). For example: [Hatchet_Bronze, Hatchet_Rune]. The information relating to the item such as the DTM etc is plucked out from ItemInfo.scar. The function will then try and find all occurances of the items.
    • 'Amount' accepts a TIntegerArray of values which it will deposit of item. 'Amount' relates to the same index in the Items Array. For example:
    • MSI_Deposit([Hatchet_Bronze, Hatchet_Rune], [3, 5])
    • Will deposit 3 bronze hatchets and 5 rune hatchets
    • However, if you leave 'Amount' undefined as [] then it will deposit all of every item in the array.
  • Function MSI_Withdraw(Items, Amount : TIntegerArray) : Boolean;
  • {******************************************************************************}
    { Function MSI_Withdraw(Items, Amount : TIntegerArray) : Boolean }
    { By: Naum }
    { Description: Widthraws an Item using the TItem type }
    {******************************************************************************}
    • This is the main function that MSI uses for withdrawing items from the bank.
    • This works exactly the same way as MSI_Deposit, but instead it withdraws items. See MSI_Deposit for an explanation ^.

CompileMSI.scar

  • This file is used for devs to see if everything inside MSI compiles before committing to the SVN. No real use for testers.

Debug.scar

  • procedure MSI_Debug(ProcName, TheMessage: string; DebugLevel:integer);

  • {******************************************************************************}
    { procedure MSI_Debug(ProcName, TheMessage: string; DebugLevel:integer); }
    { By: Rasta Magician }
    { Description: Used for Debugging. Will debug to DebugBox if }
    { DebugLevel >= Debug_LevelToDebug }
    {******************************************************************************}
    • The function of this procedure is pretty straight forward I would say ~ to debug the script. :p 'ProcName' and 'TheMessage' are again, pretty obvious ~ the procedure to debug, and the debug message.
    • 'Debug Level' refers to the different types of debugging we can do, whether it be player details, small details, etc. All the debug levels can be found as constants in Globals.scar.
    • The usage is pretty straight forward:

    • if (not MSI_WalkToLoc) then
      MSI_Debug('MSI_MainLoop', 'Failed to walk to location', DEBUG_FUNCTIONS);
    • This outputs:
      HH:MM:SS PM/AM: Entering Func: MSI_MainLoop: Failed to walk to location
  • procedure MSI_AddToProggy(item, quantity, which: Integer);
  • {******************************************************************************}
    { procedure MSI_AddToProggy(item, quantity, which: Integer); }
    { By: The MSI Team }
    { Description: Adds specified element to the progress report - if parameter }
    { is unused, set to -1 }
    {******************************************************************************}
    • This procedure will add to the progress report, and is called a various times throughout the script such as before banking, or before dropping.
    • The parameters of this procedure are pretty simple. Item refers to the index in the item array depending on the objects in the PlayerObjects array. This parameter is only used if you want to add an item quantity to the progress report, otherwise it is set to -1.
    • Quantity is pretty straight forward ~ How many items to add, how much xp to add, or how many loads to add.
    • Which decides what to add ~ item, loads or exp. As more things arise, it's possible that this case will grow larger.
    • A good usage for this function is in MSI_CountItems (see Mainloop.scar), where i is the index for each players item array:

    • MSI_AddToProggy(i, itemCount, ADD_ITEMS); //Adds amount of item
      MSI_AddToProggy(-1, expCount, ADD_EXP); //Adds exp to skill
  • function MSI_SkillActions(what: variant): TStringArray;

  • {******************************************************************************}
    { function MSI_SkillActions(what: variant): TStringArray; }
    { By: The MSI Team }
    { Description: Gets an array of skill actions }
    {******************************************************************************}
    • This function returns different actions for each supported skill. This is used only to make the progress report more clear and detailed. What refers to the skill you want to load actions for. You should be careful to keep the length of each skill's array the same so we don't get any out of range errors. ;)
  • procedure MSI_GetReportInfo;

  • {******************************************************************************}
    { procedure MSI_GetReportInfo; }
    { By: Coh3n }
    { Description: Gets the necessary proggy info that ISN'T reset during runtime }
    {******************************************************************************}
    • The description explains what this does well enough. Specifically, this function gets the levels of each skill in the PlayerSkills array, the activity of the player and the player's current location. This procedure is called in MSI_ProgressReport.
  • function MSI_ObjToText(which: Integer): TStringArray;

  • {******************************************************************************}
    { function MSI_ObjToText(which: Integer): TStringArray; }
    { By: The MSI Team }
    { Description: Converts the item constant to a string }
    {******************************************************************************}
    • This function is also used strictly for the progress report to be more detailed. It just generates an item name based on the item entered for which.
  • function MSI_LocToText(Which: Integer): string;

  • {******************************************************************************}
    { function MSI_LocToText(Which: Integer): string; }
    { By: The MSI Team }
    { Description: Converts the location constant to a string }
    {******************************************************************************}
    • Again, really straight forward ~ converts the location which to a string to use in the progress report.
  • function MSI_GroupDigits(n: integer; token: String): String;

  • {******************************************************************************}
    { function MSI_GroupDigits(n: integer; token: String): String; }
    { By: PriSoner and Nava2 }
    { Description: Formats an integer into groups of 3 seperated by `token' and }
    { returns a formatted string (i.e 1234567 would become 1,234,567) }
    {******************************************************************************}
    • This is a very useful function IMO that separates large numbers to make them more readable (i.e. 123456789 becomes 123,456,789).
    • n is the integer you want to separate, and token is the character you want in between the numbers. In the latter example, the token is a comma.
    • Example:

    • Writeln(GroupDigits(56894751, ','));
      Would output:

      56,894,751
  • procedure MSI_PrintSave(FileH, S : String);

  • {******************************************************************************}
    { procedure MSI_PrintSave(FileH, S : String); }
    { By: Naum }
    { Description: Prints the string in the report and debug box also saves the }
    { report }
    {******************************************************************************}
    • Pretty self explanatory - this procedure will print the string S to either the report box or debug box depending on whether the user is using Simba or SCAR. This is called to print the progress report.
    • The procedure also saves S to a file (FileH).
  • procedure MSI_ProgressReport;

  • {******************************************************************************}
    { procedure MSI_ProgressReport; }
    { By: Coh3n }
    { Description: Prints the progress report of each player }
    {******************************************************************************}
    • This uses each element in the TProggy record to effectively produce a detailed progress report for each player. :)

Globals.scar

  • All other functions/procedures which use consts refer to this file. All types and records such as TItemInfo are found here as are any global variables used. :)
  • Don't be afraid to take a look through. ;)

ItemInfo.scar

  • function MSI_GetDTMInfo(which: Integer): TIntegerArray;

  • {******************************************************************************}
    { function MSI_GetDTMInfo(which: Integer): TIntegerArray; }
    { By: Coh3n }
    { Description: Gets the coodinates for the DTM points }
    {******************************************************************************}
    • Returns points for which DTM in an Integer array.
    • Originally we decided to use a static DTM for each item, but then Ejjman1 pointed out that it would be more efficient to use dynamic DTMs for items which are the same shape, but have a different color (i.e. hatchets, ores, logs, etc.). This makes it very easy to update colors/points if Jagex were to change them, rather than having to make a whole new DTM for each item.
  • function MSI_GetItemColor(which: Integer): Integer;

  • {******************************************************************************}
    { function MSI_GetItemColor(which: Integer): Integer; }
    { By: The MSI Team }
    { Description: Loads the item's (which) color - used for DTMs }
    {******************************************************************************}
    • This simple gets the color of the item. It's in it's own separate function to simple increase readability and to not make MSI_LoadDTM to messy. The parameter which is the item (see the item constants in Globals.scar).
  • function MSI_LoadDTM(which: Integer): Integer;

  • {******************************************************************************}
    { function MSI_LoadDTM(which: Integer): Integer; }
    { By: Coh3n and Ejjman1 }
    { Description: Loads the DTM specified by 'which' }
    {******************************************************************************}
    • This function basically creates the DDTM, using the function MSI_GetItemColor, it then loads this 'D'DTM into the memory with the specified sub-points and main-point.
    • This function is used to find the hatchets in the varrock tree cutter.
  • Function MSI_GetItem(ID : Integer) : Boolean;

  • {******************************************************************************}
    { Function MSI_GetItem(ID : Integer) : Boolean; }
    { By: Coh3n and Naum }
    { Description: Gets the TItem record for a certain item defined by 'ID' }
    {******************************************************************************}
    • This procedure loads a TItem record (see Globals.scar in the tutorial). The ID is used as a const, so:
    •  
      Item := MSI_GetItem(BRONZE_HATCHET);
    • The type is:
    •   TItem = Record
      Name : String;
      UpText : TStringArray;
      ItemP : TPoint;
      Stackable : Boolean;
      Colors : TIntegerArray;
      Tol : Integer;
      DTM : Integer;
      BMP : Integer;
      End;
  • Procedure MSI_LoadItems(IDs : TIntegerArray);

  • {******************************************************************************}
    { Procedure MSI_LoadItems(IDs : TIntegerArray); }
    { By: Naum }
    { Description: Gets the TItem records for all items in the array }
    {******************************************************************************}
    • This procedure loads items specified by IDs, the ID variable is a TIntegerArray.
    • Used like so:
    • MSI_LoadItems([BRONZE_HATCHET, IRON_HTACHET]);
  • Procedure MSI_LoadItemRange(StartID, EndID : Integer);

  • {******************************************************************************}
    { Procedure MSI_LoadItemRange(StartID, EndID : Integer); }
    { By: Naum edited by RM }
    { Description: Gets the TItem records for all items in the range }
    {******************************************************************************}
    • See MSI_LoadItems and MSI_GetItem
  • Procedure MSI_FreeItemEx(Which : Integer);

  • {******************************************************************************}
    { Procedure MSI_FreeItemEx(Which : Integer); }
    { By: Naum }
    { Description: Frees the TItem record for the item 'which' }
    {******************************************************************************}
  • Procedure MSI_FreeItemArray(TIArray : TIntegerArray);

  • {******************************************************************************}
    { Procedure MSI_FreeItemArray(TIArray : TIntegerArray); }
    { By: Naum }
    { Description: Frees the TItem records for all items in the array }
    {******************************************************************************}
  • Procedure MSI_FreeItems;

  • {******************************************************************************}
    { Procedure MSI_FreeItems; }
    { By: Naum }
    { Description: Frees all loaded Items }
    {******************************************************************************}
  • Procedure MSI_FreeItemRange(StartID, EndID: Integer);

  • {******************************************************************************}
    { Procedure MSI_FreeItemRange(StartID, EndID: Integer); }
    { By: Naum edited by RM }
    { Description: Frees the TItem records for all items in the range }
    {******************************************************************************}

Mainloop.scar
  • This is the code that is executed when RunMe.scar is compiled.


Objects.scar

    Mainscreen objects' info is stored in a type called TMSObject (found in Globals.simba)

    Type
    TMSObject = Record
    X, Y : Integer;
    Name : String;
    UpText : String;
    Option : String;
    Exp : Extended;
    Colors : TIntegerArray;
    FindAllColors : Boolean; // Result False if not ALL colors are found
    Tol : Integer;
    Hue : Extended;
    Sat : Extended;
    W, H : Integer;
    Accuracy : Integer; // Min pixels to be found
    ExcludeSelf : Boolean; // Exclude pixels in a box, the box might need revamping / making it dynamic
    RightClickOnly : Boolean;
    Tries : Integer;
    Anim : Boolean; // Result False if not animating
    WaitToMove : Boolean; // When ClickLeft, wait till we have stopped moving?
    BadColors : TIntegerArray;
    BadColorTolerance: Integer;
    End;
  • All objects' TMSObject info are called with function

  • Function MSI_GetObject(Which: Integer): TMSObject;
    which can be found in Objects.simba
  • Creating an object:
  • See Objects.scar for examples.

    With MyObject Do
    Begin
    Name := 'Oak tree';
    UpText := 'Oak';
    Option := 'Chop down';
    Colors := [736046, 123123];
    Exp := 37.5;
    Tol := 5;
    Hue := 1.54;
    Sat := 5.00;
    FindAllColors := False; // if this is True, will result False if some of the colors wasn't found
    W := 30; // Width
    H := 30; // Height
    Accuracy := 10; // Minimum amount of pixels that has to be found within W*H
    ExcludeSelf := True; // Exclude box around character
    RightClickOnly := False;
    Tries := 5; // Possible objects found it will hover before it gives up
    Anim := False; // if True, will check animation
    WaitToMove := True; // Wait till we have reached the object after clicking
    BadColors := []; // Bad colors that must not be found within the object area
    BadColorTolerance := 10;
    End;
  • Finding the object:
  • You will find all the finding functions in Objects.simba. This one will most likely be the one you use the most:

    Function MSI_FindObject(Obj: TMSObject; Action: fnct_ActionOptions): Boolean;
  • Explanation for 'Action'- parameter
    • Move - Will mouse-over and check uptext, but not click
    • ClickLeft - Will choose the option determined in TMSObject input
    • ClickRight - Will right-click and choose the option


RunMe.scar

  • This is the script you have to run if you want to test MSI and it's power. It will include everything inside MSI and auto on your characters, depending on what skills you've set it up to auto on. Just fill in everything inside the DeclarePlayers; procedure and you're good to go! For instructions on how to set it up correctly, go here.

Setup.scar

  • procedure SetupMSI;
    • This procedure is like SetupSRL; in SRL. Basically what this does is include all the files from AntiBan.Scar down to Walking_Reflection.scar
    • Also note that this procedure includes SRL. So a test script to see if everything is working would be:
    • {.Include SRL/SRL/MSI/Setup.scar}

      Begin
      SetupMSI;
      SRL_Warn('SetupMSI', 'Everything setup correctly! ', warn_AllVersions);
      MSI_Debug('SetupMSI', 'Everything setup correctly!', DEBUG_FUNCTIONS);
      End.
    • The above script^ should output:
    • Setting up MSI took 0 ms.
      ** Warning in SetupMSI: Everything setup correctly! **
      12:24:33 PM: SetupMSI: Everything setup correctly!

Skills.scar


    Not used at this moment

Stats.scar
  • [php]
  • | * procedure Stats_CheckOutput(); * by nielsie95 | | * procedure Stats_GetScriptInfo(); * by nielsie95 | | * procedure Stats_SendReport(); * by nielsie95 | | * procedure Stats_SendAccountInfo(); * by nielsie95 | | * procedure Stats_ManageAccounts(); * by nielsie95 | | * procedure MSI_SendStats; * by Coh3n | [/php]

THINGS_TO_REMEMBER_WHEN_WRITING_CODE.txt

  • This text file details the vital elements needed for an MSI Developer to check, before he commits his version to the repos. Not really relevant to other people.

Walking_Color.scar

  • function MSI_WalkTPAPoint(TPA: tPointArray; sortP: tPoint; flagDist: shortInt): Boolean;
  • {******************************************************************************}
    { function MSI_WalkTPAPoint( ... ): Boolean; }
    { By: Blumblebee }
    { Description: Walks to a point on the minimap }
    {******************************************************************************}
    • Simply enough, this function walks the player dependent on the TPA. 'SortP' allows for customization of where you want the TPA to be sorted from. 'FlagDist' is flag distance (FFlag(flagDist)).
    • Used simply like:
    • MSI_WalkTPAPoint(TPA, Point(MMx1, MMy1), RandomRange(8, 12));
  • function MSI_CreateWalkTPA(x, y, color, width, height, tolerance: Integer): TpointArray;
  • {******************************************************************************}
    { function MSI_CreateWalkTPA( ... ): TPointArray; }
    { By: Blumblebee }
    { Description: Creates a TPA of which can be walked to }
    {******************************************************************************}
    • This function gathers a TPointArray in the MM of a specific color, height, width and tolerance. It is a code/line saver as it is fully customizable and can be used in almost every case of custom TPA walking. X and Y are the sort points, meaning where you want the TPA to be sorted from.
    • This function can be used in conjunction with function MSI_WalkTPAPoint(TPA: tPointArray; sortP: tPoint; flagDist: ShortInt): Boolean;. This will allow you to find and walk to a TPA with as simple as two lines (but we won't do that because fail safes are important).
  • function MSI_AutoColorMM(const color: Integer): Integer;
  • {******************************************************************************}
    { function MSI_AutoColorMM(const color: Integer): Integer; }
    { By: Blumblebee }
    { Description: Autocolors the color 'color' on the minimap }
    {******************************************************************************}
    • This function will return the closest matching color on the mini-map to the 'color' specified.
    • Used:
      Autocolor := AutoColorMM(CONST_COLOR_HERE);
    • Final Overview and Example.

    • function MSI_WalkExample(): Boolean;
      var
      TPA: tPointArray;
      Auto: Integer;
      begin
      Auto := MSI_AutoColorMM(CONST_COLOR_HERE); // MSI_AutoColorMM at work. Gets the closest matching color on the MM
      TPA := MSI_CreateWalkTPA(MMx1, MMy2, Auto, 10, 10, 6); // Creates the TPA of the Color provided.
      if Length(TPA) <> 0 then
      result := MSI_WalkTPAPoint(TPA, point(MMx1, MMy2), randomRange(8, 12)); // Finds a suitable walking point
      // (if rs_OnMinimap), and then clicks.
      end;

Walking_Reflection.scar
Some of these functions were put in here while the reflection include was not yet stable. We will be getting around to updating this part.

  • function MSI_GetMyPos: TPoint;

  • {******************************************************************************}
    { function MSI_GetMyPos: TPoint; }
    { By: BenLand100 }
    { Description: Calculates the player's tile position }
    {******************************************************************************}
  • function MSI_TileToMM(Tile: TPoint): TPoint;
  • {******************************************************************************}
    { function MSI_TileToMM(Tile: TPoint): TPoint; }
    { By: BenLand100 }
    { Description: Converts the tile position to a minimap location }
    {******************************************************************************}
  • function MSI_WalkToTile(P: TPoint; Randomness, FlagD: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_WalkToTile(P: TPoint; Randomness, FlagD: Integer): Boolean; }
    { By: marpis }
    { Description: Walks to tile }
    {******************************************************************************}
    • Walks to tile as long as tile is on MM. Returns false if it didn't manage to walk.
  • function MSI_LoadRefPath(StartLoc, EndLoc: Integer): TPointArray;

  • {******************************************************************************}
    { function MSI_LoadRefPath(StartLoc, EndLoc: Integer): TPointArray; }
    { By: The MSI Team }
    { Description: Loads tiles from A to B }
    {******************************************************************************}
    • Loads TPA with path from StartLoc to EndLoc
    • Note to self: Change to TTileArray
  • function MSI_RefWalk(StartLoc, EndLoc: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_RefWalk(StartLoc, EndLoc: Integer): Boolean; }
    { By: marpis, edited by Coh3n }
    { Description: Walks from A to B }
    {******************************************************************************}
  • function MSI_HybridWalk(startLoc, endLoc: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_HybridWalk(startLoc, endLoc: Integer): Boolean; }
    { By: RM and Coh3n }
    { Description: Will walk the color path if near the reflection point. If not }
    { near the point, will walk to the reflection tile }
    {******************************************************************************}
    • Uses color walk, while using reflection to check it is going to the right place. If color walk is going wrongly, uses reflection to walk.
    • Needs further development:
      • Ref Path mush match Color Path
      • If color fails, needs to return more details to fix color
  • function FixPosition(Location: Integer): Boolean;

  • {******************************************************************************}
    { function FixPosition(Location: Integer): Boolean; }
    { By: marpis }
    { Description: Fix position if lost }
    {******************************************************************************}
  • function MSI_PerformWalk(startLoc, endLoc: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_PerformWalk(startLoc, endLoc: Integer): Boolean; }
    { By: Coh3n }
    { Description: Performs the walking routine }
    {******************************************************************************}
    • Main walking procedure. Chooses between Hybrid or Color walk.

Coh3n

2010-04-22 18:27:21

Formatting can be changed if you guys want. I just did that quickly to make it look a little more colorful. :p

Also, I don't think we need to explain in as much detail as Naum did. :p For example, I think this is all that's really necessary for explaining parameters:

'HowLong' dictates how long the antiban should last, in milliseconds e.g. 2000.

BobboHobbo

2010-04-23 04:31:04

Looks good so far. This will be one ridiculously long post when its done.

Gu3st...

2010-04-23 09:10:48

Skills/Woodcutting.scar
Procedure MSI_WaitWhileChopping(TreeX, TreeY: Integer; TreeInfo: TMSObject);
{******************************************************************************}
{ Procedure MSI_WaitWhileChopping(TreeX, TreeY: Integer; TreeInfo: TMSObject); }
{ By: marpis }
{ Description: Wait while tree's been cut }
{******************************************************************************}
As the name and the description suggests, this procedure will wait while the script is chopping. It will perform various anti-bans (MSI_AntiBan. Check the Antiban.scar file here LINK TO ANTIBAN.SCAR), random checking (also in Antiban.scar) and anti-logout procedures while waiting.
TreeX and TreeY are the cordinates of where the tree is on the main screen, and TreeInfo is a TMSObject (check the Globals.scar file for the type LINK TO GLOBALS.scar).

Function MSI_ChopTree(Which: TIntegerArray): Boolean;
{******************************************************************************}
{ Function MSI_ChopTree(Which: TIntegerArray): Boolean; }
{ By: marpis }
{ Description: Chops tree }
{******************************************************************************}
Using TMSObject, this function will chop the nearest tree declared in the 'Which' integer array and then wait until the tree is chopped.

Function MSI_ChopInvFull(Which: TIntegerArray): Boolean;
{******************************************************************************}
{ Function MSI_ChopInvFull(Which: TIntegerArray): Boolean; }
{ By: marpis }
{ Description: Chops trees until inventory is full }
{******************************************************************************}
Using MSI_ChopTree, this function will chop trees until the inventory is full.

function MSI_PowerChop(WhichTrees, WhichLogs: TIntegerArray): Boolean;
{******************************************************************************}
{ function MSI_PowerChop(WhichTrees, WhichLogs: TIntegerArray): Boolean; }
{ By: marpis and Coh3n }
{ Description: Chops trees until inventory is full, then drops. }
{ Time is in milliseconds. }
{******************************************************************************}
This function will chop the tree chosen and then drop all the logs that's specified in the WhichLogs array.


EDIT: http://villavu.com/forum/showthread.php?t=56326 :)

Coh3n

2010-04-23 11:36:43

Zyt3x - Add it. :) You have mod abilities here. Be sure to keep the same formatting though.

Naum

2010-04-23 12:28:20

From: Coh3n
Zyt3x - Add it. :) You have mod abilities here. Be sure to keep the same formatting though.

Good Job Zytex :).
I've created a new thread for the skills part, as it will be expanded later as the rest of the 14 odd skills are added. Kept the same formatting.
Good job to you to coh3n, the layout looks very good :).

*Just a suggestion, but it would be nice to write a small post detailing how to format what in the tutorial, so it helps others :)*.

EDIT: Fixed the link.

Blumblebee

2010-04-23 15:27:36

tried to update some of the walking. I suck at writing tutorials, sorry for that :/ I'll add more If I feel more understanding in the walking_color is required.

Naum

2010-04-23 15:29:55

From: Blumblebee
tried to update some of the walking. I suck at writing tutorials, sorry for that :/ I'll add more If I feel more understanding in the walking_color is required.


Thanks, very much!!!
I'll fix it up! Rep+ to you!!!
GOOD JOB! :D

:<: You must spread some Reputation around before giving it to Blumblebee again.

Coh3n

2010-04-23 17:20:23

Looking awesome so far, guys. :)

Sir R. M8gic1an

2010-04-23 17:26:34

From: Coh3n
Looking awesome so far, guys. :)


+1 :D (so rare for me to post something so 'spamish' :p)

~RM

Gu3st...

2010-04-23 17:28:46

Added CompileMSI and RunMe. Theres only one procedure in those files so I just did those before going to bed :P
I'm gone now. Feel free to do any changes (obviously)

Naum

2010-04-25 13:00:24

Added Banking.scar and Read_before_committing.txt (:p), feel free to make edits :)

Coh3n

2010-04-27 10:22:10

Had a couple spare minutes so I started Debug.scar.

Naum

2010-04-28 12:11:22

Got a bit of time, gave the whole tutorial a once over and edited some stuff. Also started MSI_AddToProggy(item, quantity, which: Integer);

Sir R. M8gic1an

2010-04-30 17:40:26

goin good guys :) !

~RM

Coh3n

2010-04-30 18:36:19

Added MSI_SkillActions. I know it's barely anything, but I have to go.

Naum

2010-05-02 07:36:04

I added some other sections, changed the other titles to blue to make them stand out more.

Note: Guys, we're nearly done!! :D, I guess we're about a good half-way there. Let's go for it!!

Coh3n

2010-05-03 09:44:23

Added some more to Debug.scar.

NCDS

2010-05-03 13:12:43

Added ItemInfo.scar but didn't really know how to explain them any more then the function headers already do. So, feel free to edit that, or just tell me and I can change some thing's.

Naum

2010-05-03 13:24:37

From: NCDS
Added ItemInfo.scar but didn't really know how to explain them any more then the function headers already do. So, feel free to edit that, or just tell me and I can change some thing's.


Thanks :), will edit later when I submit some more stuff!
Keep the momentum going guys!:spot:

Coh3n

2010-05-03 15:20:51

Took out the while Globals.scar, there's no need when they can just simply open it or go to in via web browser. :)

Naum

2010-05-03 15:31:40

From: Coh3n
Took out the while Globals.scar, there's no need when they can just simply open it or go to in via web browser. :)


Personally, I wouldn't have and if I did - I would've left a link. It's easier, I feel, to keep the thing there/link for ease of access.

Coh3n

2010-05-03 15:39:05

From: Naum
Personally, I wouldn't have and if I did - I would've left a link. It's easier, I feel, to keep the thing there/link for ease of access.

You're right, I added a link (is just neater IMO) and finished Globals.scar.

Naum

2010-05-27 07:38:55

Took some time out from busy revision to do some work on ItemInfo, hopefully will get this whole process started up again :)

marpis

2010-05-30 08:12:01

Objects.simba
Mainscreen objects' info is stored in a type called TMSObject (found in Globals.simba)

Type
TMSObject = Record
X, Y : Integer;
Name : String;
UpText : String;
Option : String;
Exp : Extended;
Colors : TIntegerArray;
FindAllColors : Boolean; // Result False if not ALL colors are found
Tol : Integer;
Hue : Extended;
Sat : Extended;
W, H : Integer;
Accuracy : Integer; // Min pixels to be found
ExcludeSelf : Boolean; // Exclude pixels in a box, the box might need revamping / making it dynamic
RightClickOnly : Boolean;
Tries : Integer;
Anim : Boolean; // Result False if not animating
WaitToMove : Boolean; // When ClickLeft, wait till we have stopped moving?
BadColors : TIntegerArray;
BadColorTolerance: Integer;
End;

All objects' TMSObject info are called with function

Function MSI_GetObject(Which: Integer): TMSObject;
which can be found in Objects.simba

Creating an object
See Objects.scar for examples.

With MyObject Do
Begin
Name := 'Oak tree';
UpText := 'Oak';
Option := 'Chop down';
Colors := [736046, 123123];
Exp := 37.5;
Tol := 5;
Hue := 1.54;
Sat := 5.00;
FindAllColors := False; // if this is True, will result False if some of the colors wasn't found
W := 30; // Width
H := 30; // Height
Accuracy := 10; // Minimum amount of pixels that has to be found within W*H
ExcludeSelf := True; // Exclude box around character
RightClickOnly := False;
Tries := 5; // Possible objects found it will hover before it gives up
Anim := False; // if True, will check animation
WaitToMove := True; // Wait till we have reached the object after clicking
BadColors := []; // Bad colors that must not be found within the object area
BadColorTolerance := 10;
End;

Finding the object
You will find all the finding functions in Objects.simba.
This one will most likely be the one you use the most:

Function MSI_FindObject(Obj: TMSObject; Action: fnct_ActionOptions): Boolean;
Explanation for 'Action'- parameter
  • Move - Will mouse-over and check uptext, but not click
  • ClickLeft - Will choose the option determined in TMSObject input
  • ClickRight - Will right-click and choose the option

Naum

2010-06-02 09:09:16

From: marpis
Objects.simba
Mainscreen objects' info is stored in a type called TMSObject (found in Globals.simba)

Type
TMSObject = Record
X, Y : Integer;
Name : String;
UpText : String;
Option : String;
Exp : Extended;
Colors : TIntegerArray;
FindAllColors : Boolean; // Result False if not ALL colors are found
Tol : Integer;
Hue : Extended;
Sat : Extended;
W, H : Integer;
Accuracy : Integer; // Min pixels to be found
ExcludeSelf : Boolean; // Exclude pixels in a box, the box might need revamping / making it dynamic
RightClickOnly : Boolean;
Tries : Integer;
Anim : Boolean; // Result False if not animating
WaitToMove : Boolean; // When ClickLeft, wait till we have stopped moving?
BadColors : TIntegerArray;
BadColorTolerance: Integer;
End;

All objects' TMSObject info are called with function

Function MSI_GetObject(Which: Integer): TMSObject;
which can be found in Objects.simba

Creating an object
See Objects.scar for examples.

With MyObject Do
Begin
Name := 'Oak tree';
UpText := 'Oak';
Option := 'Chop down';
Colors := [736046, 123123];
Exp := 37.5;
Tol := 5;
Hue := 1.54;
Sat := 5.00;
FindAllColors := False; // if this is True, will result False if some of the colors wasn't found
W := 30; // Width
H := 30; // Height
Accuracy := 10; // Minimum amount of pixels that has to be found within W*H
ExcludeSelf := True; // Exclude box around character
RightClickOnly := False;
Tries := 5; // Possible objects found it will hover before it gives up
Anim := False; // if True, will check animation
WaitToMove := True; // Wait till we have reached the object after clicking
BadColors := []; // Bad colors that must not be found within the object area
BadColorTolerance := 10;
End;

Finding the object
You will find all the finding functions in Objects.simba.
This one will most likely be the one you use the most:

Function MSI_FindObject(Obj: TMSObject; Action: fnct_ActionOptions): Boolean;
Explanation for 'Action'- parameter
  • Move - Will mouse-over and check uptext, but not click
  • ClickLeft - Will choose the option determined in TMSObject input
  • ClickRight - Will right-click and choose the option




^ Added it hastily. Good job!

Common guys!
Only 2 sections remaining!!!!

Sir R. M8gic1an

2010-06-05 10:25:48

Walking_Reflection.scar
Some of these functions were put in here while the reflection include was not yet stable. We will be getting around to updating this part.

  • function MSI_GetMyPos: TPoint;

  • {******************************************************************************}
    { function MSI_GetMyPos: TPoint; }
    { By: BenLand100 }
    { Description: Calculates the player's tile position }
    {******************************************************************************}
  • function MSI_TileToMM(Tile: TPoint): TPoint;
  • {******************************************************************************}
    { function MSI_TileToMM(Tile: TPoint): TPoint; }
    { By: BenLand100 }
    { Description: Converts the tile position to a minimap location }
    {******************************************************************************}
  • function MSI_WalkToTile(P: TPoint; Randomness, FlagD: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_WalkToTile(P: TPoint; Randomness, FlagD: Integer): Boolean; }
    { By: marpis }
    { Description: Walks to tile }
    {******************************************************************************}
    • Walks to tile as long as tile is on MM. Returns false if it didn't manage to walk.
  • function MSI_LoadRefPath(StartLoc, EndLoc: Integer): TPointArray;

  • {******************************************************************************}
    { function MSI_LoadRefPath(StartLoc, EndLoc: Integer): TPointArray; }
    { By: The MSI Team }
    { Description: Loads tiles from A to B }
    {******************************************************************************}
    • Loads TPA with path from StartLoc to EndLoc
    • Note to self: Change to TTileArray
  • function MSI_RefWalk(StartLoc, EndLoc: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_RefWalk(StartLoc, EndLoc: Integer): Boolean; }
    { By: marpis, edited by Coh3n }
    { Description: Walks from A to B }
    {******************************************************************************}
  • function MSI_HybridWalk(startLoc, endLoc: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_HybridWalk(startLoc, endLoc: Integer): Boolean; }
    { By: RM and Coh3n }
    { Description: Will walk the color path if near the reflection point. If not }
    { near the point, will walk to the reflection tile }
    {******************************************************************************}
    • Uses color walk, while using reflection to check it is going to the right place. If color walk is going wrongly, uses reflection to walk.
    • Needs further development:
      • Ref Path mush match Color Path
      • If color fails, needs to return more details to fix color
  • function FixPosition(Location: Integer): Boolean;

  • {******************************************************************************}
    { function FixPosition(Location: Integer): Boolean; }
    { By: marpis }
    { Description: Fix position if lost }
    {******************************************************************************}
  • function MSI_PerformWalk(startLoc, endLoc: Integer): Boolean;

  • {******************************************************************************}
    { function MSI_PerformWalk(startLoc, endLoc: Integer): Boolean; }
    { By: Coh3n }
    { Description: Performs the walking routine }
    {******************************************************************************}
    • Main walking procedure. Chooses between Hybrid or Color walk.

Sir R. M8gic1an

2010-06-05 10:29:00

One to go. :)

~RM

NCDS

2010-06-05 14:10:33

Added a brief explanation for MainLoop.scar. There's really only so much to say about it :redface:

Sir R. M8gic1an

2010-06-06 10:58:47

Quickly Added Stats.scar and posted to public :)

~RM

marpis

2010-06-23 15:49:47

I just tried to learn how to add another activity to MSI, but I had no idea. The DoSkill is very understandable, but the banking is just a mystery.

How do I make it withdraw items?
How do I make it deposit items?
What if I don't want to use bank at all?

Coh3n

2010-06-23 16:34:23

Well right now there's MSI_Deposit, MSI_Withdraw and an option in DeclarePlayers to determine whether to bank or not. MSI_BankMaterials needs some work, and I plan on updating that as soon as I start switching to script base. The TScript type will have more than enough attributes to make the code smooth and efficient :)

Sir R. M8gic1an

2010-09-06 03:11:01

I'm guessing this can be unstuck by now?

~RM

Coh3n

2010-09-06 03:14:56

All the "now-public" threads can be I would assume..