SRL Archive - SRL Archives

AlignMM...straightens lines on MM


XcanadamanX

2007-11-29 19:00:56

Well here it is not to complicated. so far it has worked perfectly in Al Kharid. it works in any direction. just make sure its close to the angle before you call this. it is like someone elses (sorry cant remember on the top of my head) but mine uses the angle the dtm is found at. the accuracy's can be changed to your liking.
Procedure AlignMM;
var DTM,x,y,i:integer;
acc:extended;
begin
DTM := DTMFromString('78DA634C676260086240016F9F7C641001D28' +
'C40FC1F0818416AFC71AB0101B09A7022D44413A1C60BBF1A009F' +
'1015DF');
wait(50)
if FindDtmRotated(DTM,x,y,MMX1,MMY1,MMX2,MMY2,radians(-40),radians(40),0.01,acc) then
begin
if (acc < 0.1) and (acc > -0.1) then
exit
else
begin
repeat
If FindDtmRotated(DTM,x,y,MMX1,MMY1,MMX2,MMY2,radians(-40),radians(40),0.01,acc) then
begin
if acc < 0 then
begin
KeyDown(VK_RIGHT)
Wait(20+random(10))
KeyUp(VK_RIGHT)
end;
if acc > 0 then
Begin
KeyDown(VK_LEFT)
Wait(20+random(10))
KeyUp(VK_LEFT)
end;
if acc = 0 then break;
end else
exit;
wait(20)
Inc(i)
until (((acc < 0.1) and (acc > -0.1)) or (i > 25))
end;
end;
freeDtm(DTM)
end;

usage:

begin
makecompass('w')
AlignMM
end;

Timothegreat

2007-11-29 23:51:10

nice job! very useful, should be used instead of makecompass('N')

neG

2007-11-30 01:19:09

Awesome!
There are about 3 different versions of mm aligners that use DTMs now :)
Its good to see it done different ways!

n3ss3s

2007-11-30 01:39:44

Good job!

Hehe, SRL / SCAR still doesn't have one…

OMG I invented a kickass way to do it! :stirthepot:

EDIT: (starring tpas :p)

Rikje

2007-11-30 04:15:32

I made one with Tpas that work in falador :p

looks good :)
did you made a failsave that when it dind't found the line it just set the compass with the normal function?

XcanadamanX

2007-11-30 07:57:24

no i didnt think of that. ill do that when i get back from school

FrÕzÑ_§ÕµL

2007-12-02 13:51:06

Any chance you can PM me when you've added the fail safe? This will be invaluable if it works :D

XcanadamanX

2007-12-02 13:53:10

will do.


Try That
Procedure AlignMM(Direction:string);
var DTM,x,y,i:integer;
acc:extended;
begin
DTM := DTMFromString('78DA634C676260086240016F9F7C641001D28' +
'C40FC1F0818416AFC71AB0101B09A7022D44413A1C60BBF1A009F' +
'1015DF');
wait(50)
if FindDtmRotated(DTM,x,y,MMX1,MMY1,MMX2,MMY2,radians(-40),radians(40),0.01,acc) then
begin
if (acc < 0.1) and (acc > -0.1) then
exit
else
begin
repeat
If FindDtmRotated(DTM,x,y,MMX1,MMY1,MMX2,MMY2,radians(-40),radians(40),0.01,acc) then
begin
if acc < 0 then
begin
KeyDown(VK_RIGHT)
Wait(20+random(10))
KeyUp(VK_RIGHT)
end;
if acc > 0 then
Begin
KeyDown(VK_LEFT)
Wait(20+random(10))
KeyUp(VK_LEFT)
end;
if acc = 0 then break;
end else
exit;
wait(20)
Inc(i)
until (((acc < 0.1) and (acc > -0.1)) or (i > 25))
end;
end else MakeCompass(Direction)
freeDtm(DTM)
end;

but make sure you have MakeCompass(whateverdirection) in your script. this just aligns the mm. failsafe is added. havent tested it but hopefully that works

FrÕzÑ_§ÕµL

2007-12-02 18:03:14

TY very much u rok.

XcanadamanX

2007-12-02 20:28:05

sorry i forgot to PM you.
glad you like it:D

FrÕzÑ_§ÕµL

2007-12-03 17:53:03

It's ok. Oh and the one you just posted doesn't compile because of MakeCompass(Direction : Char) you used string :) needs to be

Procedure AlignMM(Direction: char);

XcanadamanX

2007-12-03 17:55:23

no just do Procedure AlignMM('n'); or Procedure AlignMM('s'); that should work

FrÕzÑ_§ÕµL

2007-12-03 17:59:41

Woot sweet thankyou! no because you declared direction as string, makecompass uses char.

This is awesome, you have saved my script!
THANK YOU XCANADAMANX! I'm reserving a place in the script for you :D

XcanadamanX

2007-12-03 18:01:44

// * function MakeCompass(Side: String);

it uses a string. im glad i could help! :p

FrÕzÑ_§ÕµL

2007-12-03 18:11:39

{*******************************************************************************
function MakeCompass(Side: String);
By: Wizzup? and modified by Ron
Description: Aligns RS to specified direction
direction: set to: North='n', South='s', East='e', West='w'
*******************************************************************************}

function MakeCompass(Side: char): Boolean;

See ^^ it is a char lol! If you don't believe me stick it in scar and it won't compile till you make it char :) But I don't see why this really matters at all because it only aligns if it is close to the angle, so you have to call MakeCompass first right, so then calling it after this fails won't even change anything lol? I put this in the script:

{*************************************************************************************************
Procedure AlignMM(Direction : char);
By: xcanadamanx
Description: Rotates compass to perfectly align with nearest compass angle.
Direction : Direction to make compass if fails to align.
*************************************************************************************************}

And then to show how awesome you are:

//MASSIVE OMG THANKS TO XCANADAMANX FOR ALIGNMM!
//I recommend using Mozilla FireFox. The script runs much better on it. Get it at www.mozilla.com.
//You must have your axe in Inventory Slot 1!
//Start in Bank. See above for recommended booths.

Procedure DeclarePlayers;

:D how can anyone miss it in full caps right above declare players?!

Thanks again!

XcanadamanX

2007-12-03 18:17:15

lol most people probably wont even read the top. :p Thank YOU for using it!

FrÕzÑ_§ÕµL

2007-12-03 18:27:31

So what exactly is the DTM of? A Building? Bacause it works perfect when walking from bank but not when walking back to it lol? Doesn't really matter, I can call it later than I want, but just wonderin?

XcanadamanX

2007-12-03 18:32:32

its of a small part of a line