Coh3n
2010-06-10 12:21:28
This guide was last updated on March 17th, 2012
Introduction:
[INDENT]This is going to basically be an "MSI For Dummies" tutorial where you could have almost no scripting experience, and still be able to contribute to MSI. Of course, there will be some more advanced parts that you may not understand, so don't be afraid to ask questions, that's what we're here for. :) I also encourage you to look at the MSI Core to-do List, for a list of everything that's been suggested and what needs to be done.
Since most people learn better with examples, throughout this guide I will be adding a Varrock East Clay Softener script to MSI. Why a Clay Softener? Because it covers everything: new items, new objects, and a new "skill" (not actually a new skill since you don't get experience, but I'm sure you get the point). If you have any questions about any procedures/functions in MSI, please use MSI's Documentation as a reference.
This guide will outline the following:
- The easiest way of contributing to MSI.
- How to, very easily, create the basic MSI records (TItem, TMSObject, TLocation and TScript).
- How to add each of these records to the include.
- How to add a new skill to MSI.
- How to add a script for an existing skill.
- Some useful links.
Using github to Contribute to MSI:
[INDENT]The easiest way to contribute to MSI is through github. This allows for anyone to make their own version (repository) of MSI that they can develop on their own and eventually merge (combine) with the main MSI repository. I highly recommend learning how to use git if you plan on contributing to MSI, SRL, Reflection, or Simba in the future. It's an awesome tool that makes developing extremely easy. Beware that it may take a little time to get used to, but I promise you it's worth it.
To get setup to contribute with git, follow these simple steps:
- Create a free github account here.
- Fork (create your own version of) the MSI repository. You can fork any public repository by clicking the Fork button in the top right of that repository's page. Here is MSI's page, see the Fork button in the top right (you have to be logged in to see it).
- You'll notice you now have your very own direct copy of MSI. :)
- Now you'll want to setup git on your computer. Windows users have the option to use TortoiseGit, which is a lot like TortoiseSVN if you have past experience with that.
- Follow this tutorial to setup git and TortoiseGit on your computer. That guide also briefly explains how to work with TortoiseGit. You can also refer to this guide to help you to use git.
- The Putty part of that guide is optional. If you wish you can simple input your Github password each time you're prompted to do so.
- Now Clone your MSI repository in your Simba/Includes folder (the latter guide explains how to Clone).
- Done!
Planning Your Changes:
[INDENT]Before you start furiously scripting for MSI, I highly recommend planning things out, whether you're simply adding a script record or a new skill. This will ensure you don't forget anything, and it can also act as a checklist for when you actually start coding. So, since I'll be adding a Clay Softener for this guide, let's start planning it out.
While answering some of the following questions, you should also think about whether or not MSI already has the methods/records for what you need. How are you going to know this? Well check the include of course! In Globals.simba there are lists of all the records that MSI has. As for the methods, you may need to explore MSI's Documentation to be sure. Now, on the the planning…
- What items are used?
Clay(record already exists)- Soft Clay
- I need to make a TItem record for these items.
- What main screen objects are to be found?
Varrock East Bank(record already exists)- Fountain
- I need to make TMSObject records for these objects.
- What are the different locations involved?
Varrock East Bank(record already exists)- Varrock East Fountain
- I need to make TLocation records for these locations.
- Do items need to be withdrawn to be changed into another?
- Clay needs to be withdrawn to to be turned in to Soft Clay.
- I need to make a TMaterial record for Clay.
- What are the procedures involved in a Clay Softener?
- Setup the player
Withdraw Clay from bank(MSI_Withdraw/MSI_BankWithdraw)Walk to fountain(MSI_Walk)Use Clay with fountain(MSI_UseItemOn)Wait for all the Clay to be softened(MSI_WaitItemGone)Walk back to the bank(MSI_Walk)Deposit the Soft Clay(MSI_Deposit/MSI_BankWithdraw)- I need to make a TScript record for Varrock East Clay Softener. This step involves the writing of a few simple procedures.
- Is there anything else needed for a Clay Softener?
- A specific file for a Clay Softener or even better - for Money Making scripts.
- Print a progress report (Reports.simba, BUT some things need changing)
Making Your Changes:
[INDENT]The easiest part of everything that needs to be done is making the records, so I'm going to start with them (this includes the TScript record).?Why is this so easy? Because there are already tons of each type of record in the include, all I have to do is copy/paste and changed what needs to be changed. :)
All the records should have descriptions beside each attribute in Globals.simba if you are ever confused about what to set something to. I will still describe what they are here, but this guide won't be updated as much as the include. So now I'm going to work down my checklist.
Lastly, don't get discouraged by how long these steps are. They're really not long at all, I'm just going to explain them thoroughly so there's no confusion. :)
1. Creating the TItem records
- Enable the DTM editor extension in Simba, then open it (Tools > DTM Editor).
- Save an image of the item, then go to Image > Open Image. in the DTM editor, and open the item picture.
- Pick a main point (a distinct color on the item) and 4 sub-points. The sub points all HAVE to have the color 131072 (the outline of the item).
- When you're finished, you should have a screen that looks something like this:
- Now if you look in the procedure MSI_GetDTMPoints, you'll notice a bunch of points for all the different items. Copy one of the items and replace it with the points you just gathered, then add it to the end of the procedure. *HINT* Take a screen shot or write down the points/colors, so you can close the DTM Editor and work with only one Simba.
CLAY_SOFT:
Result := [
Point(28, 25),
Point(16, 27),
Point(27, 13),
Point(39, 26),
Point(28, 33)
];
else
MSI_SubDebug('MSI_GetDTMPoints: Invalid item constant - ' + IntToStr(which));
end;
end;
CLAY_SOFT: Result := 802904;
CLAY_SOFT:
with MSI_Items[whichItem] do
begin
Name := 'Soft Clay'; // Name of the item
UpText := ['oft clay']; // Uptext
Stackable := False; // Is it stackable?
EquipLevel := -1; // Set to -1 if it can't be equipped
end;
end;
Result := (MSI_Items[whichItem].Name <> '');
end;
CLAY_SOFT = 180;
ITEM_ARRAY_LENGTH = 180; // Change to the highest item constant
2. Creating the TMSObject records
- First, download AutoColor Aid (ACA), and open it. This tool makes our job 1000x easier.
- Since I need to find the fountain on the mainscreen, I load Runescape and place my player beside the fountain.
- Now in ACA, go to Client > Client Window > Find RS. If you get a black screen just try again.
- Choose CTS (Color tolerance speed) 2 in the bottom right corner.
- Now click the RS image where object appears. Click several areas to get more colors, you'll notice the colors appear in the list to the right.
- When you think you've picked enough colors, right click the colors list and choose Delete Duplicates.
- Now, click Mark Best Color. Your ACA should now look something like this:

