Jump to content
CoUsT

Questions about working on background process and move / click mouse.

Recommended Posts

Hello all!

 

I'm so sorry if you can't understand something from text below. English isn't my main language and I'm still not expert with using it. I'll try my best.

 

I've made a bot that helps me use other bot. "Other bot" is created by someone to change bonuses in items on Metin2, but pserver that I'm currently playing deleted 'changes' from shop and now to get it, player need to right click "Wizzard's book" (item) and then chose (Give me item enchantment). "Other bot" isn't developed for this server and don't have function to grab item enchantment. Also they created 100 different ID for this item. And here my bot comes. Short description what my bot is doing: Bot is looped in repeat with function wait (100) after repeat, so it refreshes informations 10 times in a second. Bot is searching item enchantment icon, if he can't see, he start grabbing it. If he spot item enchantment near wizzard's book he stop gets and put enchantments in specified place and click "Refresh ID" in "Other bot". Now "Other bot" is changing bonuses. And it's looped.

 

As you can see, it isn't very hard to do bot, he look for bitmaps and if see then do some easy functions like movemouse.

 

I'm still new to programming language, so don't blame me for using label and goto. I know, it's bad. Now in newer projects I don't use label and goto. I'm learning programming languages less than a year (only in school and sometimes in house for make my game easier :P) and Pascal is my first.

 

My program is used only by myself and sometimes by my friends, so I did descriptions in code in my main language (polish). Also probably some of variables and some lines are useless but I don't care as long as it works fine.

Here is the code:

 

program New;

var wezzmiany,biore,zmiana,ksiazka,przeladuj,wystarczajacoz7,wystarczajacoz6,wystarczajacoz5,wystarczajacoz4,wystarczajacoz1,wystarczajacoz2,wystarczajacoz3,niezmienia,zmiananamiejscu:TSCARBitmap;
var niewykrytotimer,niewykrytotimer2,zmianytimer,ilerazyprzeladuj,przeladujtimer,kordx,kordy,timernamiejscu,iloscprob,czyklikac,bioretimer,wezzmianytimer,probabiore,probawziecia,probaksiazki,ilerazyprob,niezmieniatimer,czekanieclick,szybkoscmyszki,globaltimer,getx,gety,x,y:integer;
label reset,kliknieciewezzmiany,kliknieciebiore,klikniecieksiazki,pobieraniebonow,pobieraniebonow2,poczatek;

begin

szybkoscmyszki:=50; //Szybkosc myszy.
czekanieclick:=10; //Czas klikniecia po ruszeniu mysza.
czyklikac:=0; //Czy po powrocie myszki ma kliknac.
ilerazyprob:=600; //10 = 1s etc. Czas czekania az skonczy zmieniac w razie bledu.
kordx:=1300; //Polozenie na ekranie.
kordy:=100; //Polozenie na ekranie.
niewykrytotimer2:=10; //Po ilu sekundach wykrywac puste miejsce.

