Jump to content
adrianhmartinez

If find color wait untill color is not found

Recommended Posts

how can i go by if find color then wait untill find color is false then go to next function?

 

const
MonsterColor = 924549; 
MonsterColor2 = 924541;
MonsterColor3 = 924545;
MonsterColor4 = 4940366; // not used
MonsterColor5 = 1467240; // not used
Mistake = 5583690; // not used
Hat = 65280;
WaitTime = 1000;


var
x, y, c: Integer;

function SearchforMonster1: Boolean; // Search for monster to attk 
var  MonsterColors: TIntArray; 
begin  MonsterColors := [MonsterColor, MonsterColor2, MonsterColor3];   
Result := FindColors(x, y, MonsterColors, 78, 11, 574, 326);   
if Result 
then  
begin    
Wait(WaitTime);      
Movemouse(x, y);      
ClickMouse(x, y, False);   
end; 
end; 
-------------------------------------------------------------
function SearchForHat: Boolean; //Search for hp in battle   -
Begin                                                       -
Result := FindColor(x, y, Hat, 78, 11, 574, 326);           -
if Result                                                   -
then                                                        - <----- on this Function
begin                                                       -
Wait(WaitTime+1000);  <----                                 - 
end;                                                        -   
end;                                                        -
-------------------------------------------------------------

Begin 
repeat
 c:=c+1; 
Wait(WaitTime);
(SearchforMonster1)  //attk
Wait(WaitTime);
(SearchForHat); //hp bar
Wait(WaitTime);
until(c>=999999999)
end.

Link to comment
Share on other sites

Sorry you will need to give a bit more details, I got confused what you are asking for here.. :S

 

Standards added in, however:

 

const
 MonsterColor = 924549; 
 MonsterColor2 = 924541;
 MonsterColor3 = 924545;
 MonsterColor4 = 4940366; // not used
 MonsterColor5 = 1467240; // not used
 Mistake = 5583690; // not used
 Hat = 65280;
 WaitTime = 1000;

function SearchforMonster1: Boolean; // Search for monster to attk 
var
 x, y: Integer; 
 MonsterColors: TIntArray; 
begin 
 MonsterColors := [MonsterColor, MonsterColor2, MonsterColor3];   
 Result := FindColors(x, y, MonsterColors, 78, 11, 574, 326);   
 if Result then  
 begin    
   Wait(WaitTime);      
   Movemouse(x, y);      
   ClickMouse(x, y, False);   
 end; 
end; 

function SearchForHat: Boolean; //Search for hp in battle   
var
 x, y: Integer;
begin                                                       
 Result := FindColor(x, y, Hat, 78, 11, 574, 326);           
 if Result then                                                       
 begin                                                       
   Wait(WaitTime + 1000);  //<----                                  
 end;                                                       
end;                                                        

begin 
 repeat
   Wait(WaitTime);
   SearchforMonster1;  //attk
   Wait(WaitTime);
   SearchForHat; //hp bar
   Wait(WaitTime);
 until False;
end.

 

If you can, please give me plain details on exactly what you need it to do.. I can definitely help you out, but I just couldn't understand the logic you need with those details. :\

 

-Jani

Link to comment
Share on other sites

maby something like this but this just makes the script pause on the same function and wont go to the next when find color is false

 

function SearchForHat: Boolean; //Search for hat in battle
Begin 
Result := FindColor(x, y, Hat, 303, 143, 371, 210); 
begin
Wait(WaitTime); 
Repeat
Wait(WaitTime);
until 
false;
end; 
end;

Link to comment
Share on other sites

So which color you need to look for? That one right there?

Do you need it to repeat wait until it doesn't return true or..?

 

- - - Updated - - -

 

Perhaps something like this:

 

const
 MonsterColor = 924549; 
 MonsterColor2 = 924541;
 MonsterColor3 = 924545;
 MonsterColor4 = 4940366; // not used
 MonsterColor5 = 1467240; // not used
 Mistake = 5583690; // not used
 Hat = 65280;
 WaitTime = 1000;

