Здравствуйте, гость ( Вход | Регистрация )

 
Ответить в эту темуОткрыть новую тему
> I need help with a healing automation script
Matheusochoa
сообщение 6.7.2023, 8:07
Сообщение #1


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



I'll start by apologizing for using the translator, I play an online game similar to tibia called LAWL MMORPG, and in it I've already managed to create a script to use manapotion and automated healing, in this game there's a function similar to tibia in the "exura sio" where I heal an ally, in this game I write in the chat bar /heal "nick" and it saves a hotkey to heal an ally, I would like a tip, or someone who could help me to assemble a script to automate this cure, it would be: identify my friend on the screen, because he doesn't have a fixed place where I can look for his life bar (which is making it difficult) locating him, to locate his life bar, and finally identify the amount of HP he has to automate healing for my ally, can anyone help me with this script in UoPilot? I'll leave the print of The game


Эскизы прикрепленных изображений
Прикрепленное изображение
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 6.7.2023, 14:34
Сообщение #2


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



hp bars and nicknames are transparent so this can be tricky. You can try to search for a character by a unique color, for example, by a yellow t-shirt, and then try to find his hp bar, it seems to me quite difficult, especially for a beginner.
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 6.7.2023, 17:01
Сообщение #3


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



What I thought of doing is that when the person is a Party leader, he has a blue symbol under the life bar, I thought of using this pixel to capture the coordinates, but I don't know how to store these coordinates to find the my ally's life bar, I'll leave an example of how it looks below

Цитата(Matheusochoa @ 6.7.2023, 17:00) *

What I thought of doing is that when the person is a Party leader, he has a blue symbol under the life bar, I thought of using this pixel to capture the coordinates, but I don't know how to store these coordinates to find the my ally's life bar, I'll leave an example of how it looks below



Прикрепленные файлы
Прикрепленный файл  barra_de_vida.bmp ( 3,66 килобайт ) Кол-во скачиваний: 73
Прикрепленный файл  barra_de_vida.bmp ( 3,66 килобайт ) Кол-во скачиваний: 61
Прикрепленный файл  barra_de_vida.bmp ( 3,66 килобайт ) Кол-во скачиваний: 66
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 6.7.2023, 21:14
Сообщение #4


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



set $a findcolor (154, 80 318, 260 1 1 2366701 %arr 2)

I was researching and came across this, can I search for the color in findimage, and then record its coordinates in %arr 2? and then use the %arr 2 cord to locate the life bar and then know whether or not to use the cure on an ally?
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 7.7.2023, 2:31
Сообщение #5


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



the logic could be like this - first you use findimage to find the blue icon. Just use findimage directly on the image you uploaded to get the exact coordinates of the blue icon. Then you need to select a point on the hp bar, for example, on the half when you already need to use the heal. Then calculate the difference in X and Y coordinates between the blue icon and the point on the hp bar. For example, the difference in X is 30, and in Y is 20. These values will be needed for the final script. Next, try to find the blue icon already in the game itself, if it works, then you can start searching for the hp bar. To do this, you need to use findcolor, in which the search area will consist of a single point. The coordinates of which will be taken from the findimage array, but adjusted, for example
Код

set #x %arr[1][1] + 30
set #y %arr[1][2] - 20

findcolor would be something like
Код
set #hp findcolor (#x, #y #x, #y 1 1 (1234-4321) %arr2 2 1 20)
if #hp <> 1
    sendex 5 // press 5
end_if

Since there is transparency, I recommend using a range in this findcolor and trying different deviations.
https://uopilot.uokit.com/wiki/index.php?title=Findimage
https://uopilot.uokit.com/wiki/index.php?title=Findcolor
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 7.7.2023, 18:33
Сообщение #6


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



It's a good example, but it won't work that way, because when I find the blue coordinate and try to find the bar, how do I make this findcolor recognize the color of the black life bar? he will be looking for the color blue right? I would have to have this %arr saved, yes, but be able to store the given coordinate of the blue point - %arr coordinate for him to search the black life bar, if so, can you teach me how to store these coordinates?

or does anyone have another solution?
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 8.7.2023, 1:28
Сообщение #7


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



if life bar becomes pure black then it gets even easier, black color is 0.
Код
set #icon findimage (947, 56 1067, 234  (E:\icon.bmp) %icon 2 80 1 5) // %icon[1 1] is X of blue icon, %icon[1 2] is Y
if #icon > 0
    set #x %icon[1 1] + 20
    set #y %icon[1 2] - 10 // #x and #y is saved coordiantes of point on life bar which becomes black when life fall
    set #hp findcolor (#x, #y #x, #y 1 1 0 %arr2 2 1 0) // check #x, #y point and
    if #hp = 1 // if its black then press 5
        sendex 5
    end_if
