adrianhmartinez Posted April 6, 2013 Share Posted April 6, 2013 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. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted April 6, 2013 Share Posted April 6, 2013 Sorry you will need to give a bit more details, I got confused what you are asking for here.. 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 Quote Link to comment Share on other sites More sharing options...
adrianhmartinez Posted April 6, 2013 Author Share Posted April 6, 2013 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; Quote Link to comment Share on other sites More sharing options...
Janilabo Posted April 6, 2013 Share Posted April 6, 2013 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 Quote Link to comment Share on other sites More sharing options...
adrianhmartinez Posted April 6, 2013 Author Share Posted April 6, 2013 yes i need ii to stay in the same function untill it doesnt find the color then end, but dont end the script. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted April 6, 2013 Share Posted April 6, 2013 Look at the code I posted there, does it do what you want? I think it does exactly what you asked for.. Let me know if its not what you were looking after.. Quote Link to comment Share on other sites More sharing options...
Wanted Posted April 6, 2013 Share Posted April 6, 2013 https://github.com/OfficialSCARInclude/OSI2/blob/master/Divi/Human/Timing.scar Quote Link to comment Share on other sites More sharing options...
adrianhmartinez Posted April 6, 2013 Author Share Posted April 6, 2013 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; Quote Link to comment Share on other sites More sharing options...
Janilabo Posted April 6, 2013 Share Posted April 6, 2013 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? -Jani Quote Link to comment Share on other sites More sharing options...
adrianhmartinez Posted April 6, 2013 Author Share Posted April 6, 2013 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. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted April 6, 2013 Share Posted April 6, 2013 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. Quote Link to comment Share on other sites More sharing options...
slacky Posted April 6, 2013 Share Posted April 6, 2013 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. Quote Link to comment Share on other sites More sharing options...
adrianhmartinez Posted April 11, 2013 Author Share Posted April 11, 2013 (edited) his script does work as i wanted it 2. :::edit nvm i pasted the wrong coords thats why/ Edited April 11, 2013 by adrianhmartinez Quote Link to comment Share on other sites More sharing options...