SRL Archive - SRL Archives

First Thieving.Scar function (Stunned)


NCDS

2009-06-30 00:29:32

Just made it today but it has been working perfectly.


{*******************************************************************************
function Stunned: Boolean;
By: NCDS
Description: Return's True if stunned by NPC.
*******************************************************************************}
function Stunned: Boolean;
var P: TPoint; Search: TBox;
begin
P.x := MSCx;
P.y := MSCy;
Search.x1 := P.x - 30;
Search.y1 := P.y - 30;
Search.x2 := P.x + 30;
Search.y2 := P.y + 30;
Result := FindColorTolerance(P.x, P.y, 2155764, Search.x1, Search.y1,
Search.x2, Search.y2, 5) and
IsChatBoxTextBetween('stunned', 0, 7, 8);
end;

Your thoughts..?

ian.

2009-06-30 00:45:44

What if Game is filtered? =X (I'm not sure if it still says you're stunned, but just trying to help ;))

NCDS

2009-06-30 00:49:36

From: 99_ aka ian.
What if Game is filtered? =X (I'm not sure if it still says you're stunned, but just trying to help ;))


The past few day's I have been writing a new thieving script and everytime I get stunned it say's it so AFIAK this will work just fine. I've actually never gotten "stunned" and had it not say it.

Anyone else know anything of this?

ian.

2009-06-30 00:53:40

Don't trust me, haha it's just that they blocked most of the things :)

NCDS

2009-06-30 00:55:02

Alright, well I will look into it ;)

Waddo

2009-06-30 01:07:04

erm fitering the chat is a user feature you turn it on and off
and cant you just use getblackchatmessage('tunned');

Coh3n

2009-06-30 01:15:26

I like it. :) What's not to like? :p

I think it could also be useful in the sense that you can eat a piece of food while you are stunned. When I used to do thieving in RS, I would always eat a slice of cake or 2 when I was stunned. This could increase script efficiency. :)

Nice work, IMO. :)

NCDS

2009-06-30 01:15:28

From: Waddo

and cant you just use getblackchatmessage('tunned');


Either one would work the same.

From: Coh3n
I like it. :) What's not to like? :p

I think it could also be useful in the sense that you can eat a piece of food while you are stunned. When I used to do thieving in RS, I would always eat a slice of cake or 2 when I was stunned. This could increase script efficiency. :)

Nice work, IMO. :)


Thank you :)

ian.

2009-06-30 01:25:42

What Waddo and I were trying to say is that if you right click 'Game' on the chat part (bottom left of game applet), then choose filter, it won't say if you're stunned. It supposedly blocks almost all NPC/object related chat (like it doesn't say you got a log/pick flaxed/etc.)

Coh3n

2009-06-30 01:25:51

From: 99_ aka ian.
What Waddo and I were trying to say is that if you right click 'Game' on the chat part (bottom left of game applet), then choose filter, it won't say if you're stunned. It supposedly blocks almost all NPC/object related chat (like it doesn't say you got a log/pick flaxed/etc.)


Simple solution, just don't filter the game. :p

From: NCDS
Thank you :)


No problem, it will be a nice addition, finally something in Thieving.scar. :)

Naike

2009-06-30 02:14:54

Nice one :)

Shorten..

{*******************************************************************************
function Stunned: Boolean;
By: NCDS
Description: Return's True if stunned by NPC.
*******************************************************************************}
function Stunned: Boolean;
var
P: TPoint;
Search: TBox;
begin
P := Point(MSCX, MSCY);
Searth := IntToBox(P.x - 30, P.y - 30, P.x + 30, P.y + 30);
Result := FindColorTolerance(P.x, P.y, 2155764, Search.x1, Search.y1,
Search.x2, Search.y2, 5) and
IsChatBoxTextBetween('stunned', 0, 7, 8);
end;

NCDS

2009-06-30 18:39:30

From: Coh3n

No problem, it will be a nice addition, finally something in Thieving.scar. :)


From: N1ke!
Nice one :)


Thanks guys ;)

Naum

2009-06-30 19:45:18

N1ke, search is spelt wrong :)

Why not cut out the middle man?

{*******************************************************************************
function Stunned: Boolean;
By: NCDS
Description: Return's True if stunned by NPC.
*******************************************************************************}
function Stunned: Boolean;
begin
Result := FindColorTolerance(mmcx, mmcy, 2155764, mmcx - 30, mmcy - 30,
mmcx + 30, mmcx + 30, 5) and
IsChatBoxTextBetween('stunned', 0, 7, 8);
end;

Naike

2009-06-30 19:59:02

Don't complain on my spelling <;]

O_o How did I miss that..

NCDS

2009-06-30 21:14:19

From: NaumanAkhlaQ
N1ke, search is spelt wrong :)

Why not cut out the middle man?

{*******************************************************************************
function Stunned: Boolean;
By: NCDS
Description: Return's True if stunned by NPC.
*******************************************************************************}
function Stunned: Boolean;
begin
Result := FindColorTolerance(mmcx, mmcy, 2155764, mmcx - 30, mmcy - 30,
mmcx + 30, mmcx + 30, 5) and
IsChatBoxTextBetween('stunned', 0, 7, 8);
end;


That actually doesn't work, throws up a bunch of errors, we're searching on Main Screen not mini map :p and "mmcx - 30, mmcy - 30, mmcx + 30, mmcx + 30," gives a type mismatch, and it's not only because you put "mmcx + 30, mmcx + 30" :p

So, the way N1ke! had it seems to be the shortest error free way.

NCDS

2009-06-30 23:14:39

From: NaumanAkhlaQ
Change that to mscx then, it's not that hard?



program New;
{.include srl/srl.scar}
function Stunned: Boolean;
begin
Result := FindColorTolerance(mscx, mscy, 2155764, mscx - 30, mscy - 30,
mscx + 30, mscx + 30, 5) and
IsChatBoxTextBetween('stunned', 0, 7, 8);
end;

begin
if stunned then writeln('yes!');
end.
From: Scar Debug

Failed when compiling
Line 5: [Error] (19022:34): Variable Expected in script C:\Documents and Settings\Owner\Desktop\admin\scripts\stunned.scar

Naum

2009-07-01 11:01:29

lulz?

My mistake forgot a variable, but that easy to fix right?

program New;
{.include srl/srl.scar}
function StunnedAt(x, y : Integer): Boolean;
begin
Result := FindColorTolerance(x, y, 2155764, mscx - 30, mscy - 30,
mscx + 30, mscx + 30, 5) and IsChatBoxTextBetween('stunned', 0, 7, 8);
end;

begin
if stunned then writeln('yes!');
end.

NCDS

2009-07-01 22:00:36

if I am coming off as an ass, my apologies. That isn't what I'm aiming for at all.

Doesn't it seem more convenient though to just do:

program New;
{.include srl/srl.scar}
function Stunned: Boolean;
var P: TPoint;
begin
P := Point(mscx, mscy);
Result := FindColorTolerance(P.x, P.y, 2155764, mscx - 30, mscy - 30,
mscx + 30, mscx + 30, 5) and
IsChatBoxTextBetween('stunned', 0, 7, 8);
end;

begin
if stunned then writeln('yes!');
end.
Just to avoid needing user input for parameter's?