function SearchforMonster1: Boolean; // Search for monster to attk 
var
 x, y: Integer; 
begin 
 Result := FindColors(x, y, [MonsterColor, MonsterColor2, MonsterColor3], 78, 11, 574, 326);   
 if Result then  
 begin       
   Movemouse(x, y);      
   ClickMouse(x, y, mbLeft); // Left of Right mouse button?? Changed to left click. Change to mbRight if you need right click!
   Wait(WaitTime);      
 end; 
end; 

function SearchForHat: Boolean; //Search for hp in battle   
var
 x, y: Integer;
begin                                                       
 Result := FindColor(x, y, Hat, 78, 11, 574, 326);                                                                 
end;                                                        

begin 
 repeat
   if SearchforMonster1 then
   while SearchForHat do
     Wait(0);
   Wait(WaitTime);
 until False;
end.

 

Getting any closer?

NOTE: I changed the click to left click, did you mean left or right click? Change mbLeft to mbRight if you meant right click.

 

-Jani

Link to comment
Share on other sites

no that kind of wasnt what i was looking for.

i dont want to modife anything outside the box i made

-i want to add on the box fucntion that if it find color keep looking for color untill color is not found then end(but not end the scripit).

 

const
MonsterColor = 924549; 
MonsterColor2 = 924541;
MonsterColor3 = 924545;
MonsterColor4 = 4940366; // not used
MonsterColor5 = 1467240; // not used
Mistake = 5583690; // not used
Hat = 65280;
WaitTime = 1000;


var
x, y, c: Integer;

function SearchforMonster1: Boolean; // Search for monster to attk 
var  MonsterColors: TIntArray; 
begin  MonsterColors := [MonsterColor, MonsterColor2, MonsterColor3];   
Result := FindColors(x, y, MonsterColors, 78, 11, 574, 326);   
if Result 
then  
begin    
Wait(WaitTime);      
Movemouse(x, y);      
ClickMouse(x, y, False);   
end; 
end; 
-------------------------------------------------------------
function SearchForHat: Boolean; //Search for hp in battle   -
Begin                                                       -
Result := FindColor(x, y, Hat, 78, 11, 574, 326);           -
if Result                                                   -
then                                                        - <----- on this Function
begin                                                       -
Wait(WaitTime+1000);  <----                                 - 
end;                                                        -   
end;                                                        -
-------------------------------------------------------------

Begin 
repeat
 c:=c+1; 
Wait(WaitTime);
(SearchforMonster1)  //attk
Wait(WaitTime);
(SearchForHat); //hp bar
Wait(WaitTime);
until(c>=999999999)
end.

 

maby something like this but this does not work it just pauses on the fucntion and wont go to the next.

 

function SearchForHat: Boolean; //Search for hat in battle
Begin 
FindColor(x, y, Hat, 303, 143, 371, 210);
if true
then
begin
Wait(WaitTime); 
Repeat
Wait(WaitTime);
until 
false;
end; 
end;

Link to comment
Share on other sites

It may help if you post video about the action you are trying to get script for.. At least for me that doesn't make any sense at the moment. :\ Pictures or video about the script steps would be really helpful.

Because, I did that trick you are looking for, in mainloop.. With while..do loop. Hmm? :S

 

-Jani

Link to comment
Share on other sites

i dont understand what u mean by u dont understand what im saying. i cant make it any more clear than what i said...

 

const
MonsterColor = 924552; 
MonsterColor2 = 924552;
MonsterColor3 = 924552;
MonsterColor4 = 4940366; // not used     <-------- this constants
MonsterColor5 = 1467240; // not used
Mistake = 5583690; // not used
Hat = 65280;
WaitTime = 300;

---------------------------------------------------------------------------
var
x, y, c: Integer;