end_if
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 8.7.2023, 6:34
Сообщение #8


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



I'm having trouble finding the icon on the screen, would you be able to place it to find the blue color, and after finding the coordinate to locate the black part of the life bar? Note: the bar is not 100% black, you would need to find its color
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 8.7.2023, 12:28
Сообщение #9


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



could you upload few screenshots with party leader in different locations?
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 8.7.2023, 19:09
Сообщение #10


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



Thank you for helping me, so it's not in blue because the ally didn't want to be the leader of the party, but it's this blue that is above my name in the leader, so you can see better what I want to do? I want to look for the blue part of the leader, after searching try to capture where the life bar is, put a print of the life bar, how it gets low on life, will it participate in this method of yours that you've been giving me, will it Is there anything more efficient we can think of doing?


Прикрепленные файлы
Прикрепленный файл  TESTE1.bmp ( 3 мегабайт ) Кол-во скачиваний: 58
Прикрепленный файл  TESTE2.bmp ( 3 мегабайт ) Кол-во скачиваний: 56
Прикрепленный файл  TESTE3.bmp ( 3 мегабайт ) Кол-во скачиваний: 75
Прикрепленный файл  teste5.bmp ( 15,67 килобайт ) Кол-во скачиваний: 63
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 9.7.2023, 1:56
Сообщение #11


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



Код
 
set #icon findimage (13, 36 1111, 712 (E:\icon.bmp) %icon 2 90 1 15)
if #icon > 0
    set #x1 %icon[1 1]
    set #x2 %icon[1 1] + 25
    set #y1 %icon[1 2] - 12
    set #y2 %icon[1 2] - 8
    set #hp findcolor (#x1, #y1 #x2, #y2 1 1 (2282084-2348133) %hp 2 5 2)
    if #hp > 3
       sendex 5
    end_if
end_if

so the color of health changes, you need to specify your search area for findimage and the range of colors and deviation for findcolor (yellow, orange, red whatever you want. (2282084-2348133) - this is green)Прикрепленный файл  icon.bmp ( 154 байт ) Кол-во скачиваний: 76
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 9.7.2023, 6:01
Сообщение #12


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



set #icon findcolor (13, 36 1111, 712 (4001536-15744772) %icon 2 90 1 15)
if #icon > 0
set #x1 %icon[1 1]
set #x2 %icon[1 1] + 25
set #y1 %icon[1 2] - 12
set #y2 %icon[1 2] - 8
set #hp findcolor (#x1, #y1 #x2, #y2 1 1 (184067-710668) %hp 2 5 2 )
if_not #hp > 3
send F1
end_if
end_if


--------------------------------------------------------------------------------------------------
this way worked best, I'm having trouble looking for the icon, can you give me a picture of the icon without the background? then I test its form, because if there is someone in blue on the map, it keeps healing, and I also have a problem that when the person walks, it seems that it takes time to process and is picking up the wrong pixel, there is a way to take one screen print, then it analyzes the print?
In this way, it is already at a result of 65% good, but I wanted to adapt it to be better
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 9.7.2023, 14:01
Сообщение #13


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



Цитата(Matheusochoa @ 9.7.2023, 6:01) *

can you give me a picture of the icon without the background?

in the previous message
read carefully and do not use my parameters for findimage, choose your own
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 9.7.2023, 19:52
Сообщение #14


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



Now FindImage is working perfectly, but I'm having a problem with the life bar when I put it to find the green one, when I put it to find the Icon, and my ally is walking, he finds another coordinate other than the green one, because he is in motion, then it happens that he always heals, if he has stopped, he does not heal, so the script is at a 75% chance of success, I wanted to know if you can help me to locate when the life bar goes down, or when the dark part appears of it, but I'm having a problem because the bar is transparent, and it covers a lot when the background is light and the background is dark and ends up taking all the color codes (263172 dark) (4868167 light), I'll leave 2 prints below the backgrounds , and see how you can help me that way, or we are looking for another mechanic for this condition,
or is there some way for us to access the game's settings, and remove the effect of the bar being transparent


Прикрепленные файлы
Прикрепленный файл  teste_1.bmp ( 13,03 килобайт ) Кол-во скачиваний: 57
Прикрепленный файл  teste_2.bmp ( 11,48 килобайт ) Кол-во скачиваний: 63
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 9.7.2023, 22:16
Сообщение #15


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



u should use yellow range in findcolor and condition
Код

if #hp > 3
send F1
end_if
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 9.7.2023, 22:52
Сообщение #16


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



