SRL Archive - Research & Development Lounge

DropExceptColor


Negaal

2008-01-04 17:13:44

I don't know does it exists or not but I made one:)
Useful for power-scripts if you want to clear inventory…


procedure DropItemsExceptColors(colorz : TIntegerArray);
var IC : TPoint;
var I, J, x, y : integer;
begin
Gametab(4);
Wait(1000 + random(1000));
for i := 1 to 28 do
begin
Wait(50);
if ExistsItem(i) then
begin
IC := ItemCoords(i)
For j := 0 to (GetArrayLength(Colorz)-1) do
begin
if FindColorSpiralTolerance(x, y, colorz[j],ic.x - 20, ic.y - 20, ic.x + 20, ic.y + 20, 5) then break;
if j = (GetArrayLength(Colorz)-1) then dropitem(i);
end;
end;
end;
end;

Usage example:

DropItemsExceptColors([12345, 4325346, 3453465]);

Add many colors you want, but seperate them with comma

R0b0t1

2008-01-04 18:06:14

Nice, very compact. Please separate the single line If statements into two line ones though.

mickaliscious

2008-01-06 02:23:20

From: R0b0t1
Nice, very compact. Please separate the single line If statements into two line ones though.


http://www.kaitnieks.com/scar/scriptingsta/

Not needed. If it extends past 80 characters then it should be done. It is personal preference whether or not someone does so.

Looks very nice though. There are some small things you could do such as High(Colorz) instead of GetArrayLength(Colorz)-1. I'm also not sure why you put the Wait(50) in there but its not enough to really matter.

Negaal

2008-01-06 10:11:54

If it don't has waits in it mouse click may not work…
About High(X) i'm not sure, I'm pretty sure I tested it once and it didn't work with arrays…


Edit: It works, but it did gave me out of range error once when i tested it…

n3ss3s

2008-01-06 11:46:31


Function DropExceptColors(From, tTo: Integer; Colors: TIntegerArray): Integer;
Var
I, II, L, X, Y: Integer;
E: Boolean;
B: TBox;
Begin
If Not LoggedIn Then Exit;
L := High(Colors);
For I := From To tTo Do
If ExistsItem(i) Then
Begin
B := InvBox(i);
For II := 0 To L Do
If FindColor(X, Y, Colors[ii], B.x1, B.y1, B.x2, B.y2) Then
Begin
E := True;
Break;
End;
If E Then
Begin
E := False;
Continue;
End;
DropItem(i);
End;
End;

Kay?

footballjds

2008-01-06 12:52:41

n3ss3s, this is the quote i was looking for, about the above script you pasted, this comes straight from kaitnieks:
Object Pascal language reserved words and key words shall always be completely lowercase. Never capitalize words that SCAR displays in bold. It's completely unnecessary and looks ugly!


refering to your
If
Then
Var
Exit
Do
To
Begin
End
i don't know whether or not this is your funct.. just saying.

n3ss3s

2008-01-06 13:14:50

Nobody has complained to Wizzup :rolleyes:

Why wouldn't it be his function lol?

Its not like he copied it or anything…

Negaal

2008-01-06 16:45:26

Haha, n3ss3s missed standards!

n3ss3s

2008-01-07 10:27:59

Nope, I didn't, Wizzup posted somewhere that those are okay, the low caps etc are some other > SCAR standards + they look way more delphi :p

(EDIT: Just wanted to say that x))

EDIT EDIT: What would your reaction be if I said "..so?"

R0b0t1

2008-01-08 19:01:56

I should post some Yo-Mama joke and get n3ss3s all mad because he doesn't understand English jokes.

mickaliscious

2008-01-10 22:53:54

From: R0b0t1
I should post some Yo-Mama joke and get n3ss3s all mad because he doesn't understand English jokes.


Yo mamma so fat:

const
Mom_Waist = ;
Mom_Height = ;

function IsFat(Waist_Size, Height:integer): boolean;
begin
Result := ((Waist_Size/Height) >= 1);
WriteLn('She'#39's a fatty = ' + BoolToStr(Result));
end;

begin
while IsFat(Mom_Waist, Mom_Height) do
WriteLn('Fatty');
end.


Line 12: [Error] (6:11): Type mismatch in script

n3ss3s

2008-01-11 12:49:13


program new;
begin
Writeln('Don´t hesitate to sleep one eye open');
End.

;)

mickaliscious

2008-01-11 12:59:02

From: n3ss3s

program new;
begin
Writeln('Don´t hesitate to sleep one eye open');
End.

;)


Don't deny it. You laughed.

n3ss3s

2008-01-11 13:20:52

I didn't - I know scar enough to picture the debug box in my mind and run the script there ;)

R0b0t1

2008-01-12 00:31:01

Damn. Addicted.



N3ss3s? Are you Chuck Norris? Because Chuck Norris doesn't sleep… He waits.