PDA

View Full Version : OpenDoor



n3ss3s
10-26-2007, 04:02 PM
I was walking past some doors and I thought that maybe I should make a door opener, nobody likes opening doors, they're always a trouble, so, I made this function - its simple but works.

I recommend using OpenDoor(True) so it will rotate, because when door is closed, outer side of it is pretty much darker than the inner side, and when door is open its the opposite, so use the rotation.

You are free to use, just credit me properly.


Function OpenDoor(Rotate: Boolean): Boolean;
Var
TPA, TPA2: TPointArray;
C, X, Y, I: Integer;
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
For I := 0 To 3 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2189191, 20, 20, MSX2 - 10, MSY2 - 10, 10);
For C := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[c];
FindColorsTolerance(TPA2, 2189191, TP.x - 25, TP.y - 25, TP.x + 25, TP.y + 25, 10);
If(GetArrayLength(TPA2) > 150)Then
Begin
MiddleTPAEx(TPA2, X, Y);
MMouse(X, Y, 5, 5);
If(Pos('lose', GetUpText) > 0)Then
Begin
Result := True;
Exit;
End Else
Begin
If(Pos('pen', GetUpText) > 0)Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 1, 1, True);
Result := True;
Exit;
End;
End;
End;
End;
If Not Rotate Then
Begin
Exit;
End Else
Begin
ActivateClient;
Wait(125 + Random(25));
SendArrowSilentWait(1, 1100 + Random(150));
End;
End;
End;

Wizzup?
10-26-2007, 04:35 PM
What kind of door is this for?

n3ss3s
10-26-2007, 04:43 PM
I made it with the Al-Kharid doors, so Im pretty sure its for the Misthalin doors (varrock, lumby, draynor) etc.

EDIT: Fally is not in misthalin..

vasu
10-26-2007, 07:06 PM
thanks, i was thinking to make own script so i need this :)

ShowerThoughts
10-26-2007, 07:08 PM
kk thanks it could work!

n3ss3s
10-26-2007, 07:30 PM
Thats good vasu..

Hermpie, seriously, some control to that spam,
it could work! I wouldnt post it if it didnt work would I?

Smartzkid
10-26-2007, 07:42 PM
You got IM? I'd like to talk to you about this objectfinding stuff, if you've got the time.

Looks nice, I'll see what I can learn from it :)

mastaraymond
10-26-2007, 07:45 PM
May i ask you something?

Make 1 post.. Object Finding Procedures By N3ss3s... Kinda annoying making a separate post for every object finding procedure ^^. Oh and maybe, just a suggestion.. Stop making those functions and start making some real stuff, full working scripts maybe?

~Raymond

ShowerThoughts
10-26-2007, 08:06 PM
Thats good vasu..

Hermpie, seriously, some control to that spam, I wouldnt post it if it didnt work would I?

im making a lumby spinner so i said it could work, i mean i will try and maybe it could work, see it like positive

n3ss3s
11-03-2007, 01:04 PM
Ray I have a miner which works, everything else works fully except for SRL walking.

Smartz, tornaado_peluri@hotmail.com

@nawbz, dont add..

Masta everybody has their own 'direction' of scripting..

mastaraymond
11-03-2007, 01:35 PM
Ray I have a miner which works, everything else works fully except for SRL walking.

Smartz, tornaado_peluri@hotmail.com

@nawbz, dont add..

Masta everybody has their own 'direction' of scripting.. I know. I mean that you can keep making those functions\procedures, not many people will use them (maybe none). But if you make a pwnage kicking script with uber 1337 object finding, many people will use it. You will become famous!

JuKKa
11-03-2007, 02:53 PM
Nesses make a object finder that detects if the door is open using TPA's

Heres a fast one i created


Program Test;
{.Include SRL/SRL.Scar}

Function DoorPixels(DoorColor, x1, y1, x2, y2: Integer): Integer;
Var
DoorTPA: TPointArray;
Begin
FindColorsTolerance(DoorTPA, DoorColor, x1, y1, x2, y2, 10);
Result := GetArrayLength(DoorTPA)-1;
End;

