Group: Members
Posts: 6
Joined: 11-November 09
Member No.: 1,042,302
I having trouble putting together multiply wheat colors into a function.
I put in natedog's code - with my own colors:
CODE
function Targetwheat1 : Boolean; begin
if(FindColor(x, y, 614299, 0, 0, 800, 600)) or if(FindColor(x, y, 11394, 0, 0, 800, 600)) or if(FindColor(x, y, 20387, 0, 0, 800, 600)) or if(FindColor(x, y, 2074072, 0, 0, 800, 600) or if(FindColor(x, y, 20387, 0, 0, 800, 600)) or if(FindColor(x, y, 559059, 0, 0, 800, 600))then result:= true
end;
My whole script:
CODE
var x, y, lvlx, lvly, fin_x, fin_y: integer;
function Targetwheat1 : Boolean; begin
if(FindColor(x, y, 614299, 0, 0, 800, 600)) or if(FindColor(x, y, 11394, 0, 0, 800, 600)) or if(FindColor(x, y, 20387, 0, 0, 800, 600)) or if(FindColor(x, y, 2074072, 0, 0, 800, 600) or if(FindColor(x, y, 20387, 0, 0, 800, 600)) or if(FindColor(x, y, 559059, 0, 0, 800, 600))then result:= true
end;
function Targetwheat2 : Boolean; begin if(FindColor(x, y, 686246, 0, 0, 800, 600))then result:= true end;
function Nextwheat1 : Boolean; begin if(FindColor(x, y, 20387, 0, 0, 800, 600))then result:= true end;
function Nextwheat2 : Boolean; begin if(FindColor(x, y, 559059, 0, 0, 800, 600))then result:= true end;
Procedure Harvest; begin if(Targetwheat1)or(Targetwheat2) then MoveMouseSmooth(x, y); Wait(100+random(200)); HoldMouse(x, y, true); Wait(20+random(50)); ReleaseMouse(x, y, true); Wait(100+random(200));
MoveMouseSmooth(x+29, y+29); Wait(100+random(200)); HoldMouse(x+29, y+30, true); Wait(4+random(10)); ReleaseMouse(x+29, y+30, true); Wait(3000+random(500)); Wait(9200); //<--- However long it takes you to chop wheat! end;
function nowheat : Boolean; begin if(FindColor(x, y, 16777215, 0, 0, 800, 600))then result:= false end;
function FindLevel : boolean; begin result := false; If(FindColor( lvlx, lvly, 25087,0,0,500,500))then result := true end;
begin harvest; repeat if(nowheat) then harvest; if(nextwheat1)or(nextwheat2)then harvest; if(FindLevel)then LevelUp; until(false); end.
And then I get a Line 8: [Error] (8:49): Syntax error in script (Line 8 contains the wheat colors). I know I could split those colors up by adding functions - Targetwheat1-10. And then, add those to my harvest procedure, but Its so much more ugly repetitious script. I just want my script to be as nice and short as possible.
Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937
PLEASE use CODE not CODEBOX... /endrant
and it's as margreg, one of the greater SCAR coders on here said you only need the ONE if statement...
Here are my re-codings of the few codes... note i used a variable!
CODE
function TargetResource1 : Boolean; begin if (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) then result:=true; end;
function TargetResource2 : Boolean; begin if (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) then result:=true; end;
function NextResource1 : Boolean; begin if (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) then result:=true; end;
function NextResource1 : Boolean; begin if (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) or (findcolor(x,y,color,xu,yu,xl,yl)) then result:=true; end;
SPOILER: This script will be thought of and implemented into the next DofusBase.scar!
--------------------
SCAR Coder
DofusBaseV1 [||||||||||]
Want to make progress bars like me?
CODE
use this base one as an example! [[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]
Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937
lol, im about to get to work on finishing the V1 of DofusBase.scar but I have about 10 more codes... and 2 official scripts for it to make yet... so far to go xD
--------------------
SCAR Coder
DofusBaseV1 [||||||||||]
Want to make progress bars like me?
CODE
use this base one as an example! [[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]