iloscprob:=10; //Ile sekund ma czekac na przycisku podczas brania zmian. Podawane w sekundach.
ilerazyprzeladuj:=115; //Po ilu sekundach (okolo) ma klikac przeladuj (prowizorycznie, w razie bledu).

 zmiana := TSCARBitmap.Create('deNoBlANr/BMAEAAfIS4/RGRhYXU0MDFJTm' +
   'xZY5BXYIhbWWNKSVVrdaluerFla5JSTVBDQUpGTXBdZ5g+Q18oJCwdFxlQTVEm' +
   'JjFGRVdDPj9bY4pwfLVyfbZtbYRWWG5+isp+isp4grpjYW5VWHRSWYA4OlNARm' +
   'NDPD4VExhAOz4kHyMdGRtDP0A/QVlTWYFuebFwdJRdYHuAf7lCR2ZNUXZXVmYo' +
   'JTAVEhUUEBQqKj43NDwVDxEhHB43MTMaFBgqJicaFRgVDxMgIi9AQVNtZHvEnO' +
   'UkFy8VDA8hHiAXEhYYDxQVERAYFhkhGR0ZExcfGRkcGRwgFRkdFxkbExcWEhMa' +
   'FBYXEhiJbIjjrP9jPKcVDxUQCgoVEBQZFBojGBwbEhMWFBgfFhsVExYgFxgVEB' +
   'QcFhofGRsaFBYeFRg3Kjb/yP/lsf+TWP84I1cVExQVEBQaFBggFxwcFhYTDhIf' +
   'GB8ZExcWERUdFxsWEBQZFRQkGyAcFRyzjLL/0v/pwf+UWv+JUuMeFSQWERUVDx' +
   'MaFhUYFhkZExcWDRIaFRkXEhIzJRs3KiInIRwkHB1ORUn/4///5P/rzv+XYf+T' +
   'W/9JOmAnHyAtKShBPzgvJyQZExkWEBIWEhM0HhKMXjbXqnjy0qHt3rjj3cn///' +
   'z//v/p3P+GVP+LXPzg19/5+PH///r//OfBnXcaFBMbGB8YFBU1HA5lPh6JaEis' +
   'kG/DrI3z4L//+OP////i1v96Rf+8nOf/6b//9NP/++b34buLbE0RDxEZFxoZEx' +
   'UdFBRSLxR9Wz2pkXXQvZv557X+57j++PDay/+EUvLn2t7/+t3/9cb/7L/ruIde' +
   'QSsZExUQDA0cFxseExkyIBKAXT6niWju0KL1zpjltH3rz7PRvv95QZCqfVr03L' +
   'X+26r77MbeqX5cPikcExYYEhQXExQRDxBELRqKakm5l2/two3pu4Huworzz5/O' +
   'sc6mZFHEhU/41qf50aH65b7aqoCBVTQaExkfGR0TERQXDw9oTTGXgGHDqoTgu4' +
   'rOpHO7lmuukWyegWqvdUbcqnf51qn0zZ7ovpDUo3q8hFcjGhYSCxIcExQwJBeC' +
   'akuaim+ahF+bfFGPcEaRc0+XgF+RdVO8iFbfr3rwyJf72Kjsw5DRoHDWpHddQS' +
   'oWEhMXExNqVTuNeFuThGmcjW+ejG2TfVyTelmVfl2Yd1HEkl/SoGnYrnry1Kr1' +
   '2K/kvpTrw5fGlmUvIx3eynH0');

 ksiazka := TSCARBitmap.Create('deNoBPwHA/hUABQC1qH50Zk6bhl1+dleSf' +
   'luEcFqLeV6KMEyJLUqVNkZ4PUs/TVxGOjpAPEM1SlqWPjeLQECFREGDRT9+Sz6' +
   'FUUO/rX9tYU+RflyAc1qUW1KoXFiQVVSjo2GPQkuPPEuqNj8rRFI1OkkrJzQ3S' +
   'Fp6R0uMPDqFQT+ESEGAST6oYEy3o3mIgGV4aU6NflqZhF6qg12XXVmdlV6EQEC' +
   'JOkWPNT1wPkNTVGRGPENMRE5LVGKNPzOEQz+AQz6CQD2IUEO+o3TdxY11bFWSh' +
   'WSCeFuLd1ZxcVR2RkeCLEiHOkeGPESROTpNT11HRVM4Mjw4TmR9R0yNRDuDS0C' +
   'DTEOfcE2QfVy5p4FcWUyNfV2KelqPd1dzZVOLLlCLMlGKOU2IPEWLOD1COj1JU' +
   'm00LjgyN1A6UWbJZzydXUmYU0ivU0tqhHid');

 przeladuj := TSCARBitmap.Create('deNrTZWBiYJ756fbrT9ZNz5manjM3vd/' +
   '2/3s6WGTC9f//geym1xNe/4eDbeueg9RDeb8nzHwO12596Pd/JHGQaQiV//8D1' +
   'SBbBGGv+w6VanrOMPXj7VcfreoeM9Y9tjr46z+QDRQB2rgaJAJHDKu/gaTq3m7' +
   '7/y0NIgLRiKQdofLqWwaQSqghmCrhlsIZAIANvrw='); 

 wystarczajacoz1 := TSCARBitmap.Create('deNqrY2Bi6Aiw77Zx3mjr5B8c5' +
   '+cd4mHn4hmS1uPt1elo1e3s1OFiP8HbaVGy1/mk8E5PbwkhEQc9CwYwMFHSkRa' +
   'TkZGQlBEWkxQWlRGSApKyIiJB+iK10bYrJ5Ze2Dv75/Ot/57v+Pfjw63T/1uCP' +
   'j2/de//r7v/vx77/2b/6x3tcY7aQC0CPLzSopKy4tLCfCLD2Hwmbv62KINJada' +
   'p1pKzCz0nZTt3Gfh06npNNXOrsPW2941xs7JysHE29YqaZmfe7eDQ6uLY7Gpf5' +
   '23XGuh8u61YVkhcnE9YhE9ISkBCXFRMSkxUjF8M6GYZcWlJUREgKScsaaQg1BB' +
   'rt7wz492FRV/PzXi6pfb1+c0X9/2vdJywqjbqy52t/26v+v3m2L2VdTF2mkBXA' +
   'V0rwCcowM0vJSauJC47LM0X4+U31ZHbUeGU6ywzKcNxaq7b7CJPAM5n/+U=');

 wystarczajacoz2 := TSCARBitmap.Create('deNqrY2Bi6NT1mmrmVmHrbe8b4' +
   '2Zl5WDjbOoVNc3OvNvBodXFsdnVvs7brjXQ+XZbsayQuDifsAifkJSAhLiomJS' +
   'YqBi/mIyQlIy4tKSoCJCUE5Y0UhBqiLVb3pnx7sKir+dmPN1S+/r85ov7/lc6T' +
   'lhVG/XlztZ/t1f9fnPs3sq6GDtNGWExCSERAT5BAW5+KTFxJXHZATdfTEhYXFB' +
   'QVFhMSlQSqEVcSExKRExaXExGWEJMRBRoGtAEMUFROVEpRQlZIs0X4+U31ZHbU' +
   'eGU6ywzKcNxaq7b7CLPSdmu/U7e/Tbeq8zstV2CTK08tdVNzD2iqty9e2ysWh3' +
   'tWzwcGzztViT4LPDyPNFYJywoJMDHLy4qIS0qLiEkBnQn0GGyklKyIpLiwiKC/' +
   'AIuulJdWZ47p+e/PdT7cnfju0Ndn8/PP7fx3LKUwCOt/j+uLf95ceGvp/turWp' +
   'oDDWREpaUl5QV4OEVFhSREZOSFJIcWPOFBAQl+YQkRESlBMWAQQdkSAJJMXEpQ' +
   'REpEQlxQWFJAVDgAwNcWFhYREBQWkSaoPnc7BxsPHx9icYT0m3yXaTWNUfOKfK' +
   'cV+pVHW4CAEUSxPo=');

 wystarczajacoz3 := TSCARBitmap.Create('deNqrZWBi6Hfy7rfxXmVmr+0SZ' +
   'Grlqa1uYu4RVeXu3WNj1epo3+Lh2OBptyLBZ4GX54nGOmFBIQE+fnFRCWlRcQk' +
   'hMTEhYSkRMVlJKVkRSXFhEUF+ARddqa4sz53T898e6n25u/Hdoa7P5+ef23huW' +
   'UrgkVb/H9eW/7y48NfTfbdWNTSGmkgJS8pLygrw8AoLisiISUkKSeI3X0hAUJJ' +
   'PSEJEVEpQTFxUDMiQBJJi4lKCIlIiEuKCwpICohJCIjLCYsLCwiICgtIi0gNuP' +
   'jc7BxsPX1+i8YR0m3wXqXXNkXOKPOeVerU4OHRaufab2hbYOQeHpLjZOPu4+Hm' +
   'HJPXaG7c42zc42zU52HYEOE+Kcz/ZFBIXqs0ABkZaOmKCohLCIMPlRSQUJWSBV' +
   'ovz82f4Gk5vSDy8quXB7q5zS4p3T8teNzFnXmPW+lK3O6vKf15b+eXsvBf7Jlx' +
   'ZXLWnJVxZSkyIWwjoIwUpGVEBESEePgstCzzmS/ALSYqKSAuJy4iJyQhLAIMLq' +
   'EBKQALoO3FBUTlRKWkhUVkRUQkxSRE+ISEhATER8QE3n4OT39ZAZkuFc4mn3JI' +
   'K7xW1QXOL3KfnuQAA/GqT6Q==');

 wystarczajacoz4 := TSCARBitmap.Create('deNqrY2BiKHNzb9LxaLdyb7NxmWhp5es' +
   'f6+4abGFkY+GXUuvu0+ti3ezt0OzjPL/Ad31R0Bxvj5uHyliYGRkYGAxUdKTFp' +
   'CSERGSFxMSEpaRFJWWERSRFBCWFxeVEJWSFpaXFxWRFxCUEJSSExSWAagRERAT' +
   '4JcUlJEWkZARFZSQkxYUk+Dh5xYVF1GUUZITFJAVExQRFNWRUGMAAq/kGKuJNW' +
   'd6zuvJntcTPrgnsL3CbWOw/vSF+Ymnwno6w++urPpyY/vvGijeHJ1xcUHBtSXm' +
   'so5aYkDDx5lPd/XzcPPyCAlMTTftSrLKdxHb1JSys8J1d6DQj175bL6DbKLDL0' +
   'rfDxrXbwtbJytYzKNdEz8LIPMAqMO1kus3cWM8ZwR7rg7135AZ3FZgv77BlZ2M' +
   'GmayhJSsiKS0qDnQz0HfCfCJiIuLyIlIK4hJSYuKKErKSwqJAfwEdAySBaoR4B' +
   'YEKgN4BOhXoJAVRWYhfZMSlJfmEpPhFFSUkJcWlVBSUoC7HMF9cWDgr1Lq3Inp' +
   'yS+ac3vx5PbmTa2MmV0VOrYudUR54ZFL8pQWZN9ZVfbqy6uuN9U/2TXl9ePqxa' +
   'an6yrJEmk8L97PzCXmaK8zMso+3lOxPsVpdH7K8NnBBifuMPEcAXZmbDA==');

 wystarczajacoz5 := TSCARBitmap.Create('deNqrY2BiKHNzb9LxaLdyb7Nxm' +
   'Whp5esf6+4abGFkY+GXUuvu0+ti3ezt0OzjPL/Ad31R0Bxvj5uHyliYGRkYGAx' +
   'UdKTFpCSERGSFxMSEpaRFJWWERSRFBCWFxeVEJWSFpaXFxWRFxCUEJSSExSWAa' +
   'gRERAT4JcUlJEWkZARFZSQkxYUk+Dh5xYVF1GUUZITFJAVExQRFNWRUGMAAq/k' +
   'GKuJNWd6zuvJntcTPrgnsL3CbWOw/vSF+Ymnwno6w++urPpyY/vvGijeHJ1xcU' +
   'HBtSXmso5aYkPAAms/HzcMvKDA10bQvxSrbSWxXX8LCCt/ZhU4zcu279QK6jQK' +
   '7LH07bFy7LWydrGw9g3JN9CyMzAOsAtNOptvMjfWcEeyxPth7R25wV4H58g5bd' +
   'jZmkMkaWrIiktKi4kA3A20X5hMRExGXF5FSEJeQEhNXlJCVFBYF+gvoGCAJVCP' +
   'EKwhUAIwOYFADnaQgKguJCxlxaUk+ISl+UUUJSUlxKRUFJajLMcwXFxbOCrXur' +
   'Yie3JI5pzd/Xk/u5NqYyVWRU+tiZ5QHHpkUf2lB5o11VZ+urPp6Y/2TfVNeH55' +
   '+bFqqvrLsAJrPzifkaa4wM8s+3lKyP8VqdX3I8trABSXuM/IcAT+tynk=');

 wystarczajacoz6 := TSCARBitmap.Create('deNqrY2BiKHNzb9LxaLdyb7Nxm' +
   'Whp5esf6+4abGFkY+GXUuvu0+ti3ezt0OzjPL/Ad31R0Bxvj5uHyliYGRkYGAx' +
   'UdKTFpCSERGSFxMSEpaRFJWWERQxUxJuyvGd15c9qiZ9dE9hf4Dax2H96Q/zE0' +
   'uA9HWH311d9ODH9940Vbw5PuLig4NqS8lhHLTEhYXUZBRlhMUkBUTFBUQ0ZFQY' +
   'wwGq+pIigpLC4nKiErLC0tLiYrIi4hKCEhLC4BFCNgIiIAL+kuISkiJSMoKiMh' +
   'KS4kAQfJ6+4sAjx5lPd/XzcPPyCAlMTTftSrLKdxHb1JSys8J1d6DQj175bL6D' +
   'bKLDL0rfDxrXbwtbJytYzKNdEz8LIPMAqMO1kus3cWM8ZwR7rg7135AZ3FZgv7' +
   '7BlZ2MGmayhJSsiKS0qDnQz0HZhPhFxYeGsUOveiujJLZlzevPn9eROro2ZXBU' +
   '5tS52RnngkUnxlxZk3lhX9enKqq831j/ZN+X14enHpqXqK8tK8glJ8YsqSkhKi' +
   'kupKChBXY5hvpiIuLyIlIK4hJSYuKKErKSwKDDcgJ4FkkA1QryCQAXA6AAGNdD' +
   'LCqKykLiQEZcm0nxauJ+dT8jTXGFmln28pWR/itXq+pDltYELStxn5DkCAAmby' +
   'nk=');

 wystarczajacoz7 := TSCARBitmap.Create('deNqrY2BiKHNzb9LxaLdyb7Nxm' +
   'Whp5esf6+4abGFkY+GXUuvu0+ti3ezt0OzjPL/Ad31R0Bxvj5uHyliYGRkYGAx' +
   'UdKTFpCSERGSFxMSEpaRFJWWERSRFBCWFxeVEJWSFpaXFxWRFxCUEJSSExSWAa' +
   'gRERAT4JcUlJEWkZARFZSQkxYUk+Dh5xYVF1GUUZITFJAVExQRFNWRUGMBgQMw' +
   '3UBFvyvKe1ZU/qyV+dk1gf4HbxGL/6Q3xE0uD93SE3V9f9eHE9N83Vrw5POHig' +
   'oJrS8pjHbXEhITxmM/HzcMvKDA10bQvxSrbSWxXX8LCCt/ZhU4zcu279QK6jQK' +
   '7LH07bFy7LWydrGw9g3JN9CyMzAOsAtNOptvMjfWcEeyxPth7R25wV4H58g5bd' +
   'jZmkMkaWrIiktKi4kA3A20X5hMRExGXF5FSEJeQEhNXlJCVFBYF+gvoGCAJVCP' +
   'EKwhUAAwuYFAAnaQgKgsJKxlxaUk+ISl+UUUJSUlxKRUFJajL6W6+uLBwVqh1b' +
   '0X05JbMOb3583pyJ9fGTK6KnFoXO6M88Mik+EsLMm+sq/p0ZdXXG+uf7Jvy+vD' +
   '0Y9NS9ZVl8ZjPzifkaa4wM8s+3lKyP8VqdX3I8trABSXuM/IcAZOrmww=');

 niezmienia := TSCARBitmap.Create('deNotlFtsFFUYx0/Xbbvszs7lzLnMme' +
   'tuuyu7S6+0S7EtltbWUgot9GIvAdvGIgSQO1iDBQNE4EHARGO13qo1lHJREUww' +
   'PGiMGhIfNCEaEUQSH33DBwXp+C11Hk4mZ2a+73f+//83NSiEsKoJGRuEmhrjlM' +
   'GNgJVxUyMmMbimC5UamNg603WdqJpFLE84qhTVNWIzU2Cha1iVFU4Ni3IDM4b1' +
   'SGGoQJJPjFSd2li/vdm8cHjg7V1t7+5dub+verS7xPdn8xHiEkrahce31lx8pT' +
   '1u5P80OzjSU7mqVpS6kWKrMO2FmIwObKgf6lgE9Q0FC0oszG3GbN1whGno3FQN' +
   '6MU16lLTwtQh1GCCyBhjlRGOIxj4Y6ZNVYIleWlmKXp4Lc6UMI3C56EFyrIK+9' +
   'LYE3va3Omx9pnxrnd2tb6xrXnzyszE8XX+3bNlCSnthtLx6KY1yRsXnr72wQBA' +
   'fj/df+fyhheGSj2SVyzypXBeb1PqzpVhqC+IJnTuUsPRLYszh3BDM6BRThOVEF' +
   'UR3BDEtDVqG4JjQ14Q5TpZaMdAWxAZqFJ2Yh6yIlFiMVOOSIqmvj6SPTFau6WJ' +
   'fXFieGps9eTOponnGja1pq+e2ef719NepFgEXBKYOdr25WR/xi0AyJrSaDYdHu' +
   'ysZBLiUZSHUGOZd/fPbVDfI2aMGybjcVBRzzmbUwMTiwoc1UA3IAcq6B6jzjy2' +
   'zS1IiKnQuCEENxOxov8hUxmHiEIZt9XE3tzcMPSYODlae/Zgz+nxte/vaZ3Y1r' +
   'hxRfqtI6v+/mZnAUL1VbyjJfXzuaHrs+t/Ob/+w0PNtz975tpU381Phhc64fbl' +
   'ySBCZQnrjx9XQ32HWzFuW9ygmmpzB2QUum5gTBRYmScsWHPwhEI+wfoYc3UZE1' +
   'k1DEgsLRI2MOuKSlV4IFRJcuPmqcHK57uq16SUMwe6T493gd2n93dOj63c3lH6' +
   'bGfm82Od4XxUV2HhECriqLbCqs7whBVqqS3KLpJf3V0fZ4HVTWWFAVQu0LF1Ma' +
   'gPkHHugXRU0YTCXVOY1GIqhqbgr6tzCIOlMgCDBCZtD8YKbuB9gAf9HxphwiYM' +
   'EWRG0+iTjy441p9aV84mtrRcfHnwwuG+84d6Z1/qnnmxc3xgSXUx8efOLRShSD' +
   '5ySD6EcPkS79ePh3b0l936dMTS0Pbe0vJktHGJE8xDvj9aEAxAfRiB3MxS4Rom' +
   'wTqLYrAMcgjaQl+uchZVqYaB1hMCJIVRKuJWLg88F2OuabWpxfN2ZzJla0vCUw' +
   'f3bhlo6qkSO1akhpeamxrcXa2xrcvI2OP6jjplRVp672jv1ckOeD8cQC4JViSk' +
   'xppkS118kVdYV2n/8FFfsZEXCqLXjnbfurkv+EgA6oNTXMcwziYVMLAASRU9bj' +
   'nAnDMajqDAmGtACI+wqsO+w+FENvxwYB/i4Zr2PGRTST1A+r7/4MG//9ybuzfn' +
   '/zXn3/f9G7d//+rbr69cvnR2ZmrkqbZsxrv/256erJj/qkhEyovDFUlpWaU4ub' +
   'shmyFyGNVnPd//riCYN1//P9PTEsM=');

 zmiananamiejscu := TSCARBitmap.Create('deNoBPQPC/DcABQAeExkyIBKAX' +
   'T6niWju0KL1zpjltH3rz7PRvv95QZCqfVr03LX+26r77MbeqX5cPikcExYYEhQ' +
   'QDhEQCw8aFhciFx0XDhMUDhIaEBgXFRYaFhUWDxYcEhoWDQ81LB64eEJtQxySa' +
   'EGVbUabckmSa0U5Jxb///dFMw0UDAA0KRN6Xy/RqFxyWinWqlqGbDmQcThhTCU' +
   'fFgUbEgEAAAD63ZMGAwEXDhMRDxBELRqKakm5l2/two3pu4Huworzz5/Osc6mZ' +
   'FHEhU/41qf50aH65b7aqoCBVTQaExkfGR0QDA0TERQcFhoZEhkTERIQDg8XFRg' +
   'bFRcYEhYWEhMLBwgGDA6OYTOQZzxvRBqug1mcckmedUp7VzRkUyz//6oFAAAXD' +
   'AAlHAeJbDeyjUshGAXWqlphVDFMOhktHgsjGwcpHwgWDgB+ZTxfTisTERIXDw9' +
   'oTTGXgGHDqoTgu4rOpHO7lmuukWyegWqvdUbcqnf51qn0zZ7ovpDUo3q8hFcjG' +
   'hYSCxIaFBggGhwVEBQSDA44KjgAAAAAAAAyKiwWERUYExcICQ89MBy0eEN0SR6' +
   'keEuofVKdckeXbkRqSiqYiVz/86suJAwpHggpIQ1oUCXarl7JolnWqlrMpFjht' +
   'WV5Xy0fFAEjGQUMCgFVQijhuWA4KjgwJBeCakuaim+ahF+bfFGPcEaRc0+XgF+' +
   'RdVO8iFbfr3rwyJf72Kjsw5DRoHDWpHddQSoWEhMnHCAcExYZEBUWERUoHCQAA' +
   'AAAAAAwJCwbFhoOCwwPERCVYTWOZDprQha6jmCheE2bcUKYbT9oRym8qXb//9Q' +
   'pHwsjGQIeFAKoh0nAm1gqHgbWqlo3LQ01KQpaTzEWDAAXDQABAABBLh/z7G4oH' +
   'CRqVTuNeFuThGmcjW+ejG2TfVyTelmVfl2Yd1HEkl/SoGnYrnry1Kr12K/kvpT' +
   'rw5fGlmUvIx0ZDhIaDxUhGBkZFxokICIAAAAAAAAwKCodFBkHDhJJNyCZaj9fO' +
   'RmPZDqrf1SnfVGgdEeYbkFnSCmahEz4xXEGAAA8MxdORSjXrF/Uql3ZrV2jgkT' +
   'fs2PJoVfcsGAnHQpLQCUEAAAuJBvk0U0kICKPDSEr');  

 wezzmiany := TSCARBitmap.Create('deNpVUQtugzAMrXYhqBP/IWz32P2vwZ5' +
   'DW7EIWY5jv4/5fXw9zvO0rs6WYsb4eMRAkYlRcZIUR1E7o7ixoxPJLtWPJM2RW' +
   '+cNCH0+WU5MDjYX7lSDVWmCKMRgSY0RFQvThLnRsgD5iKM6qW+WmznYi2KqmrM' +
   'NmMPyrSF0Jtn80ED/ZvbimuxIEGkhjOMVV+ey8+2JiCtMqeqI1JXoyVd/X1+C7' +
   '+djCh5/bETrgLooPgZLiU9HXbFS+DXuOl+PrHFp3WqBsreXTiUtVaJYSwHSeyf' +
   'sbVkBEqyX2X9i0PvsbuGm9zo8GsxO8FCDvA2Y0ynOMFxzqN9HHD6Id6+1gP1ak' +
   'TbBL7Ear4ppAuQPXXD/WA==');

 biore := TSCARBitmap.Create('deNpNUEFyAzEIy6HP6B8yBQsE7O7/f7WVk84' +
   '0PjCAQEj+fnw97vsuMG2lR1qqPDiKXDuvgNB4+oHapcUeqB4yDO9hfxp8Kb/YV' +
   'xZ89z+fqA7WK8Gb9h8y0KmkkxVJxwQ/0NWsjr07ix1zgFuPQc1cwI9N8upTqNZ' +
   'FEmb0GFAK+YqdobvQyksYlsymrpRw+KweTAMymAgiRCIZvZWU3O3mSvFvkXXql' +
   'zR5RsumoPY/OzqqE1fOL8vGh5k=');