- Now time to fill out the record. Just like for TItem, copy a record from Objects.simba and change the necessary attributes.
- Once changed, add it to MSI_LoadObject.
FOUNTAIN_VE:
with MSI_Objects[whichObject] do
begin
Name := 'Varrock East Fountain'; // Name
UpText := 'ount'; // Uptext
Option := 'se'; // Choose option text (se = Use)
Colors := [14520685]; // The 'Best color' from ACA
Tol := 12; // Tol from ACA
Hue := 0.02; // Hue from ACA
Sat := 2.47; // Sat from ACA
FindAllColors := False; // MSI_FindObject will only return true if all colors in 'Colors' are found
W := 50; // Width of the object in pixels
H := 50; // Height of the object in pixels
Accuracy := 20; // The minimum amount of colors to be found (gets rid of false objects)
SearchArea := MSBox; // The box to search for the object (MSBox = main screen box)
ExcludeSelf := True; // Exclude the character
RightClickOnly := False; // Only right click
WaitToMove := True; // Wait for the player to stop moving after the object is clicked
Track := False; // True if the object disappears after the player is done with it
AssociatedItems := [CLAY_SOFT]; // Are any items gained from the object (i.e. logs from trees)?
end;
end;
Result := (MSI_Objects[whichObject].Name <> '');
end;
// Fountains
FOUNTAIN_VE = 110;
OBJ_ARRAY_LENGTH = 110; // Change to the highest object constant
3. Creating the TLocation records
- TLocation records are fairly simple. For this script, I need one for the Varrock East Fountain.
- Simply copy another record, replace what needs to be replaced and add it to the case in MSI_LoadLocation in Locations.simba.
- If there is more than one sub-location (i.e. a tree that needs to be walked to), increase the length and add another sub-location. You can add as many as needed.
- IMPORTANT: The tileBox works like this: x1, y1 is the top left of the box while x2, y2 is the bottom right. I suggest walking your player to each point of the box and calling writeln(toStr(getMyPos)); to get that tile.
- IMPORTANT: You HAVE to set subLocs[0].objects, otherwise it will not work!
- The entire TLocation record can be found in Globals.simba.
LOC_VE_FOUNTAIN:
with MSI_Locations[loc] do
begin
name := 'Varrock East Fountain';
atBank := false;
setLength(subLocs, 1);
with subLocs[0] do
begin
name := 'Varrock East Fountain';
tileBox := intToBox(3235, 3431, 3242, 3438);
objects := [FOUNTAIN_VE];
end;
end;
// Varrock
// East
LOC_VE_TREES = 10;
LOC_VE_OAKS = 11;
LOC_VE_BANK = 12;
LOC_VE_MINE = 13;
LOC_VE_FOUNTAIN = 14;
// West
LOC_VW_BANK = 15;
LOC_VW_MINE = 16;
4. Creating the TMaterial records
- An MSI material is defined by an item that is made from other items.
- For a Clay Softener, the material is Soft Clay that's made from regular Clay.
- Creating a TMaterial record is exactly the same as a TLocation record.
- Copy an existing record from Materials.simba, replace with the information you need, and add it to the end of MSI_GetMaterial.
MATERIAL_CLAY:
with Result do
begin
Name := 'Clay'; // Name
Supplies := [TIntegerArray([ORE_CLAY, -1])]; // What is required + the amount (-1 = withdraw all)
Produces := [CLAY_SOFT]; // Items that are produced
MemberOnly := False; // Members or F2P
Level := -1; // Skill level required (since there's no skill for a Clay Softener, set to 1)
end;
const
// Fish for cooking
MATERIAL_SHRIMP = 70;
MATERIAL_CRAYFISH = 71;
MATERIAL_SARDINE = 72;
MATERIAL_HERRING = 73;
MATERIAL_ANCHOVIE = 74;
MATERIAL_TROUT = 75;
MATERIAL_PIKE = 76;
MATERIAL_SALMON = 77;
MATERIAL_TUNA = 78;
MATERIAL_LOBSTER = 79;
MATERIAL_SWORDFISH = 80;
// Money making
MATERIAL_CLAY = 90; // Clay to Soft Clay
5. Creating the TScript record
- Just like the other records, copy one from Scripts.simba, change what needs to be changed, and add it to MSI_LoadScript.
SCRIPT_VE_SOFTENER:
with MSI_Scripts[whichScript] do
begin
Name := 'Varrock East Clay Softener'; // Name of the script
Constant := SCRIPT_VE_SOFTENER; // The constant you make up
SkillName := 'N/A'; // The skill involved
SkillConst := SKILL_NONE; // The skill's constant
BankType := Bank; // The bank type from the TBank set in Globals.simba
WhichBank := MSI_BANK_VE; // Which bank the script banks at (don't set if there isn't a bank)
GetMaterials := True; // True if items need to be withdrawn
AutoObjects := @MSI_SoftenClay; // See below
BankObjects := @MSI_BankWithdraw; // See below
PlayerSetup := @MSI_SetupSoftener; // See below
with Defaults do
begin
Objects := [FOUNTAIN_VE]; // The main screen objects involved (this may need a different name depending on the skill; see TScriptSetup)
Materials := [MATERIAL_CLAY]; // The materials used
end;
with PathInfo do
begin
StartLoc := LOC_VE_BANK; // The starting location of the script
EndLoc := LOC_VE_FOUNTAIN; // The ending location of the script
// See below for Reflection & SPSAreas fields
Reflection := [
TPointArray([Point(3254, 3421), Point(3241, 3434)])
];
SPSAreas := [
TStringArray(['11_7'])
];
end;
end;
- These points are very important, so read carefully:
- The starting location and ending location has to be included in the path. In this case, it's Varrock East Bank and Varrock East Fountain.
- The path has to start at the bank and finish at the fountain.
- The points should be as far apart as possible. If it's a direct path, then there should only be two points, otherwise points should go around fences, walls, etc.
- Do not forget to set the offsets in the PathMaker tool.
- The PathMater Tool will make the path making go much faster, so I highly recommend using it.
- Here's the path I made for a Varrock East Clay Softener:
- Notice how there are no "in between" points since it's a direct path.
- Simply make the path, and enter the points in the record.
- If your path has an obstacle (i.e. door or ladder) check out the script record for the Crafting Guild Miner. You'll also have to set the Obstacle attributes in the script's record (I'll cover obstacle records later in the guide or you can look at the Crafting Guild Miner record for reference).
- For SPSAreas, check out this thread. You'll notice that MSI's is a 2D array. This is because there may be different SPS Areas or Surfaces for different parts of the path (i.e. an essence miner).
// Money Making
SCRIPT_VE_SOFTENER = 100;
SCRIPT_ARRAY_LENGTH = 100; // Change to the highest script constant
6. Creating the Skill/Script-Specific file
- The first thing to do is save a "template" file as Money_Making.simba in my MSI/MSI/Skills folder.
- This "template" file should include the documentation as well as the required functions.
- Since I've created a new file, this file needs to be included in MSI so everything will compile properly, and the functions in the file can actually be used.
- Open Setup.simba and add Money_Making.simba to the include list along with all the other skill files.
//MSI Skill Files
{$i MSI/MSI/Skills/Woodcutting.simba}
{$i MSI/MSI/Skills/Mining.simba}
{$i MSI/MSI/Skills/Fishing.simba}
{$i MSI/MSI/Skills/Cooking.simba}
{$i MSI/MSI/Skills/Magic.simba}
{$i MSI/MSI/Skills/Money_Making.simba}
(*
Money_Making
============
The Money_Making file holds any procedures/functions that are specific to
money making scripts. This file will generally hold only the functions that
are pointed to attributes of the TScript record.
The source for Money_Making.simba can be found
`here <https://github.com/SRL/MSI/raw/master/MSI/Core/Money_Making.simba>`_.
*)
(*
MSI_SetupSoftener
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function MSI_SetupSoftener(): Boolean;
Sets the player up to use a Clay Softener script. This procedure is pointed
to the script's SetupPlayer attribute.
.. note::
| Author: Coh3n
| Last Updated: 27 April 2011 by Coh3n
Example:
.. code-block:: pascal
MSI_Scripts[SCRIPT_VE_SOFTENER].SetupPlayer := @MSI_SetupSoftener;
*)
function MSI_SetupSoftener(): Boolean;
var
material: TMaterial;
begin
if (not loggedIn) then
exit;
// MSI_SetupCooking is exactly what we need to setup the Clay Softener
result := MSI_SetupCooking();
end;
(*
MSI_SoftenAll
~~~~~~~~~~~~~
.. code-block:: pascal
function MSI_SoftenAll(material: TMaterial): Boolean;
Returns true if successfully selected the 'material' option from the selection
screen in the chat box.
.. note::
| Author: Coh3n
| Last Updated: 28 April 2011 by Coh3n
Example:
.. code-block:: pascal
function MSI_SoftenClay(): Boolean;
begin
with MSI_Players[CurrentPlayer].Scripts[CurrentScript] do
Result := MSI_ConvertMaterial(@MSI_SoftenAll, Objects);
end;
*)
function MSI_SoftenAll(material: TMaterial): boolean;
var
i, x, y: integer;
begin
if (waitFunc(@MSI_CB_DoAllScreen, 50, 5000)) then // Wait for the selection screen to appear
for i := 0 to high(material.produces) do
if (findDTM(MSI_Items[material.produces[i]].DTM, x, y, MCX1, MCY1, MCX2, MCY2)) then // Look for the material's DTMs in the chat box
begin
MMouse(x, y, -25, 25);
if (waitUpTextMulti(['Make All', 'ake', 'll'], 500)) then
begin
Mouse(x, y, 0, 0, true);
result := true;
break;
end;
end;
if (result) then
MSI_SubDebug('Started to convert material: '+material.name);
end;
(*
MSI_SoftenClay
~~~~~~~~~~~~~~
.. code-block:: pascal
function MSI_SoftenClay(): Boolean;
Returns true if all the clay in the player's inventory have been softened. This
is the procedure that is pointed to the script's AutoObjects attribute.
.. note::
| Author: Coh3n
| Last Updated: 27 April 2011 by Coh3n
Example:
.. code-block:: pascal
MSI_Scripts[SCRIPT_VE_SOFTENER].AutoObjects := @MSI_SoftenClay;
*)
function MSI_SoftenClay(): Boolean;
begin
with MSI_Players[CurrentPlayer].Scripts[CurrentScript] do
Result := MSI_ConvertMaterial(@MSI_SoftenAll, Objects); // ConvertMaterial is in Materials.simba
end;
// MSI_SetReportItems
SKILL_COOKING, SKILL_NONE: // skills that use materials
begin
mat := MSI_GetMaterial(result[i]);
setLength(items[sIndex][i], length(mat.produces));
items[sIndex][i] := mat.produces;
end;
// MSI_SetReportInfo
SKILL_COOKING, SKILL_NONE:
begin
scripts[j].materials := MSI_SetReportItems(i, j, scripts[j].materials, script.defaults.materials);
scripts[j].cookingSpot := script.defaults.cookingSpot;
scripts[j].objects := script.defaults.objects;
end;
7. Adding to MSI's Progress Report
- There are several functions/procedures that need to be edited for the progress report to work with a new skill. Here is a list of all the procedures that include a skill case. This means that these procedures need to be updated every time a new skill is updated. Not all of the procedures, however, will need to be updated for every skill.
MSI_BestTool (Skills.simba)- No tools are required for a Clay SoftenerMSI_WorstTool (Skills.simba)- No tools are required for a Clay SoftenerMSI_AutoInvFull (Skills.simba)- AutoInvFull is used for gatherers, not manipulatorsMSI_GetItemExperiences (Items.simba)- No experience is gained from a Clay Softener- MSI_GetPlayerObjects (Objects.simba)
- Added the objects used for this skill to the case
SKILL_NONE:
objs := Scripts[CurrentScript].Objects;
- Since there could be more than one script with no skill, I added a nested case in this procedure.
SKILL_NONE:
case Scripts[j].Name of
SCRIPT_VE_SOFTENER:
IncEx(totals[TOTAL_SOFTENS], ReportInfo.ItemAmounts[j][k][l]);
end;
- This one is simple, just add SKILL_NONE to the end of the standard report case.
SKILL_MINING, SKILL_WOODCUTTING, SKILL_FISHING, SKILL_COOKING, SKILL_NONE:
8. Testing the newly created script
- Now, because there wasn't a lot to do for a Clay Softener, I didn't have to do much tweaking. I'm sure that bugs will come up, but before sending a Pull Request to an MSI Developer (see the git part of this tutorial), you should be able to produce a progress report such as this:
This progress report was written April 28th, 2011 at 04:53:28 AM
{----------------------------------------------------------------}
{ MSI Phoenix Short Report }
{----------------------------------------------------------------}
{ Time Running: 1 Hours, 53 Minutes and 12 Seconds }
{----------------------------------------------------------------}
{ }
{ Totals: }
{ - Players: 8 }
{ - Player Time: 01h 44m 00s }
{ - Randoms Solved: 0 }
{ - Randoms Failed: 0 }
{ - Loads: 190 }
{ - Clay Softened 2,660 }
{ }
{----------------------------------------------------------------}
{----------------------------------------------------------------}
{----------------------------------------------------------------}
{ MSI Phoenix Player Report }
{----------------------------------------------------------------}
{ Time Running: 1 Hours, 53 Minutes and 13 Seconds }
{----------------------------------------------------------------}
{ }
{ Player 0: *********** }
{ Location: Varrock east bank }
{ Time: 12m 04s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 12m 04s }
{ Loads: 22 }
{ Item: Soft Clay }
{ Amount: 308 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 1: *********** }
{ Location: Varrock east bank }
{ Time: 14m 07s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 14m 07s }
{ Loads: 26 }
{ Item: Soft Clay }
{ Amount: 364 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 2: *********** }
{ Location: Varrock east bank }
{ Time: 12m 02s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 12m 02s }
{ Loads: 22 }
{ Item: Soft Clay }
{ Amount: 308 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 3: ********* }
{ Location: Varrock east bank }
{ Time: 11m 51s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 11m 51s }
{ Loads: 22 }
{ Item: Soft Clay }
{ Amount: 308 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 4: ************ }
{ Location: Varrock east bank }
{ Time: 13m 56s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 13m 56s }
{ Loads: 26 }
{ Item: Soft Clay }
{ Amount: 364 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 5: ************ }
{ Location: Varrock east bank }
{ Time: 13m 57s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 13m 57s }
{ Loads: 24 }
{ Item: Soft Clay }
{ Amount: 336 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 6: ************ }
{ Location: Varrock east bank }
{ Time: 13m 09s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 13m 09s }
{ Loads: 24 }
{ Item: Soft Clay }
{ Amount: 336 }
{ }
{----------------------------------------------------------------}
{ }
{ Player 7: *********** }
{ Location: Varrock east bank }
{ Time: 12m 49s }
{ Active: False }
{ Reason: Finished total time! }
{ }
{ Script: Varrock East Clay Softener }
{ Time: 12m 49s }
{ Loads: 24 }
{ Item: Soft Clay }
{ Amount: 336 }
{ }
{----------------------------------------------------------------}
{----------------------------------------------------------------}
- If you need to test an individual function, just call that function in RunMe.simba:
//MSI_Mainloop;
MSI_FindItemSlots(ORE_CLAY);
end.
Okay, so that's all the code that needs to be changed to make a Clay Softener work with MSI. If you really think about it, a lot of skills will be just that simple since MSI already has almost every function/procedure that is needed.
Not all MSI's records were covered above, so I will outline how to create those below. They are all (for the most part) just as easy, as creating a TMaterial or TLocation record.[/INDENT]
Creating other MSI records:
[INDENT]MSI uses the following main types throughout the include. There are, of course, several other types, but they can be explained well from MSI's Documentation for Globals.simba.
Here are MSI's main types, most of which have been covered with the Clay Softener:
- TItem - A Runescape item found in the inventory or bank.
- TMSObject - A Runescape object found on the main screen.
- TLocation - A Runescape location.
- TMaterial - A Runescape item that is changed into another item.
- TAnimation - A player animation (uses 100% color).
- TObstacle - A Runescape obstacle (i.e. door, ladder, or wall).
- TScript - All the necessary attributes of an MSI script.
- TAnimation Simply copy/paste the new animation in to MSI_GetAnimation located in Animating.simba, and add the constant to Globals.simba. The TAnimation record from Gloabls.simba:
type
TAnimation = record
Name : string;
MinPixelShift : Integer; // Minimum pixel shift for animation
MaxPixelShift : Integer; // Maximum pixel shift
PixelBox : TBox; // Box to check for pixel shift
Interval : Integer; // How long to check for pixel shift
MaxTime : Integer; // Gets the average pixel shift from Interval over MaxTime
WaitTime : Integer; // How long to wait for animation in ms
end;
TAnimationArray = array of TAnimation;
An example declaration from Animating.simba:
ANIM_CHOPPING:
with Result do
begin
Name := 'Chopping'; // Name
MinPixelShift := 120; // Minimum pixel shift in 'PixelBox'
MaxPixelShift := 360; // Maximum pixel shift
PixelBox := IntToBox(PLBX1, PLBY1, PLBX2, PLBY2); // The box to check for the pixel shift
Interval := 50; // How long (ms) to check for pixel shift
MaxTime := 250; // (35 * 5) = 175 (Gets the average pixel shift from 5 tries)
WaitTime := 700; // (175 * 4) = 700 (Has to fail 4 times to not be animating)
end;
The constant additions to Globals.simba.
const
ANIM_IDLE = 0;
ANIM_ALCH_LOW = 10;
ANIM_ALCH_HIGH = 11;
ANIM_FISHING = 20;
ANIM_CHOPPING = 21;
Basically, the animating functions will return true if the average pixel shift in the box 'PixelBox' during 'Interval' and 'MaxTime' is in range of 'MinPixelShift' and 'MaxPixelShift'. It will keep trying for 'WaitTime'. I hope that made sense. :p
Keep in mind that it may take a lot of testing to get an animation just right and I recommend writing a smaller script to get gather pixel shifts so you can make the TAnimation more accurate. An animation aiding script can be found in MSI/DevelopingTools/aid_TAnimation.
TObstacle = record
Name : string;
Constant : Integer; // Obstacle constant
Symbol : String; // A possible symbol for or near the obstacle
MirText : TStringArray; // Text that may appear in the chat box
ObjConst : Integer; // Object constant
ObjMir : Integer; // Object's mirror constant
ObjMirArea : TBox; // Obstacle's mirror search area
MirAction : TMouseOption; // What to do if the object is found on the MS
Camera : TVariantArray; // Changes the camera angle and height
end;
And here a couple examples from Obstacles.simba:
OBS_LADDER_MG_DOWN:
with result do
begin
Name := 'OBS_LADDER_MG_DOWN';
ObjConst := LADDER_MG_DOWN;
ObjMir := LADDER_MG_UP;
ObjMirArea := intToBox(MSCX - 85, MSCY - 85, MSCX + 85, MSCY + 85);
MirAction := moNothing;
Camera := ['n', true];
end;
OBS_RUINS_AIR:
with result do
begin
Name := 'OBS_RUINS_AIR';
Symbol := 'Runecrafting';
ObjConst := RUINS_AIR;
ObjMir := PORTAL_AIR;
ObjMirArea := MSBox;
MirAction := moNothing;
Camera := ['n', true];
end;
The addition of the proper constant (Ctrl + F for "TObstacle" to find the constants in the file):
const
OBS_LADDER_MG_DOWN = 10;
// other obstacle constants here
OBS_RUINS_AIR = 50;
// other obstacle constants here
Keep in mind that you may have to create some TMSObject records if you're creating a new obstacle.There they are. That's the last of the main MSI records. Not too difficult is it? :rolleyes: If there's something you don't understand I encourage you to take a look at MSI's Documentation for better explanations and examples of each of MSI's functions and procedures.[/INDENT]
Adding a location/script for an existing skill:
[INDENT]This is actually much easier than you may think. All that has to be done is creating the TScript record, and since the skill exists, the functions already exist! So simply follow the steps for creating a TScript record above, and you're good to go. :)[/INDENT]
Creating an MSI Extra:
[INDENT]An MSI Extra is a completely separate file that includes functions/procedures that can be called sometime within MSI. For example, Bobzilla69 made a CharacterStats extension that will get a players stats and save it to a file so it can be opened in HTML format. An extra can be anything from a world walker to some advanced antiban that someone needs testing. Of course, the users will be able to choose which they want to use by simply commenting/uncommenting defines at the top of RunMe.simba.
For a detailed guide on exactly how to create an MSI Extra, please visit this tutorial.[/INDENT]
Useful links:
[INDENT]There is going to be some of this guide that you probably won't understand, so here is a few useful links that may help you to understand a little better.
- Introduction to git. If you want to be an active developer for MSI, I strongly recommend you get used to git. Now that I'm used to it, I'll never use anything else.
- MSI's Documentation is very useful if you want descriptions and examples of one of MSI's procedures or functions.
- The MSI Phoenix SVN section has a lot of development discussions that you may want to take a look at.
- If you just want to contribute on a smaller scale than a new skill, I encourage you to check out the MSI Core to-do List. I'm sure you can find something on there that catches your interest.
Conclusion:
[INDENT]Well that's it. Everything you need to know to contribute to MSI. You will, of course, learn several things the more to contribute, but this is all you need to get started. If there is something that is unclear or you don't understand, don't hesitate to post on this thread and myself or someone else will help you as soon as possible.
You should also know that git can be frustrating if you're new to it, so again, I urge you to post here so we can help you. I am very familiar with git now, so I should be able to help you. Any problems you're having, chances are I've had the exact same problems. You can also make a thread in the MSI Help section. :)
I hope this guide was helpful and I strongly recommend getting involved with MSI. It's a great teamwork environment and it's core has been written and is continually updated for the ease of future updates and additions.
[/INDENT]
Cheers,
The MSI Team
