I'm making a chicken killer but how would i go about counting how many feathers has it picked up? i read Munks function but i don't understand it so there's no point in it if i don't understand how it works
Thx
~Spaz
I'm making a chicken killer but how would i go about counting how many feathers has it picked up? i read Munks function but i don't understand it so there's no point in it if i don't understand how it works
Thx
~Spaz
SCAR Code:function FindInventoryText(txt: string): Boolean;
I hope this helps
Cut em2 it
Formerly known as Cut em2 it
I'd use GetInvItemBounds(InvSpot: Integer; Var T: TBox): Boolean; for the inv spot the feathers are in (which you can find with like a BMP or DTM) and get the number in that box.
ok so would the usage be like
without sounding stupid, i don't get what vars and TBox i need to enter??SCAR Code:GetInvItemBounds(1: Integer??; Var T: TBox): Boolean;
thanx for your help,
~Spaz
I meant like making a function like this:
SCAR Code:Function CountInvSpot(InvSpot: Integer): Integer;
var
Box: TBox;
begin
GetInvItemBounds(InvSpot, Box);
try
Result := StrToInt(GetTextAtEx(box.x1, Box.y1, 10, tradeChars, False, False, 0, 2, 65535, 8, False, tr_Digits));
except
Result := 0;
end;
end;
begin
CountInvSpot(1);
CountInvSpot(4);
CountInvSpot(5);
end.
Although it doesn't seem to work for some reason??...
And I can't figure out why...
should be numberchars or something like that...don't rememeber exactly...tr_Digits
Edit:Statchars not tradechars, also im not sure but x1 and y1 isn't right I think...they should be exact coords where text begins...
[CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]
I thought it was AlphaNumericChars.
[CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
[CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]
[CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]
What about AmountColor, AmountBmp, or AmountDTM?
Code:AmountColor('Inventory',color,tol);
This sentence is false.
SCAR Code:Function CountFeather : Integer;
var
Fether, Fether2, ax, ay : Integer;
begin
Fether:= DTMFromString('78DA63E46562605067644001EA0C0C5C400A2' +
'4FA1F0818416AD450D56C5BBD0AAE0604C06A3450D59C3C781045' +
'0D00F3EE0943');
Fether2:= DTMFromString('78DA63DCC7C8C0A001C44860EBAA550C5C401' +
'A24FA1F08180F01599AA86A18D418E06A408011648E16AA9A433B' +
'77A0A80100CAC20B42');
If (FindDTM(Fether,x ,y , MIX1, MIY1, MIX2, MIY2))
or (FindDTM(Fether2,x ,y , MIX1, MIY1, MIX2, MIY2)) then
GetMousePos(ax, ay);
B := StrToInt(GetTextAtEx(ax, ay, 5, StatChars, False, False, 0, 2, 65535, 8, False, tr_AlphaNumericChars));
FreeDTM(fether);
FreeDTM(fether2);
end;
I tried that Would it work,? because i couldn't get the otehr one to work,
its more or less the same but i used my feather DTM's to find the feathers in the Invent slot
Would that work?
~Spaz
EDIT
Insted of making another post, my attack function has no stopped working
SCAR Code:Procedure AttackChicken;
var
p, g, a, i: Integer;
ChickenColor: Array [0..4] of Integer;
begin
if not (InFight(x, y))
and not (FindFeather) then
begin
If (TimeFromMark(g) < 7000) or (TimeFromMark(a) < 7000) then exit;
ChickenColor[0] = 1055613;
ChickenColor[1] = 8299963;
ChickenColor[2] = 1055621;
ChickenColor[3] = 2841210;
ChickenColor[4] = 3706527;
For I := 0 to 4 do
If (FindColorTolerance(x, y, ChickenColor[i], MSX1, MSY1, MSX2, MSY2, 5)) then
begin
MMouse(x, y, 1, 1);
If IsUptextMulti('cken','hicken','chic') then
begin
Mouse(x,y,1,1, false);
chooseoption('tack')
MarkTime(g);
If (Debug) then Writeln('Killing Chicken');
FindNormalRandoms;
AntiLog;
Chick := Chick + 1
Chickens := Chickens + 1
FindNormalRandoms;
if not(InFight(x, y)) then
exit;
end;
end;
If not(FindColorTolerance(x, y, ChickColor[i], MSX1, MSY1, MSX2, MSY2, 5)) then
begin
If (Debug) then Writeln('Increasing Tol');
for p := 1 to 10 do
If (FindColorTolerance(x, y, ChickColor[i], MSX1, MSY1, MSX2, MSY2, p)) then
MMouse(x, y, 2, 2);
Wait(200+Random(50));
If (TimeFromMark(g) < 7000) or (TimeFromMark(a) < 7000) then exit;
If IsUptextMulti('cken','hicken','chic') then
Mouse(x,y,1,1, false);
chooseoption('tack')
If (Debug) then Writeln('Killing Chicken');
MarkTime(a);
findnormalrandoms;
if Debug then Writeln(' Found chicken with Tol of ['+IntToStr(p-1)+']')
end;
If not (FindColorTolerance(x, y, ChickColor[i], MSX1, MSY1, MSX2, MSY2, p)) then
if Debug then Writeln(' No chickens here, look elsewhere')
if R < 6 then
Relocate;
If Debug then Writeln('Relocated #['+IntToStr(R)+']times')
if R >= 6 then
NextPlayer(False)
end;
If FindBlackChatMessage('omeone') then exit;
ftwait(6);
end;
i get this error
line 171 is ChickenColor[0] = 1055613;SCAR Code:Failed when compiling
Line 171: [Error] (12798:17): Assignment expected in script
it worked before and now i put in the countfeathers it doesn't work, but even after i take it out it still gives me that error and i have no idea why.
Thanks for all your help
~Spaz
x-numberx, y-numbery:SCAR Code:Function CountFeather : Integer;
var
Feather, x, y, B : Integer;
begin
Feather:= DTMFromString('78DA63E46562605067644001EA0C0C5C400A2' +
'4FA1F0818416AD450D56C5BBD0AAE0604C06A3450D59C3C781045' +
'0D00F3EE0943');
Gametab(4);
Wait(500);
If (FindDTM(Feather,x ,y , MIX1, MIY1, MIX2, MIY2)) then
Try
B := StrToInt(GetTextAtEx(x-numberx, y-numbery, 5, StatChars, False, False, 0, 2, 65535, 8, False, tr_AlphaNumericChars));
Except writeln('Could not get feather amount');
end;
Result := B;
FreeDTM(feather);
end;
See, you need x1 and y1 where text starts, only you know where is dtm centrepoint, you can set it...
Edit:toSCAR Code:ChickenColor[0] = 1055613;SCAR Code:ChickenColor[0] := 1055613;
[CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]
There are currently 1 users browsing this thread. (0 members and 1 guests)