|
|
|
Need script for findcolor |
|
|
killerwhale123 |
29.9.2023, 9:11
|
Registred
Сообщений: 8
Регистрация: 29.9.2023 Группа: Пользователи Наличность: 0
Пользователь №: 20.617
Возраст: 25
|
Hello im trying to make a script to collect ores. The ore i want to collect spawns in different locations every 3 minutes. Im kinda new to find color command. Can someone make me a script for uopilot that finds the ore in my screen and right clicks it to collect it? The script i made doesnt find the ore and it keeps repeating the command but nothing happens. It feels like the script is scanning only the top left part of the screen and not the entire window. The ore is this: https://prnt.sc/FryMTWoOgd4v My script that doesnt work is this: set workwindow 10354828 set #startX 1 set #startY 1 set #endX 1920 set #endY 1080 set #a findcolor (#startX #startY #endX #endY (1617573 )%arr workwindow) if #a > 0 double_right %arr[1 1] %arr[1 2] double_right %arr[1 1] %arr[1 2] wait 10s left 451, 477 wait 3min end_if Can someone make me a better script?
|
|
|
|
yodich |
30.9.2023, 16:46
|
Novice
Сообщений: 90
Регистрация: 24.8.2020 Группа: Пользователи Наличность: 0
Пользователь №: 19.728
Возраст: 29
|
Код
--lua function print ( ... ) return log ( ... ) end print ('clear')
local function fc (xstart, ystart, xend, yend, colors, count) -- x, y, xend, yend, colors, countColors local intCount = count or 2 local counter = 0 local intColors = colors or {} for i = 1, #intColors do local RC = findcolor (xstart, ystart, xend, yend, intColors[i], "%RCm", WindowWork) if RC then counter = counter + 1 if counter >= intCount then x, y = RCm[1][1], RCm[1][2] return x, y end end end end function Work (nameWork, fullscreen) local fullscreen = fullscreen or false local workwin = findwindow (nameWork) if ( workwin ) then local WindowWork = workwindow (workwin[1][1], "child") if ( fullscreen == true ) or ( fullscreen == "fullscreen" ) then showwindow ( WindowWork, "maximize" ) end xth, yth, width, height, errorcode = windowpos (WindowWork) else msg ("Error Window") end_script() end return workwin end
local WinGame = Work ("You Name Window")
local MyColors = { { "Ruda", 2060642, 1665111, 1858385, 2454882, 1928028, 2653031, 1593670, 2518108, 1667422, 1734509 } --[[ { Here you can enter your own colors } ]]-- }
while WinGame do for i = 1, #MyColors do local Ruda = fc (xth, yth, width, height, MyColors[i], 5, WindowWork) if Ruda then -- here's your code double_right (x, y) -- double right click wait (10000) -- 10 sec break end end --- here's your code left (100, 100) wait (180000) end
|
|
|
|
killerwhale123 |
30.9.2023, 20:37
|
Registred
Сообщений: 8
Регистрация: 29.9.2023 Группа: Пользователи Наличность: 0
Пользователь №: 20.617
Возраст: 25
|
Okay thank you but im not very familiar with lua. Do i have to create modules and import them in uopilot or i can copy ur entire code and put it in the uopilot as it is? Also can you tell me what parts of the code i have to replace? I put it in uopilot as it is I only replaced local WinGame = Work ("You Name Window") and { Here you can enter your own colors }. It doesnt show an error but also it doesnt do anything. Also do i have to run the game in fullscreen? I play in windowed mode not fullscreen Uopilot log window : https://prnt.sc/Q2W2C9t1-UPw My code looks like this : Код --lua function print ( ... ) return log ( ... ) end print ('clear')
local function fc (xstart, ystart, xend, yend, colors, count) -- x, y, xend, yend, colors, countColors local intCount = count or 2 local counter = 0 local intColors = colors or {} for i = 1, #intColors do local RC = findcolor (xstart, ystart, xend, yend, intColors[i], "%RCm", WindowWork) if RC then counter = counter + 1 if counter >= intCount then x, y = RCm[1][1], RCm[1][2] return x, y end end end end
function Work (nameWork, fullscreen) local fullscreen = fullscreen or false local workwin = findwindow (nameWork) if ( workwin ) then local WindowWork = workwindow (workwin[1][1], "child") if ( fullscreen == true ) or ( fullscreen == "fullscreen" ) then showwindow ( WindowWork, "maximize" ) end xth, yth, width, height, errorcode = windowpos (WindowWork) else msg ("Error Window") end_script() end return workwin end
local WinGame = Work ("Talisman Online | All Stars (NH) | ver.5956")
local MyColors = { { "Ruda", 2976607, 2606500, 2470821, 1343588 }
--[[ { 2976607, 2606500, 2470821, 1343588 } ]]-- }
while WinGame do
for i = 1, #MyColors do local Ruda = fc (xth, yth, width, height, MyColors[i], 5, WindowWork)
if Ruda then -- here's your code double_right (x, y) -- double right click wait (10000) -- 10 sec break end end
--- here's your code left (100, 100) wait (180000) end
|
|
|
|
Madeus |
1.10.2023, 3:25
|
Apprentice
Сообщений: 283
Регистрация: 19.11.2019 Группа: Пользователи Наличность: 8477
Пользователь №: 19.451
Возраст: 32
|
Change local Ruda = fc (xth, yth, width, height, MyColors[i], 5, WindowWork) to local Ruda = fc (xth, yth, width, height, MyColors[i], 5, WinGame) and you need to enter the coordinates: xth, yth, width, height
|
|
|
|
killerwhale123 |
1.10.2023, 20:18
|
Registred
Сообщений: 8
Регистрация: 29.9.2023 Группа: Пользователи Наличность: 0
Пользователь №: 20.617
Возраст: 25
|
https://imgur.com/frlsaYq . Sometimes on the log window it says : Failed to create image. 20:25:45 1 (autosaved_1.txt, 0): Failed to select a picture. 20:25:45 1 (autosaved_1.txt, 0): Failed to create an image from memory. 20:25:45 1 (autosaved_1.txt, 0): Did not close. 20:25:45 1 (autosaved_1.txt, 0): Did not open Цитата(killerwhale123 @ 1.10.2023, 20:17) https://imgur.com/frlsaYq . Sometimes on the log window it says : Failed to create image. 20:25:45 1 (autosaved_1.txt, 0): Failed to select a picture. 20:25:45 1 (autosaved_1.txt, 0): Failed to create an image from memory. 20:25:45 1 (autosaved_1.txt, 0): Did not close. 20:25:45 1 (autosaved_1.txt, 0): Did not open Could you make a simpler script?
|
|
|
|
|
|
2 чел. читают эту тему (гостей: 2, скрытых пользователей: 0)
Пользователей: 0
|
|