SRL Archive - MSI Archives

[OUTDATED] How to write color walking for MSI


Camaro'

2010-12-10 16:22:23

Color Walking Tutorial for MSI
Last Updated: December 10th, 2010




[INDENT]

This tutorial is a tutorial on how to write color walking procedures for MSI.

Walking In Runescape


[INDENT]
There are currently two types of ways to walk in runescape(with simba :))

  • Reflection
[INDENT]
[INDENT]
Reflection walking is a much simpler way to walk along runescape, MSI does use this, but when runescape updates, this method no longer is usable for a period of time. This is why we use color walking also. That way, if runescape updates we can still auto :)
[/INDENT]
[/INDENT]

  • Color
[INDENT]
[INDENT]Color walking is not as easy as reflection walking, but it is still pretty simple. Color walking uses the SRL include to find colors on the minimap to detect where to walk. This tutorial is going to teach you how to color walk with MSI.[/INDENT]
[/INDENT]
[/INDENT]
[/INDENT]

[INDENT]
MSI Color Walking


[INDENT]

After you finish this tutorial, you should test your code a million times to make sure it works perfectly. So to do this, go to Setup.simba and comment the line that includes reflection, then when you load up MSI, it will automatically color walk for you :)

There is a series of steps you should follow to color walk in MSI.

  • Globals.simba

[INDENT]
[INDENT]

First, lets open up globals.simba.


WALK_WC_GE_YEW_BANK_1

CTRL + F and find out where that line is. You should see that there is a lot of names similar to this next to it. Each variable there (WALK_WC_GE_YEW_BANK_1) is one click on the minimap. For example, that line will click the first click from GE Yews to the GE. Now its time to figure out how to add yours

Tips:
  • All Capitals
  • Follow the correct format
  • Must have a variable for each one of your MM clicks.
  • Separate Each word with " _ " (without quotes)

It must start with
WALK
Then comes the abbreviated skill
WC
Next is the abbreviated location
GE
If your location (GE) has more then one type of area to bot(Trees, Yews), you need to declare where it is for
YEW
If you are walking on the way to the bank, you need
BANK
Finally, the step of the walking it is on (Hard to explain)
1


So for example, if you are doing port sarim willow to deposit box…

 
WALK_WC_PS_WILLOW_1
WALK_WC_PS_WILLOW_2
WALK_WC_PS_WILLOW_BANK_1
WALK_WC_PS_WILLOW_BANK_2

This should be it for globals.simba, before you close out of it, just take a glance of the color constants used.
[/INDENT]
[/INDENT]



  • Scripts.simba
[INDENT]
[INDENT]

Simply go to the script record you are adding color walking too, and find this

Reflection := [
TPointArray([Point(3253, 3421), Point(3265, 3428),
Point(3275, 3429), Point(3280, 3439),
Point(3276, 3450)])
];


now after it add this



ColorTo := [
WALK_WC_PS_WILLOW_1,
WALK_WC_PS_WILLOW_2

];

ColorFrom := [
WALK_WC_PS_WILLOW_BANK_1,
WALK_WC_PS_WILLOW_BANK_2
];

All this is doing, is simply telling MSI that this script has color walking paths. You may close scripts.simba.
[/INDENT]
[/INDENT]
[/INDENT]
[/INDENT]
[INDENT]
[INDENT]


  • Walking_Color.simba
[INDENT]
[INDENT]

OK, open up walking_color.simba and look around for a bit.

Your walking function should return a TPoint.

Here is a base function of your walking function.

{******************************************************************************}
{ function MSI_WC_PSPoints(Index: Integer): TPoint; }
{ By: You }
{ Date: 10 December 2010 }
{ Description: Returns a point on the minimap depending on the specified }
{ location by 'index' }
{******************************************************************************}
function MSI_WC_PSPoints(Index: Integer): TPoint;
var
TPA: TPointArray;
I , X, Y :Integer;
begin
Result := Point(-1, -1);

case Index of
WALK_WC_PS_WILLOW_1:
begin
//Return a TPoint of the first click to the willows.
end;

WALK_WC_PS_WILLOW_2:
begin
//Return a TPoint of the second click to the willows.
end;

WALK_WC_PS_WILLOW_BANK_1:
begin
//Return a TPoint of the first click to the deposit box.
end;

WALK_WC_PS_WILLOW_BANK_2:
begin
//Return a TPoint of the second click to the deposit box.
end;

else
MSI_SubDebug('MSI_PS_GEPoints: Invalid walk point!');
end;
end;

This function will get called whenever you are color walking in port sarim.

Most MSI Walking use TPA's, you can use what ever you want, just make sure it returns a TPoint.

Now, to make this function actually work, you have to go to the function

MSI_CreateWalkIndex

This function tells MSI where to walk ;)

Just add your constants in as follows

FirstClick..LastClick:
Result := YourWalkingFunction(index);

In our case, it is going to be


WALK_WC_PS_WILLOW_1..WALK_WC_PS_WILLOW_BANK_2:
Result := MSI_WC_PSPoints(index);

Now, this is not needed, but it is STRONGLY recommended that you do so. Create some fail safes, just in case your function fails, it will use the failsafe. Do so here

MSI_CreateWalkFailsafe

Just follow the format, and for each one of your constants add a fail safe alternative.


[/INDENT]
[/INDENT]
[/INDENT]
[/INDENT]
[INDENT]
Common Errors


[INDENT]
This section is for any errors that comes up and how to fix them.

  • Error 1
[INDENT]
[INDENT]Error 1 explanation and fix.
[/INDENT]
[/INDENT]

  • Error 2
[INDENT]
[INDENT]Error 2 explaination, and fix.[/INDENT]
[/INDENT]
[/INDENT]
[/INDENT]

Coh3n

2010-12-10 16:26:13

Nice. :) Maybe add a section for common errors as they come up? Things like out of range errors or the like.

Camaro'

2010-12-10 16:33:43

From: Coh3n
Nice. :) Maybe add a section for common errors as they come up? Things like out of range errors or the like.


Done. Now all I have to do is add the error as it shows up. Thanks for the comment.

Gu3st...

2010-12-10 16:52:40

Good job! :)
You could expand this to "How to code walking for MSI" as reflection walking would be easy to add

Camaro'

2010-12-10 17:20:28

From: Zyt3x
Good job! :)
You could expand this to "How to code walking for MSI" as reflection walking would be easy to add


Yea, I could do that, but Coh3n made a tutorial some where(fast, but it gets the job done). Can't remember where it was though.

Edit: Its in here

http://villavu.com/forum/showthread.php?t=57726

Coh3n

2010-12-10 17:26:48

[QUOTE=Camaro';757773]Yea, I could do that, but Coh3n made a tutorial some where(fast, but it gets the job done). Can't remember where it was though.

Edit: Its in here

http://villavu.com/forum/showthread.php?t=57726
Yeah, I plan on expanding that guide a lot. :) Probably wont be for a couple weeks though.

nickrules

2010-12-10 17:58:27

So Color walking just returns a TPoint? I don't have access to my computer with MSI, so I can't look now… But where does the 'color' part come into play?

or is it more like TPA walking?
eg

Findcolors(a,s,d,f)
SortTPAFrom(a, Point(44,44)) //random points. And I *think* thats the right function. Don't count on it :p
result := a[0];

Coh3n

2010-12-10 18:27:38

It returns the point that is going to be clicked. How that point is found is up to the scripter.

NCDS

2010-12-10 18:35:15

Nice job with this Camaro. :)

I just had a quick 'once-over' but it looked pretty nice.

Camaro'

2010-12-10 20:32:12

Thanks NCDS ;)