today searching I came across
printscreen #printscreen 0 0 0 0 C:\Users\Marcela\Desktop\picture2.bmp
A solution came to me, could we use this screenshot to extract the data? before looking for the icon, does he take the print, find the icon in the print and analyze the life bar in the print?

set #icon findimage (13, 36 1111, 712 (C:\Users\Marcela\Desktop\icon.bmp) %icon 2 90 1 15)
if #icon > 0
set #x1 %icon[1 1] + 20
set #x2 %icon[1 1] + 25
set #y1 %icon[1 2] - 12
set #y2 %icon[1 2] - 8

move #x1, #y1
get mouse_pos #startx #starty [abs]
move #x2, #y2
get mouse_pos #endx #endy [abs]

set %a GetImage (#startx #starty #endx #endy [abs]) // ????????? ? ?????? ????? ???????? ???????
set $bmp SaveImage (%a [1 1] C:\Users\Marcela\Desktop\picture2.bmp) // ????????? ? ???? ?? ???? C:\


set #hp findcolor (#x1, #y1 #x2, #y2 1 1 (118273 - 973325 ) %ARR 2 80 1 5 )
if_not #hp > 3
send {F1}
end_if
set $b DeleteImage (%a [1 1])
end_if
-----------------------------------------------------------------------------------------------------------------
I am also testing this code, it gives me a getimage of the end of the life bar, and in it I analyze if it still has the green, if it has the green it does not heal, if it does not find the green it will release the healing magic of my ally, but I'm having trouble putting Findcolor to analyze picture2.bmp. Do you know how to use findcolor in this image?


Прикрепленные файлы
Прикрепленный файл  picture2.bmp ( 78 байт ) Кол-во скачиваний: 58
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 9.7.2023, 23:16
Сообщение #17


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28





set #icon findimage (13, 36 1111, 712 (C:\Users\Marcela\Desktop\icon.bmp) %icon 2 90 1 15)
if #icon > 0
set #x1 %icon[1 1] + 20
set #x2 %icon[1 1] + 25
set #y1 %icon[1 2] - 12
set #y2 %icon[1 2] - 8

set #hp findcolor (#x1, #y1 #x2, #y2 1 1 (118273 - 973325 ) %ARR 2 80 1 5 )
if_not #hp > 3
send {F1}
end_if

end_if
-----------------------------------------------------------------------------------------------------------------


this way is efficient, but it would be interesting to put the printscreen #printscreen 0 0 0 0 C:\Users\Marcela\Desktop\picture2.bmp and have it analyze the #printscreen data instead of taking it from the live screen, because as it has fast movements in the game, sometimes it fails, can you help me to put it for him to analyze the print?
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
nykep
сообщение 10.7.2023, 2:36
Сообщение #18


****

Apprentice
Сообщений: 233
Регистрация: 1.9.2012
Группа: Пользователи
Наличность: 1213
Пользователь №: 15.246
Возраст: 25



https://uopilot.uokit.com/wiki/index.php?title=GetImage
Пользователь в онлайне!Delete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения
Matheusochoa
сообщение 11.7.2023, 20:40
Сообщение #19


**

Neophyte
Сообщений: 11
Регистрация: 6.7.2023
Группа: Пользователи
Наличность: 0
Пользователь №: 20.565
Возраст: 28



Цитата
set linedelay 0
:start
set #icon findimage (413, 200 941, 470 (C:\Users\Marcela\Desktop\icon.bmp) %icon 2 90 1 15)
if #icon > 0
set #x1 %icon[1 1] +20
set #x2 %icon[1 1] + 25
set #y1 %icon[1 2] - 12
set #y2 %icon[1 2] - 8

set #hp findcolor (#x1, #y1 #x2, #y2 1 1 ( 118273 - 1039375 ) %ARR 2 80 1 5 )
if_not #hp > 3
send {F1}
wait 200
end_if
end_if
goto start



that way it was good, however as the doll walks fast on the screen when he goes to do the first Icon check he finds, when he goes to look for the life bar he is already in another space, and heals without need.
The current syntax is like this: Search Icon> save coordinates and add coordinates to locate life bar> Finding life bar> Find if green is present in that pixel> If not found Heals, if not found Heals> Loop.
I would like to try to do:
Printscreen > Locate Icon (On printscreen) > Get the coordinates of the icon (On Printscreen) > Locate the life bar (On printscreen) > See if there is green (On printscreen) > Loop.
That way, it wouldn't be a problem for my ally to keep moving, as he would analyze the printscreen (everything would be stable)
Could we do it this way?
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения

Ответить в эту темуОткрыть новую тему
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 

- Текстовая версия | Версия для КПК Сейчас: 27.4.2024, 12:31
Designed by Nickostyle