rwnt
New Member
Posts: 3
|
Post by rwnt on May 3, 2020 21:03:30 GMT
Okay, so I've been relentlessly working on writing and testing this script for several days, and I've hit a wall. I need help. Basically the purpose of this script is to join alliance battles whenever they pop up, and refill "stamina" when needed. Rinse and repeat. Before I started working on this myself, I did request help in a thread, which outlines the purpose pretty well. If you’d like to take a look at that, it can be found on the forums here. Here's a pastebin with the code. Here's the whole .zip with images, libs, etc. The issue I’m having is that I’m unable to find images on the lower part of the screen. I’ve adjusted my region table over and over in an attempt to locate ‘join.png’ specifically. No luck. My main concern is that I’m doing something wrong, because snapAndPlay works fine. Whether it’s file structure, syntax, screenshots, etc... I'm just not sure. I used snapAndPlay's images, then used the coordinates provided by the generated .luar files in my code. I’m on macOS and emulating through Bluestacks (Root). Using latest version of AnkuLua. My resolution is 720x1280. If there’s any other information I can provide that would be of use, just let me know! Thanks for your time in reading this.
|
|
|
Post by AnkuLua on May 3, 2020 23:44:33 GMT
Here are some suggestions to debug 1. write a test script only for join.png. Test the test script when join.png on the screen. 2. remove the region and try to find and click join.png. This will make sure that join.png is correct 3. highlight the region before finding joing.png. This can make sure that the region is correct. 4. If all above works, it should work with the new region and join.png
|
|
|
Post by Exilereven on May 4, 2020 0:44:28 GMT
Okay, so I've been relentlessly working on writing and testing this script for several days, and I've hit a wall. I need help. Basically the purpose of this script is to join alliance battles whenever they pop up, and refill "stamina" when needed. Rinse and repeat. Before I started working on this myself, I did request help in a thread, which outlines the purpose pretty well. If you’d like to take a look at that, it can be found on the forums here. Here's a pastebin with the code. Here's the whole .zip with images, libs, etc. The issue I’m having is that I’m unable to find images on the lower part of the screen. I’ve adjusted my region table over and over in an attempt to locate ‘join.png’ specifically. No luck. My main concern is that I’m doing something wrong, because snapAndPlay works fine. Whether it’s file structure, syntax, screenshots, etc... I'm just not sure. I used snapAndPlay's images, then used the coordinates provided by the generated .luar files in my code. I’m on macOS and emulating through Bluestacks (Root). Using latest version of AnkuLua. My resolution is 720x1280. If there’s any other information I can provide that would be of use, just let me know! Thanks for your time in reading this. Also, you already have debugmyscript loaded, why dont you use it in your script? Incase you need help: Your doing it like this: REG.image.image:exists('image.png', 10) First off. If you want to use debugscript setup your searches different. Like this. Image:R(REG.image.image_region:exists('image.png',10) Then you can use: Image:menu() Inside your script at the beginning to turn on all your highlights, so you can watch each one happen with highlighted Region and image and humanoid area if wanted(thanks to Mercobots). Also if your going to use just click use locations. If your going to use exists or existsClick, then you an if statement. I will look over code for you when I get a chance see if we can get it fixed up.
|
|
rwnt
New Member
Posts: 3
|
Post by rwnt on May 4, 2020 1:00:22 GMT
Thank you so much, Exilereven ! I've been using debugscript for simple testing, just using examples I've found posted elsewhere on the forum. Very useful information about setting up the searches different. That really helps. I'll most definitely give that a try!! I really appreciate the support and look forward to hearing your insight
|
|
|
Post by Exilereven on May 4, 2020 1:14:18 GMT
REG = {}
-- Ankulua
SIMILAR = 0.7
WIDTH = 720
HEIGHT = 1280
ROOT = scriptPath()
DIR_IMAGES = ROOT .. "images/"
DIR_LIBS = ROOT .. "libs/"
setImagePath(DIR_IMAGES)
-- Ankulua settings
Settings:setCompareDimension(true, WIDTH)
Settings:setScriptDimension(true, WIDTH)
Settings:set("MinSimilarity", 0.8)
--libs/add debug --add debug lua dofile(scriptPath().."DebugMyScript.luac")
luaLib = loadstring(httpGet("https://raw.githubusercontent.com/mercobots/luaLib/master/luaLib.lua"))
luaLib()
commonLib = loadstring(httpGet("https://raw.githubusercontent.com/AnkuLua/commonLib/master/commonLib.lua"))
commonLib()
REG.image = {
image_region = Region(0, 0, 720, 1280), image_region2 = Region(532, 436, 180, 60), -- image_region2 = Region(432, 811, 246, 85), image_region3 = Region(495, 1181, 180, 60), image_region4 = Region(362, 716, 240, 80), image_region5 = Region(433, 876, 170, 80), image_region6 = Region(508, 914, 80, 80), image_region7 = Region(18, 18, 60, 60), image_region8 = Region(157, 1164, 420, 114), }
Image:menu()
function joinrally() toast("Joining Rally") if Image:R(REG.image.image_region):existsClick("bos1.png", 10) then
if Image:R(REG.image.image_region8):existsClick("join.png", 4) then
rallyset()
else keyevent(4) joinrally2()
end
end
end
function joinrally2()
if Image:R(REG.image.image_region2):existsClick("bos1.png", 100) then
if Image:R(REG.image.image_region):waitClick("join.png", 100) then
rallyset()
else Image:R(REG.image.image_region7):existsClick("back.png")
keyevent(4) joinrally3()
end
end
end
function joinrally3()
if Image:R(REG.image.image_region3):existsClick("bos3.png", 1) then
if Image:R(REG.image.image_region):waitClick("join.png", 1) then
rallyset()
else Image:R(REG.image.image_region7):existsClick("back.png")
keyevent(4) joinrally()
end
end
end
function rallyset()
if Image:R(REG.image.image_region):click("prst.png") then
if Image:R(REG.image.image_region):existsClick("mrch.png") then
if Image:R(REG.image.image_region4):waitClick("confirmstm.png", 2) then
stam()
elseif Image:R(REG.image.image_region):existsClick("acm.png") then
if Image:R(REG.image.image_region):existsClick("war.png") then
joinrally()
end
end
end
end
end
function stam()
if Image:R(REG.image.image_region5):existsClick("usestm.png", 2) then
if Image:R(REG.image.image_region6):existsClick("usestm2.png", 2)then
if Image:R(REG.image.image_region7):existsClick("back.png") then
if Image:R(REG.image.image_region):existsClick("mrch.png") then --I changed this ^ from march.png if Image:R(REG.image.image_region):existsClick("acm.png") then
if Image:R(REG.image.image_region):existsClick("war.png") then
joinrally()
end
end
end
end
end
end
end -----Main Script Start-----
while true do joinrally() end
|
|
haydy
New Member
Posts: 9
|
Post by haydy on May 31, 2020 12:20:21 GMT
Thank you so much, Exilereven ! I've been using debugscript for simple testing, just using examples I've found posted elsewhere on the forum. Very useful information about setting up the searches different. That really helps. I'll most definitely give that a try!! I really appreciate the support and look forward to hearing your insight Hi where did you find this code? i developed this but i never released it anywhere.... sidebar, pretty sad to be taking credit for working "tirelessly" on a script you completely copy pasted...
|
|