Live Help
Membership
You are a guest!

Register Today!

Log In
Reset Password
Game Network
Community Forum

MMO GAME LIST
World of Warcraft
Age of Conan
Anarchy Online
Archlord
Cabal Online
City of Heroes
City of Villains
Dark Age of Camelot
Darkfall Online
Diablo 2
Dungeons and Dragons
Dofus
Eve Online
Everquest 2
Final Fantasy XI
Guild Wars
Hero Online
Knight Online
Lineage 2
Lord of the Rings Online
Maple Story
Ragnarok Online
Runescape 2
Second Life
SilkRoad Online
Star Wars Galaxies
Tibia
Warhammer Online

FPS GAME LIST
Call of Duty
Combat Arms
Counter Strike
Halo

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Syntax error, wheat colors
post Nov 17 2009, 08:05 AM
Post #1

freakofnature4



In Training
**

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;



Procedure LevelUp;
begin
If(FindLevel= true)then
MoveMouseSmooth(lvlx, lvly+2);
Wait(100+random(100));
ClickMouse(lvlx, lvly+2, true);
Wait(100+random(100));
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.

Can someone help me?
Go to the top of the page
 
+Quote Post
post Nov 17 2009, 08:05 AM
Post #

Elite Membership


To get the most out of MmorpGuides.com, please view the following information.












Already a Member?

With an Elite Membership you can. . .

  • Reach the highest levels in no time
  • Have one of the most powerful characters in your game
  • Become a valuable member of your clan or guild
  • Become part of a caring and helpful community of gamers

Elite Members enjoy. . .

  • 1,660+ Cheats - tons of working, high quality cheats
  • 1,550+ Guides - We have one of the most comprehensive collections of guides on the net
  • 539+ Bots and macros - Level up quickly, even while you sleep!
  • A chance to win free prizes such as an amazing Playstation 3! And free gold and powerleveling!

No risk, only huge benefits!

  • Your investment can pay for itself in days!
  • Earn gold that you can trade for real money
  • Sell your high level items and characters for a profit!
  • Get tons of expensive guides and cheats in one spot for one small price

Money Back Guarantee!

Not 100% satisfied? We have a 24 hour, money-back guarantee! Contact us for a prompt and courteous refund!

Upgrade to an Elite Membership now!

Not A Member?

Join today and get access to all these great features!

  • Access to newly submitted cheats and guides
  • Download newly submitted bots and macros
  • Chat about your favorite game
  • Submit working content for a FREE Elite Membership!
  • And lots more!
Register Today!
Go to the top of the page
 
Quote Post
post Nov 17 2009, 02:37 PM
Post #2

margreg



SCAR Coder
Group Icon

Group: Elite Members
Posts: 183
Joined: 26-April 09
Member No.: 893,649







As I know from scar scripting the rule is IF findcolor OR findcolor OR findcolor - you make only one IF at the begining not every findcolor statement.
Go to the top of the page
 
+Quote Post
post Nov 17 2009, 10:29 PM
Post #3

lilwitte



SCAR Coder
Group Icon

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]]
Go to the top of the page
 
+Quote Post
post Nov 19 2009, 01:14 AM
Post #4

freakofnature4



In Training
**

Group: Members
Posts: 6
Joined: 11-November 09
Member No.: 1,042,302






Thanks margreg and lilwitte for the examples. Works excellent

Go to the top of the page
 
+Quote Post
post Nov 19 2009, 01:21 AM
Post #5

lilwitte



SCAR Coder
Group Icon

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]]
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 


> Board Footer
Time is now: 19th March 2010 - 07:46 PM