|
Post by jirenn on May 27, 2019 16:46:14 GMT
i want to share my script to my brother. The script works fine on my phone but it doesnt work on my bro's phone he said that it clicks the wrong image or location. My phone is 1280x720 and my brother's phone is 1920x1080. i use region, locations, set the script dimension and compare dimension to 1280. will it affect the region and locations because of the difference in screen resolution? when i share my old script without region and locations. Only images it works fine on his phone.
if exists(Pattern("Sample.png"), 0) then existClick("Sample.png") end This code works to both celphone
if (sample:exists("Sample.png", 0)) then click(Location(390, 390)); sleep(0.2) end this one works fine on my phone but not working on his phone.
whats the easy way to fix this?
please help me. thank you..
|
|
|
Post by jirenn on May 27, 2019 16:57:20 GMT
also how to make script run for a period of time like after 5 minutes running the script it will switch to another script. thanks
|
|
|
Post by AnkuLua on May 27, 2019 21:53:45 GMT
It should work on your brother's phone. Share your and your brother's screenshot You can use file() to switch to another script.
|
|
|
Post by jirenn on May 28, 2019 10:36:57 GMT
sir he's at work right now. i cant ask him for screenshot.. sir even if there is a difference in screen resolution. the locations and regions will not be affected? if ankulua detects the image in that locations it will click the the same spot? this is the code sir allRune = Region(422, 230, 83, 19) if (normalRune:exists("heroRune.png", 0) or normalRune:exists("legendRune.png", 0)) then click(Location(752, 584)); sleep(1.0)----------------------------------this one will click the Get Image elseif (normalRune:exists("normalRune.png", 0) or normalRune:exists("rareRune.png", 0)) then click(Location(536, 580)); click(Location(529, 439)); sleep(1.0)---------this one will click the Sell Image end but on his phone when ankulua detects the heroRune.png or legendRune.png instead of clicking the Get Image it will click the Sell Image so i thought maybe because we have a different screen resolutions.. but you said that it should work on my brothers phone.. yup its working but it dont click the right Location.. another question sir. what if i only use images with regions instead of clickLocation? get = Region(710, 556, 76, 52) allRune = Region(422, 230, 83, 19) sell = Region(502, 546, 65, 42) if (normalRune:exists("heroRune.png", 0) or normalRune:exists("legendRune.png", 0)) then get:existsClick("get.png", 0) elseif (normalRune:exists("normalRune.png", 0) or normalRune:exists("rareRune.png", 0)) then sell:existsClick("sell.png", 0) end will it work both on our phone? thanks for helping me
about the file() sir what i mean is set a time when the first script runs then after 5minutes it will switch to another script..
i use this T = 0 + os.date("%H%M") but i always need to set the time so the script will run or sometimes i have to wait for the exact time. T2 = 0 + os.date("%H%M")
tm = 0 tm2 = 0
if (T == tm) then dofile(localPath.."lib/bot10.lua") elseif (T2 == tm2) then dofile(localPath.."lib/bot20.lua") end
i always need to set the tm and tm2
|
|
|
Post by AnkuLua on May 29, 2019 12:05:44 GMT
First, it's better to use existsClick() on png than click() on Location.
You can use timer() in the bot10.lua and bot20.lua. timer = Timer() if (timer:check() > 5*60) then return end
It will exit the lua file and go back to main lua file. Just like functions.
|
|
|
Post by jirenn on May 31, 2019 3:06:52 GMT
First, it's better to use existsClick() on png than click() on Location. You can use timer() in the bot10.lua and bot20.lua. timer = Timer() if (timer:check() > 5*60) then return end It will exit the lua file and go back to main lua file. Just like functions. thanks boss. toast(" W: " .. win .. " L: " .. def) this one dont appear in my phone but when i tried this in my brother's phone its working.. im using oppo A57 i tried print() but it will only appear after scriptExit() or when i stopped the script.. i forgot which one.. how to fix toast()? thanks again
|
|
|
Post by AnkuLua on May 31, 2019 3:55:47 GMT
|
|
|
Post by jirenn on May 31, 2019 5:46:36 GMT
setHighlightStyle(0x8fffff00, true) --this one is used to change color? txt_reg:highlight("W: " .. win .. " L: " .. def)? is this correct? thanks
|
|
|
Post by AnkuLua on May 31, 2019 13:29:58 GMT
For highlight with text use setHighlightTextStyle (bgColor, textColor, textSize) to change colors.
txt_reg:highlight("W: " .. win .. " L: " .. def) is correct.
|
|
|
Post by jirenn on Jun 2, 2019 2:25:51 GMT
For highlight with text use setHighlightTextStyle (bgColor, textColor, textSize) to change colors. txt_reg:highlight("W: " .. win .. " L: " .. def) is correct. thanks it worked..
|
|
|
Post by jirenn on Jun 15, 2019 9:12:08 GMT
hi.. how to make a 30 minutes trial script? after 30mins the script will be lock or unusable. something like that... thanks again...
|
|
|
Post by AnkuLua on Jun 15, 2019 13:23:49 GMT
hi.. how to make a 30 minutes trial script? after 30mins the script will be lock or unusable. something like that... thanks again... Use Timer() ankulua.boards.net/thread/13/advanced-methods#TimerFor example, create timer at the beginning of the script timer = Timer() Then check it at kernel of the script if (timer:check() > 30*60) then scriptExit("Trial script can only run 30 minutes") end
|
|
|
Post by jirenn on Jun 16, 2019 17:54:23 GMT
thanks... sorry if i asked too much xD.. thanks for helping me but i have another problem. pls view the screenshot below.. there are a lot of 3Stars and different level if i use this code it might not click the correct image since there are multiple img of 3Star. if monster:exist("3star.png", 0) and monster:exist("lvl1.png", 0) then mob = monster:getLastMatch() click(mob) sleep(1.0) end also what if there is a 4Star Level 1 Monster and 3Star Level 25 Monster? since the condition is getLastMatch and both 3star and level 1 exist in region but the level 1 is a 4star monster and not 3star. i think it will click the 4star monster instead of 3Star Monster. what i want to happen is to only click in a 3Star Level 1 Monster. can you give me a better code to only click the 3Star Level 1 Monster. thank you.
|
|
|
Post by Exilereven on Jun 16, 2019 20:31:14 GMT
It sounds like your going to need to use findAll(), and NumberOCR. i would use findall to find matches for all the 3 stars, or all the 4 stars, then use OCR on only the matches from findAll(), to determine what level they all.
Maybe you could set it up so that it compares like: "anything under level 5, or 10, or etc..." then click on them, or whatever your looking for.
|
|
|
Post by jirenn on Jun 17, 2019 3:38:59 GMT
It sounds like your going to need to use findAll(), and NumberOCR. i would use findall to find matches for all the 3 stars, or all the 4 stars, then use OCR on only the matches from findAll(), to determine what level they all. Maybe you could set it up so that it compares like: "anything under level 5, or 10, or etc..." then click on them, or whatever your looking for. i dont have any idea how to use number ocr and findall().. hehehehe... can you give me an example? thanks
|
|