MoveToTray;

wait (100);

Write(TimeToStr(Time));
WriteLn(' Start bota');
Alert(TimeToStr(Time) + ' Start bota');

wait (2000);
globaltimer:=0;
niezmieniatimer:=0;
timernamiejscu:=0;
niewykrytotimer:=0;

reset:

przeladujtimer:=0;

poczatek:

wait (50);

if GetCurrentKeyState(VK_F9) then
 begin
   WriteLn(TimeToStr(Time) + ' Zatrzymano bota');
   Alert(TimeToStr(Time) + ' Zatrzymano bota');
   TerminateScript;
 end;

wait (50);

if GetCurrentKeyState(VK_F9) then
 begin
   WriteLn(TimeToStr(Time) + ' Zatrzymano bota');
   Alert(TimeToStr(Time) + ' Zatrzymano bota');
   TerminateScript;
 end;

niewykrytotimer:=niewykrytotimer+1;  

FindBitmap(x, y, niezmienia, kordx, kordy, 1920, 1080);
if (x > 10) then
 begin
 if (niewykrytotimer > niewykrytotimer2*10) then WriteLn(TimeToStr(Time) + ' Nie wykryto zmian na miejscu (prawdopodobnie koniec zmian na tej kupce) - wyszukiwanie zmian...');
 FindBitmap(x, y, zmiana, kordx, kordy, 1920, 1080);
 if (x < 10) then
   begin
   Write(TimeToStr(Time));
   WriteLn(' Nie znaleziono zmian w EQ.');
   goto pobieraniebonow;
   end;
 end;
