View Full Version : DropExceptColor
Negaal
01-04-2008, 10:13 PM
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
01-04-2008, 11:06 PM
Nice, very compact. Please separate the single line If statements into two line ones though.
mickaliscious
01-06-2008, 07:23 AM
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
01-06-2008, 03:11 PM
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
01-06-2008, 04:46 PM
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
01-06-2008, 05:52 PM
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
01-06-2008, 06:14 PM
Nobody has complained to Wizzup :rolleyes:
Why wouldn't it be his function lol?
Its not like he copied it or anything...
Negaal
01-06-2008, 09:45 PM
Haha, n3ss3s missed standards!
n3ss3s
01-07-2008, 03:27 PM
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
01-09-2008, 12:01 AM
I should post some Yo-Mama joke and get n3ss3s all mad because he doesn't understand English jokes.
mickaliscious
01-11-2008, 03:53 AM
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
01-11-2008, 05:49 PM
program new;
begin
Writeln('Don´t hesitate to sleep one eye open');
End.
;)
mickaliscious
01-11-2008, 05:59 PM
program new;
begin
Writeln('Don´t hesitate to sleep one eye open');
End.
;)
Don't deny it. You laughed.
n3ss3s
01-11-2008, 06:20 PM
I didn't - I know scar enough to picture the debug box in my mind and run the script there ;)
R0b0t1
01-12-2008, 05:31 AM
Damn. Addicted.
N3ss3s? Are you Chuck Norris? Because Chuck Norris doesn't sleep... He waits.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.