function SearchforMonster1: Boolean; // Search for monster to attk 
var  MonsterColors: TIntArray; 
begin  MonsterColors := [MonsterColor, MonsterColor2, MonsterColor3];   
Result := FindColors(x, y, MonsterColors, 78, 11, 574, 326);   
if Result 
then                                               <-------- this looks for monster to click
begin    
Wait(WaitTime);           
ClickMouse(x, y, False);   
end; 
end; 
------------------------------------------------------------------------
function SearchForHat: Boolean; //Search for hat in battle
Begin 
FindColor(x, y, Hat, 247, 100, 393, 234);
if Result 
then           <---- this looks for hp bar and stops looking for monster
                       this is what i need help with 
begin
Wait(WaitTime+8000); 
end; 
end;
------------------------------------------------------------------------

Begin 
repeat
 c:=c+1; 
(SearchforMonster1)  //attk    <------ this activates the functions above and loops it
Wait(WaitTime);
(SearchForHat); //hp bar
Wait(WaitTime);
until(c>=999999999)
end.

Link to comment
Share on other sites

Thats exactly what I did with my code...

I think you didn't even pay attention to my code. I used while..do loop in it, while it finds HP bar it WAITS.

Then, when it cannot find HP bar anymore, it continues the code. Thats what it does.

 

We are not on the same page here.. :\

 

Try the code I posted. Because the way you describe it here, it should do exactly what you are after...

Is it too fast? Adjust some waits in.

 

- - - Updated - - -

 

Does either of these 2 codes do what you want:

 

const
 MonsterColor = 924549; 
 MonsterColor2 = 924541;
 MonsterColor3 = 924545;
 MonsterColor4 = 4940366; // not used
 MonsterColor5 = 1467240; // not used
 Mistake = 5583690; // not used
 Hat = 65280;
 WaitTime = 1000;

function SearchforMonster1: Boolean; // Search for monster to attk 
var
 x, y: Integer; 
begin 
 Result := FindColors(x, y, [MonsterColor, MonsterColor2, MonsterColor3], 78, 11, 574, 326);   
 if Result then  
 begin       
   Movemouse(x, y);      
   ClickMouse(x, y, mbLeft); // Left of Right mouse button?? Changed to left click. Change to mbRight if you need right click!
   Wait(WaitTime);      
 end; 
end; 

function SearchForHat: Boolean; //Search for hp in battle   
var
 x, y: Integer;
begin                                                       
 Result := FindColor(x, y, Hat, 78, 11, 574, 326);                                                                 
end;                                                        

begin 
 repeat
   if SearchforMonster1 then
   while SearchForHat do
     Wait(0);
   Wait(WaitTime);
 until False;
end.

 

..or...

 

const
 MonsterColor = 924549; 
 MonsterColor2 = 924541;
 MonsterColor3 = 924545;
 MonsterColor4 = 4940366; // not used
 MonsterColor5 = 1467240; // not used
 Mistake = 5583690; // not used
 Hat = 65280;
 WaitTime = 1000;

function SearchforMonster1: Boolean; // Search for monster to attk 
var
 x, y: Integer; 
begin 
 Result := FindColors(x, y, [MonsterColor, MonsterColor2, MonsterColor3], 78, 11, 574, 326);   
 if Result then  
 begin       
   Movemouse(x, y);      
   ClickMouse(x, y, mbLeft); // Left of Right mouse button?? Changed to left click. Change to mbRight if you need right click!
   Wait(WaitTime);      
 end; 
end; 

function SearchForHat: Boolean; //Search for hp in battle   
var
 x, y: Integer;
begin                                                       
 Result := FindColor(x, y, Hat, 78, 11, 574, 326);                                                                 
end;                                                        

begin 
 repeat
   SearchforMonster1;
   while SearchForHat do
     Wait(0);
   Wait(WaitTime);
 until False;
end.

Link to comment
Share on other sites

From what I see Janilabos code should work as you want it to, just give his code some tought, and you might just understand it.

 

A tip: Indent the code after a block-statement like if..then, for..to..do, begin etc... just look at janilabos code, and you might get it.

 

Off topic:

Janilabo said: "We are not on the same page here.. :\"

- You certainly are not, you are on page two, his posts are on page one in this thread.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...