if (x > 10) then
 begin
   zmianytimer:=zmianytimer+1;
   FindBitmap(x, y, zmiana, kordx, kordy, 1920, 1080);
   if (x > 10) then
   begin
   if (zmianytimer = 1) then
     begin
     Write(TimeToStr(Time));
     Write(' Znaleziono zmiany... ');      
     end;
   GetMousePos(getx, gety);
   MoveMouseEx(x, y, szybkoscmyszki);
   wait (czekanieclick);
   MouseBtnDown(x, y, mbLeft);
   wait (czekanieclick);
   FindBitmap(x, y, ksiazka, kordx, kordy, 1920, 1080);
   MoveMouseEx(x+95, y, szybkoscmyszki);
   wait (czekanieclick);
   MouseBtnUp(x+95, y, mbLeft);
   wait (czekanieclick);
   MoveMouseEx(getx, gety, szybkoscmyszki);
   if (zmianytimer = 1) then
     begin
     WriteLn('Przeniosiono zmiany!');
     niewykrytotimer:=0;
     end;
   przeladujtimer:=0;
   end;
 end;

FindBitmap(x, y, zmiananamiejscu, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 przeladujtimer:=przeladujtimer+1;
 if (przeladujtimer < 3) then
 begin
   FindBitmap(x, y, przeladuj, kordx, kordy, 1920, 1080);
   if (x > 10) then
   begin
   if (przeladujtimer = 1) then
     begin
     Write(TimeToStr(Time));
     Write(' Zmiany sa na miejscu i znaleziono przycisk przeladuj... ');
     end;
   GetMousePos(getx, gety);
   MoveMouseEx(x, y, szybkoscmyszki);
   wait (czekanieclick);
   ClickMouseEx(x, y, mbLeft, 0);
   wait (czekanieclick);
   MoveMouseEx(getx, gety, szybkoscmyszki);
     if (przeladujtimer = 1) then
     begin
     WriteLn('Przeladowano ID zmian!');
     end;
   zmianytimer:=0;         
   end; 
 end;
 if (przeladujtimer=ilerazyprzeladuj*10) then
 begin
   FindBitmap(x, y, przeladuj, kordx, kordy, 1920, 1080);
   if (x > 10) then
   begin
   Write(TimeToStr(Time));
   Write(' Zmiany sa na miejscu i znaleziono przycisk przeladuj... ');
   GetMousePos(getx, gety);
   MoveMouseEx(x, y, szybkoscmyszki);
   wait (czekanieclick);
   ClickMouseEx(x, y, mbLeft, 0);
   wait (czekanieclick);
   MoveMouseEx(getx, gety, szybkoscmyszki);
   WriteLn('Przeladowano ID zmian!');
   WriteLn(' ');         
   end;
 end;
 if (przeladujtimer=ilerazyprzeladuj*20) then
 goto reset;
end;

goto poczatek;   

pobieraniebonow:

WriteLn(TimeToStr(Time) + ' Zaraz nastapi pobieranie bonow');
Alert(TimeToStr(Time) + ' Pobieranie bonow');
wait (3000);

pobieraniebonow2:

wezzmianytimer:=0;
bioretimer:=0;
probaksiazki:=0;

klikniecieksiazki:
wait (100);

if GetCurrentKeyState(VK_F9) then
 begin
   WriteLn(TimeToStr(Time) + ' Zatrzymano bota');
   Alert(TimeToStr(Time) + ' Zatrzymano bota');
   TerminateScript;
 end;

FindBitmap(x, y, wystarczajacoz1, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;
FindBitmap(x, y, wystarczajacoz2, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;
FindBitmap(x, y, wystarczajacoz3, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;
FindBitmap(x, y, wystarczajacoz4, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;
FindBitmap(x, y, wystarczajacoz5, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;
FindBitmap(x, y, wystarczajacoz6, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;
FindBitmap(x, y, wystarczajacoz7, kordx, kordy, 1920, 1080);
if (x > 10) then
begin
 WriteLn('Zapelniono pierwsza zakladke zmianami');
 goto poczatek;
end;

probawziecia:=0;
probabiore:=0;
globaltimer:=globaltimer+1;
probaksiazki:=probaksiazki+1;
GetMousePos(getx, gety);
FindBitmap(x, y, ksiazka, kordx, kordy, 1920, 1080);
if (globaltimer > iloscprob*10+1) then
begin
   if (globaltimer > iloscprob*10+2) then
   begin
     WriteLn('Nie znaleziono ksiazki przez dluzszy czas.');
     WriteLn('Podejmowanie opcji naprawy');
     globaltimer:=0;
     goto kliknieciebiore;
   end;
 WriteLn('Nie znaleziono ksiazki przez dluzszy czas.');
 WriteLn('Podejmowanie opcji naprawy');
 goto kliknieciewezzmiany;
end;
if (x < 10) then goto klikniecieksiazki;
if (x > 10) then
begin
 Write('Znaleziono ksiazke za ');
 Write(probaksiazki);
 WriteLn(' razem');
 MoveMouseEx(x, y, szybkoscmyszki);
 wait (czekanieclick);
 ClickMouseEx(x, y, mbRight, 0);
 wait (czekanieclick);
 MoveMouseEx(getx, gety, szybkoscmyszki);
 if (czyklikac = 1) then ClickMouseEx(getx, gety, mbLeft, 0);  
end;

if (x < 10) then goto klikniecieksiazki;

kliknieciewezzmiany:
wait (100);
wezzmianytimer:=wezzmianytimer+1;
probawziecia:=probawziecia+1;

if GetCurrentKeyState(VK_F9) then
 begin
   WriteLn(TimeToStr(Time) + ' Zatrzymano bota');
   Alert(TimeToStr(Time) + ' Zatrzymano bota');
   TerminateScript;
 end;

GetMousePos(getx, gety);
FindBitmap(x, y, wezzmiany, kordx, kordy, 1920, 1080);
if (x < 10) then
begin
 if (wezzmianytimer > iloscprob*10) then
   begin
   WriteLn('Reset programu');
   goto pobieraniebonow;  
   end;
 goto kliknieciewezzmiany;
end;
if (x > 10) then
begin
 Write('Znaleziono przycisk od brania zmian za ');
 Write(probawziecia);
 WriteLn(' razem');
MoveMouseEx(x, y, szybkoscmyszki);
wait (czekanieclick);
ClickMouseEx(x, y, mbLeft, 0);
wait (czekanieclick);
MoveMouseEx(getx, gety, szybkoscmyszki);
if (czyklikac = 1) then
begin
ClickMouseEx(getx, gety, mbLeft, 0);  
end;
end;

kliknieciebiore:
wait (100);
bioretimer:=bioretimer+1;
probabiore:=probabiore+1;
GetMousePos(getx, gety);

if GetCurrentKeyState(VK_F9) then
 begin
   WriteLn(TimeToStr(Time) + ' Zatrzymano bota');
   Alert(TimeToStr(Time) + ' Zatrzymano bota');
   TerminateScript;
 end;

FindBitmap(x, y, biore, kordx, kordy, 1920, 1080);
if (x < 10) then
begin
 if (bioretimer > iloscprob*10) then
 begin
   WriteLn('Reset programu');
   goto pobieraniebonow;  
 end;
 goto kliknieciebiore;
end;
if (x > 10) then
begin
 Write('Znaleziono przycisk brania zmian za ');
 Write(probabiore);
 WriteLn(' razem');
end;
MoveMouseEx(x, y, szybkoscmyszki);
wait (czekanieclick);
ClickMouseEx(x, y, mbLeft, 0);
wait (czekanieclick);
MoveMouseEx(getx, gety, szybkoscmyszki);
if (czyklikac = 1) then ClickMouseEx(getx, gety, mbLeft, 0);  

globaltimer:=0;
wezzmianytimer:=0;
bioretimer:=0;
goto pobieraniebonow2;

end.

 

And I have some questions about functions that I can use in code. I heared about ActiveWindow. It mean program can work on background? And my other question is: Is it able to change MoveMouse for something like "JumpMouse"? Now it move from x1 to x2 but what if i want to jump from x1 to x2? I tried movespeedex with speed 999999999 but it goes too fast.

There is a thread that inspired me to make this post.

http://forums.scar-divi.com/archive/index.php/t-1391.html

 

Oh and I almost forgot. Is available to get window height and weight? Function? Somethink like "GetWindowSize (x, y)"?

 

If you spotted something that can be switched for better performance, let me know. And sorry again for my not best English and chaos in code :P.

Link to comment
Share on other sites

And I have some questions about functions that I can use in code. I heared about ActiveWindow. It mean program can work on background?
Not sure on the question here. SCAR can be minimized ( GetSelf.WindowState := wsMinimized; ) or the client brought to the front ( GetClient.Activate ). Or do you mean you want to use the entire desktop as the client?

 

 

And my other question is: Is it able to change MoveMouse for something like "JumpMouse"? Now it move from x1 to x2 but what if i want to jump from x1 to x2? I tried movespeedex with speed 999999999 but it goes too fast.
I don't think this is possible. The mouse has to physically travel between point a and point b, the same as if a human were moving the mouse.

 

 

Oh and I almost forgot. Is available to get window height and weight? Function? Somethink like "GetWindowSize (x, y)"?
Something like this?
var
 B: TBox;
 Width, Height: Integer;

B := GetClient.ImageArea;
Width := (B.X2 - B.X1 + 1);
Height := (B.Y2 - B.Y1 + 1);

Link to comment
Share on other sites

Not sure on the question here. SCAR can be minimized ( GetSelf.WindowState := wsMinimized; ) or the client brought to the front ( GetClient.Activate ). Or do you mean you want to use the entire desktop as the client?

 

Umm... I mean application window (example: game window, browser window). I know I can run it without special commands on Virtual Machine with virtual mouse, but then "other bot" is not working.

I want to minimalize program and "say" specified process, or his window something like "X, Y was clicked" etc, or just stop moving mouse even without minimalizing then I'll be able to do something on computer when bot is running.

 

I don't think this is possible. The mouse has to physically travel between point a and point b, the same as if a human were moving the mouse.

 

So commands like "SetMousePos" doesn't exists or are useless? :(

 

If I want bot to click specified place, can I use only ClickMouse or I need to place cursor in this place using MoveMouse like I'm doing it now? Hmm... I know, I can check it, but I also want opinion from someone, who know much more than me.

 

Something like this?

var
 B: TBox;
 Width, Height: Integer;

B := GetClient.ImageArea;
Width := (B.X2 - B.X1 + 1);
Height := (B.Y2 - B.Y1 + 1);

 

Hmm... It gives resolution of my screen, not specified window. I want effect like this:

WriteLn(BoxToStr(GetWindowBox(GetActiveWindow)));

And it says (1021,136,1762,905)

It is my current position of SCAR Divi window. I need it as variables but I can't convert it.

 

On wiki (Box informations) I saw box have 4 variables, x1, y1, x2, y2, so... How I can use it with GetActiveWindow?

 

And I have 2 other questions.

First is: how my bot can do something every "x" seconds (or x*1000 miliseconds)? If I use MoveMouse it slow down timer by few seconds, and finally there is difference betwen realtime and program time. I saw function GetSystemTime. It is the best option to get realtime in program? Uses GetSystemTime before functions and actions like MoveMouse and uses GetSystemTime2 again before wait command, and write in wait logical operation (example for 10seconds) like wait (10000 - (GetTimeRunning2 - GetTimeRunning); ? Should it work correctly? If yes just tell me that it is correct and I'll try add it in my code.

 

And next one... Is it possible to make a simple form in SCAR? Just small window with background, some text on it, maybe a few buttons? I saw in Tools option called "Form Editor", so I just want to know. I'll be happy if there is already some tutorials, how to build simply form. I builded mine in Form Editor with background image and useless button... And I still don't know how to do working buttons (example: if button1 clicked -> inactive button1 & active button2 & do "code", if button2 clicked -> inactive button2 & active button1 & do "code").

 

If you don't understand something, let me know.

Edited by CoUsT
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...