Function OpenDoor(DoorColor, x1, y1, x2, y2: Integer): Boolean;
Var
i, X, Y, DoorPixelAmount: Integer;
DoorTPA, DoorTPA2: TPointArray;
Begin
LowestAngle;
MakeCompass('n');
Wait(300+Random(300));
DoorPixelAmount := DoorPixels(DoorColor, x1, y1, x2, y2);
Writeln('Found: '+IntToStr(DoorPixelAmount)+' Door Pixels');
If(DoorPixelAmount > 200)Then
Writeln('Door is closed')
Else Writeln('Door is open');
HighestAngle;
End;

Begin
SetupSRL; //MSCX-100, MSCY-100, MSCX+100, MSCY+100
OpenDoor(4615805, MSCX-100, MSCY-100, MSCX+100, MSCY+100);
End.


Test in edge at the stove.

Wizzup?
11-03-2007, 03:07 PM
Nesses make a object finder that detects if the door is open using TPA's

Heres a fast one i created


Program Test;
{.Include SRL/SRL.Scar}

Function DoorPixels(DoorColor, x1, y1, x2, y2: Integer): Integer;
Var
DoorTPA: TPointArray;
Begin
FindColorsTolerance(DoorTPA, DoorColor, x1, y1, x2, y2, 10);
Result := GetArrayLength(DoorTPA)-1;
End;

Function OpenDoor(DoorColor, x1, y1, x2, y2: Integer): Boolean;
Var
i, X, Y, DoorPixelAmount: Integer;
DoorTPA, DoorTPA2: TPointArray;
Begin
LowestAngle;
MakeCompass('n');
Wait(300+Random(300));
DoorPixelAmount := DoorPixels(DoorColor, x1, y1, x2, y2);
Writeln('Found: '+IntToStr(DoorPixelAmount)+' Door Pixels');
If(DoorPixelAmount > 200)Then
Writeln('Door is closed')
Else Writeln('Door is open');
HighestAngle;
End;

Begin
SetupSRL; //MSCX-100, MSCY-100, MSCX+100, MSCY+100
OpenDoor(4615805, MSCX-100, MSCY-100, MSCX+100, MSCY+100);
End.


Test in edge at the stove.

Or you could get it's angle and compare it to the door's minimap angle. :)

n3ss3s
11-03-2007, 03:10 PM
Yeah... Btw Wizzy, Im having sometimes problems with MakeCompass, I do activateclient and all, but MakeCompass doesn't do anything :confused: YAY WORKS!
EDIT:
What kind of door is this for? Misthalin, what about it?

EE: Masta, true, but for example CM4D (coal miner for desert) has good place for obj finding, the rocks. But then the walking is hard to get stable =( Im trying to think of some script that people would love, and also had objects to find. Like, a killer is nice, but they arent so popular as ess miners etc and only one object to find, and the NPC usually differs from the nature so a simple like FindColorTolerance is enough...

Yay 2,8k posts..

EEE: Also Wizzy if I may request, could the 75-year old woman bla bla be closed? Its just a place for pc++

Killerdou
11-03-2007, 03:15 PM
or if it has the same direction as any white points in the area...

n3ss3s
11-03-2007, 03:18 PM
Yeah, but just need to make sure the map is north.

EDIT: Charmz, Wizzy, Killerdou.... My door opener is somehow ub3rspecial, legends are viewing it wtf..

Killerdou
11-03-2007, 03:30 PM
how am i a legend plox

n3ss3s
11-03-2007, 03:33 PM
Well you have your name like everywhere in the WizzyPlugin

EDIT: Now I know.... Clarion v0.8 ;)

ShowerThoughts
11-03-2007, 04:13 PM
Boreas, is viewing :eek:

LordGregGreg
12-28-2007, 02:52 AM
forgive me for the semi grave dig, but i was helping out skilld u on msn, and i thought that it would be helpfull for people to know that this function still works great and can save you quite a bit of trouble opening dorrs.

tested and works.

R0b0t1
12-29-2007, 12:54 AM
Are the doors in mithalin different from Members/Other?

n3ss3s
12-29-2007, 02:15 PM
It depends of the area, what I've seen, Misthalin doors differ from Asgarnia etc, fally doors aren't as dark I think.

Thank you Greg :)