xtrackx Posted November 25, 2012 Share Posted November 25, 2012 (edited) Hi, I'm newbie or scar divi language. All that I need to do, is : -spacebar of left click of the mouse pressed for x seconds, or until a color green, go to red -check every 30 seconds if a color is black, or white, then click on it when it's black I have only 3 strings at the moment, who can help me? [sCAR]program New; begin end.[/sCAR] Edited November 27, 2012 by xtrackx Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 25, 2012 Share Posted November 25, 2012 FindColor, VKeyDown, VKeyUp, repeat loop. I still don't understand what you're asking for. Can you give a detailed explanation of what you want or want to know how to do? got lost at...spacebar of left click Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 25, 2012 Author Share Posted November 25, 2012 There is a game, with a bar. If you use spacebar, or left click of the mouse (pressed) the bar go up, if I remove my hand from keyboard/mouse the bar go down. I must make this bar in the middle for 30 seconds fro win the game, pressing, and leaving my hand from the keyboard/mouse. Every time that I win, I earn money, and I want to do a simple bot that play for me. All that I need is to do a function in scar divi, that hold spacebar/leftmouseclick and check every second if the head of the bar is colored. If yes, the bot "leave the pressing" of the spacebar/or-mouse-click and re-hold it after 3 seconds until the head of the bar is re-colored and... Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 25, 2012 Share Posted November 25, 2012 Okay this sounds pretty easy . Buttt. I need a picture of this "bar" so I can find out if it is re-colored or not. I can make it so it will click the mouse or spam the spacebar until it sees the middle of the bar colored, and then it will stop until it isn't colored then spam again. Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 25, 2012 Author Share Posted November 25, 2012 Now I don't have it, but it's a bar like this (I found it on google images) You understod good what I want to do, and I know that is very easy, especially with scar divi. If you want the exact image of the bar, I can switch in about 30 minutes computer, for do the screenshot, but it's not very important. The bar is remi-round and horizontal, anz is in the middle green, and on the 2 heads yellow-red But I don't know the codes in scar divi, because I don't know this language, do you have an idea? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 26, 2012 Share Posted November 26, 2012 Need the actual bar. Otherwise I could make a script that would mess up. Need screenshot. might be some other green color on the screen. Or work differently than I expect. Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 26, 2012 Author Share Posted November 26, 2012 This is the game that I want to bot! (FaceBook game) : http://apps.facebook.com/lets_fish My screen resolution is 1152 x 864 Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 27, 2012 Share Posted November 27, 2012 You need to target the game with SCAR's crosshairs button before you run the script! Try this script: NOTE: This only uses space bar, and hopefully the FindColor doesn't find those trees over there...it shouldn't...give it a try [scar] // hit CTRL + ALT + S to stop the script from anywhere! program TestFishBot; var cWidth, cHeight: Integer; procedure ScriptTerminate; begin SetColorspeed2Modifiers(0, 0); ColorToleranceSpeed(1); end; procedure Loop; var x, y: Integer; begin ColorToleranceSpeed(2); SetColorspeed2Modifiers(0.70, 2.41); repeat if not FindColorSpiralTol(CWidth div 2, cHeight div 2, x, y, 4107845, 0, 0, cWidth - 1, cHeight - 1, 5) then PressVKeyEx(VK_SPACE, 30 + Random(85)); wait(100); until ((GetKeyState(VK_CONTROL) and GetKeyState(VK_MENU) and GetKeyState(CharToVKey('s')))); SetColorspeed2Modifiers(0, 0); ColorToleranceSpeed(1); end; procedure SetupClient; begin GetClient.Activate; GetBoxSize(GetClient.ImageArea, cWidth, cHeight); end; procedure MainLoop; begin ClearDebug; SetupClient; Loop; end; begin MainLoop; end. [/scar] Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 27, 2012 Author Share Posted November 27, 2012 (edited) First of all, thanks a lot. I got a problem. The bot press the space every seconds I think, and the bar don't reach the "right head". How can I do that the bot hold down the spacebar, until the color of the "right head coordinates" is red, and re-hold down it when the color of the "left head coordinates" is red? Edit 1 : I tried to modify line 23 [sCAR]wait(100);[/sCAR] to [sCAR]wait(1000);[/sCAR] just for test, but I saw that if I compile, and I press F9, the bot don't works anymore. I restored the value to 100, but I'm having the same problem, now I try to reeboot. Edited November 27, 2012 by xtrackx Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 27, 2012 Share Posted November 27, 2012 I can change it for the "red heads" but try this one now: [scar] // hit CTRL + ALT + S to stop the script from anywhere! program TestFishBot; var cWidth, cHeight: Integer; procedure ScriptTerminate; begin ColorToleranceSpeed(1); end; procedure Loop; var x, y: Integer; begin ColorToleranceSpeed(2); repeat if not FindColorSpiralTol(CWidth div 2, cHeight div 2, x, y, 3649589, 0, 0, cWidth - 1, cHeight - 1, 0) then PressVKeyEx(VK_SPACE, 30 + Random(85)); wait(100); until ((GetKeyState(VK_CONTROL) and GetKeyState(VK_MENU) and GetKeyState(CharToVKey('s')))); ColorToleranceSpeed(1); end; procedure SetupClient; begin GetClient.Activate; GetBoxSize(GetClient.ImageArea, cWidth, cHeight); end; procedure MainLoop; begin ClearDebug; SetupClient; Loop; end; begin MainLoop; end. [/scar] Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 27, 2012 Author Share Posted November 27, 2012 Thanks again. Don't works yet. The bot press the spacebar fast, but don't hold down it. In line 20 I red [sCAR]PressVKeyEx(VK_SPACE, 30 + Random(85)); wait(100);[/sCAR] but I'm not sure if should be modified or not. Can it be a resolution problem? I have 1152 x 864 and the window "not scrolled but in top" as the first screenshot. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 27, 2012 Share Posted November 27, 2012 Kk try this...u just want it to hold spacebar down: I can change it for the "red heads" but try this one now: [scar] // hit CTRL + ALT + S to stop the script from anywhere! program TestFishBot; var cWidth, cHeight: Integer; keydownbool: Boolean; procedure ScriptTerminate; begin ColorToleranceSpeed(1); if keydownbool then VKeyUp(VK_SPACE); end; procedure Loop; var x, y: Integer; begin ColorToleranceSpeed(2); repeat if not FindColorSpiralTol(CWidth div 2, cHeight div 2, x, y, 3649589, 0, 0, cWidth - 1, cHeight - 1, 0) then begin VKeyDown(VK_SPACE); keydownbool := true; end; wait(100); until ((GetKeyState(VK_CONTROL) and GetKeyState(VK_MENU) and GetKeyState(CharToVKey('s')))); ColorToleranceSpeed(1); end; procedure SetupClient; begin GetClient.Activate; GetBoxSize(GetClient.ImageArea, cWidth, cHeight); end; procedure MainLoop; begin ClearDebug; SetupClient; Loop; end; begin MainLoop; end. [/scar] Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 27, 2012 Author Share Posted November 27, 2012 I tried it, and works perfect! Now are only needed the 2 "red heads checks". Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 27, 2012 Share Posted November 27, 2012 So does it actually work? what could be better? does it go past the middle and keep going? Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 27, 2012 Author Share Posted November 27, 2012 No, the spacebar is pressed and this is good, but the bot don't leave it when the bar is at right red head point (max). Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 27, 2012 Share Posted November 27, 2012 I have it so it will press the spacebar if that green color in the middle of the bar isn't found. How is it supposed to work? Do you speak english well? Try putting into your native language, and then I'll go to google translate or something. Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 27, 2012 Author Share Posted November 27, 2012 Try to play this game! For catch the fish, you must make resistance for xx seconds without going to red head right leaving the spacebar, and without going to red head left, re-holding down the spacebar! Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 28, 2012 Share Posted November 28, 2012 I've tried out the game. Been having trouble getting this to work. Has me real pissed off right now. Will try again later probably 2morow with the real time view technique because this damn thing doesn't want to find the colors I use. Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 28, 2012 Author Share Posted November 28, 2012 (edited) Are you sure that the bot "don't press anymore the bar" when the right red head is on? Probably the algorithm is good... I don't know... Edit 1 : Are you sure that you picked the exact color? It's the only one logic reason for the bad working of the bot. Edit 2 : Or the timer... for example if the bot check every second the color can skip it because 1 second is too much...? Edited November 28, 2012 by xtrackx Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 28, 2012 Share Posted November 28, 2012 Well, what its supposed to do is SPAM Spacebar until the color is found. Once the color is found it is supposed to stop. No errors with those scripts I posted. Just firefox or something messes up. Try it with internet explorer maybe...... If you have OSI (File->Includes Manager). Then go to Tool->Explore->Includes open up the OSI folder and then open up the Tools folder. There is a tool called Auto Color Aid, and that is what I've been using. It's been working perfectly for me up until now on this case. Which gives reason for me to believe it is a client problem... I'll test this more thoroughly later, busy atm Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 28, 2012 Author Share Posted November 28, 2012 If you mean the spacebar, it works good, and is "holded down" but the bot don't "leave the pressing of the spacebar, when the "right red head" is reached, and red. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 28, 2012 Share Posted November 28, 2012 kk try this: [scar] // hit CTRL + ALT + S to stop the script from anywhere! program TestFishBot; var cWidth, cHeight: Integer; keydownbool: Boolean; procedure ScriptTerminate; begin ColorToleranceSpeed(1); if keydownbool then VKeyUp(VK_SPACE); end; procedure Loop; var x, y: Integer; begin ColorToleranceSpeed(2); repeat if not FindColorSpiralTol(CWidth div 2, cHeight div 2, x, y, 3649589, 0, 0, cWidth - 1, cHeight - 1, 0) then begin VKeyDown(VK_SPACE); keydownbool := true; end; wait(500); if keydownbool then begin VKeyUp(VK_SPACE); keydownbool := false; end; until ((GetKeyState(VK_CONTROL) and GetKeyState(VK_MENU) and GetKeyState(CharToVKey('s')))); ColorToleranceSpeed(1); end; procedure SetupClient; begin GetClient.Activate; GetBoxSize(GetClient.ImageArea, cWidth, cHeight); end; procedure MainLoop; begin ClearDebug; SetupClient; Loop; end; begin MainLoop; end. [/scar] Quote Link to comment Share on other sites More sharing options...
xtrackx Posted November 28, 2012 Author Share Posted November 28, 2012 (edited) Same problem, don't leave the spacebar. What resolution do you have? Edit 1 : I tried to take the coordinates manually without success. I toke color 2450676 at (554; 416) I put it in line 21, but I'm not sure... [sCAR] if not FindColorSpiralTol(CWidth div 2, cHeight div 2, x, y, 2450676, 554, 416, cWidth - 1, cHeight - 1, 0) then [/sCAR] Edited November 28, 2012 by xtrackx Quote Link to comment Share on other sites More sharing options...