07-26-2020, 12:29 PM
(This post was last modified: 07-26-2020, 01:41 PM by Remotehorst23.)
Thanks! Now i understand a bit better.
In function 1, 2 and 3 i have some image scans and if then else going on. The thing is, that these are acutally macros but i want to clean it up because its getting more and more complicated. So i need to make them functions, called from a main macro (not only from hotkeys because i want more ways to trigger a function).
One of these macros is looking like that:
[/code]
This macro searches for plants to collect and if the player gets into a fight (turn based), it switches to the "kampfvorbereitung" (fightpreparation) mode. Because there are many different plants, i would need to copy the code to the other macros wich makes no sense if i can also use functions. I guess that would be more clean and better to work with.
I need to make this Macro a function, calling other functions (for battle mode). And then i have like 5 other macros like that, doing (almost) the same thing who collect other plants and also need to be able to detect if the player gets into a battle. I need to clean them up too.
The idea with the hotkey triggers is good to know, but i want to have it in the main macro (my first post pseudo code) because when i have everything working, i want to be able to also remote control my game from a telegram chat when im not at home. (Does this mean i should trigger functions by hotkeys and by reading telegram chat who both change the same variables?)
I think i can read the Telegramchat with a telegram bot, but it would be cool if QM can handle that too. I already tried, but had no good results until now. Please see this thread for Telegram script (scanning for images too xD) https://www.quickmacros.com/forum/showth...p?tid=6963
Actually all my code is a mess like the one i posted right now and every macro has a few little bugs or missing code. But the main question that arises is, how should i create the structure of the main macro to have everything clean and working? Overall i think i need to scan for at least 3-5 different images at the same time and i want to prevent scanning for images too much. Would be great if there is a better solution for my telegram macro. Ingame there is no other way than scanning for images wich is ok.
Thanks very much for your help!
In function 1, 2 and 3 i have some image scans and if then else going on. The thing is, that these are acutally macros but i want to clean it up because its getting more and more complicated. So i need to make them functions, called from a main macro (not only from hotkeys because i want more ways to trigger a function).
One of these macros is looking like that:
Macro [b]KleeSammler[/b] [help1][/help1]
[code];start
out "Re/Start"
ifk(F12) end ;;end if F12 is pressed
,out "User stopped"
if(scan("resource:Gruppe_beitreten_Nein.bmp" 0 0 1|16 30))
,wait 0.2
,lef
,goto start
else
,goto start2
;start2
wait 0.5
if(scan("resource:bereit.bmp" 0 0 1|16 20))
,goto kampfvorbereitung
else
,goto weiter
;weiter
if(scan("resource:ok.bmp" 0 0 1|16 20))
,wait 0.5
,out "levelup"
,lef
,goto sammeln
else
,;sammeln
,out "scanning"
,if(scan("resource:klee_2.bmp" 0 0 1|16 42))
,,OnScreenDisplay "Klee sammeln 1" 1
,,out "Klee Sammeln 1"
,,wait 0.5
,,lef
,,wait 0.5
,,if(scan("resource:pflueck.bmp" 0 0 1|16 50))
,,,wait 0.5
,,,out "pfluecken"
,,,lef
,,,wait 8
,,,goto start
,,else
,,,goto start
,else
,,out "kein klee gefunden"
,,goto start
;kampfvorbereitung
wait 0.2
if(scan("resource:Kampfmodus_Sperren.bmp" 0 0 1|16 40))
,out "Kampf gesperrt"
,wait 0.2
,lef
,goto vor2
else
,;vor2
,if(scan("resource:Kampfmodus_zuschauer.bmp" 0 0 1|16 30))
,,out "Zuschauen verboten"
,,wait 0.1
,,lef
,,goto vor3
,else
,,;vor3
,,if(scan("resource:Kampfmodus_map.bmp" 0 0 1|16 30))
,,,out "Kampfmodus Map"
,,,wait 0.1
,,,lef
,,,goto ready
,,else
,,,;ready
,,,if(scan("resource:bereit.bmp" 0 0 1|16 20))
,,,,out "Kampf Start: Bereit"
,,,,wait 0.2
,,,,lef
,,,,goto infight
;infight
out "start infight"
wait 0.5
if(scan("resource:KampfAmZug.bmp" 0 0 1|16 30))
,out "Am Zug!"
,wait 0.2
,if(scan("resource:Zielsuchzeiger.bmp" 0 0 1|16 30))
,,out "Zielsuchzeiger"
,,lef
,,wait 0.5
,,if(scan("resource:ZielsuchzeigerSetzen2.bmp" 0 0 1|16 20))
,,,wait 0.2
,,,lef
,,,wait 0.2
,,,out "Zeiger gesetzt"
,,,mou
,,,goto rundenende
,,else
,,,out "Kann Zielsuchzeiger nicht setzen"
,,,if(scan("resource:ZielsuchzeigerSetzenNacht.bmp" 0 0 1|16 30))
,,,,wait 0.2
,,,,lef
,,,,wait 0.2
,,,,out "Zeiger gesetzt"
,,,,mou
,,,,goto rundenende
,,,else
,,,,if(scan("resource:a_zeiger.bmp" 0 0 1|16 40))
,,,,,out "Normaler Zeigerangriff"
,,,,,wait 0.2
,,,,,lef
,,,,,wait 0.2
,,,,,if(scan("resource:ALLEgegnerAngreifenImKampf.bmp" 0 0 1|16 5))
,,,,,,out "Gegner gefunden"
,,,,,,wait 0.2
,,,,,,lef
,,,,,,wait 0.5
,,,,,,goto rundenende
,,,,else
,,,,,out "Kein Gegner auswählbar"
,,,,,;rundenende
,,,,,wait 2.5
,,,,,if(scan("resource:rundenende.bmp" 0 0 1|16 50))
,,,,,,out "Runde beenden"
,,,,,,lef
,,,,,,wait 1
,,,,,,if(scan("resource:kampfende.bmp" 0 0 1|16 40))
,,,,,,,wait 0.2
,,,,,,,lef
,,,,,,,out "kampf beendet - Zutatensuche fortsetzen"
,,,,,,,goto start
,,,,,,else
,,,,,,,goto infight
,,,,,else
,,,,,,out "Kann Runde nicht beenden - Zweiter versuch"
,,,,,,wait 0.5
,,,,,,if(scan("resource:rundenende.bmp" 0 0 1|16 60))
,,,,,,,out "Runde beenden"
,,,,,,,lef
,,,,,,,goto infight
,,,,,,else
,,,,,,,out "Kampf anscheinend beendet"
,,,,,,,goto kampfende
else
,wait 2
,if(scan("resource:kampfende.bmp" 0 0 1|16 60))
,,wait 0.2
,,lef
,,out "kampf beendet - Zutatensuche fortsetzen"
,,goto start
,else
,,if(scan("resource:kampfende.bmp" 0 0 1|16 70))
,,,wait 0.2
,,,lef
,,,out "kampf beendet - Zutatensuche fortsetzen"
,,,goto start
,,goto infight
;kampfende
wait 1
if(scan("resource:kampfende.bmp" 0 0 1|16 60))
,wait 0.2
,lef
,out "kampf beendet - Zutatensuche fortsetzen"
,goto start
else
,out "Kampf anscheinend nicht beendet - Kampf fortsetzen"
,goto infight
This macro searches for plants to collect and if the player gets into a fight (turn based), it switches to the "kampfvorbereitung" (fightpreparation) mode. Because there are many different plants, i would need to copy the code to the other macros wich makes no sense if i can also use functions. I guess that would be more clean and better to work with.
I need to make this Macro a function, calling other functions (for battle mode). And then i have like 5 other macros like that, doing (almost) the same thing who collect other plants and also need to be able to detect if the player gets into a battle. I need to clean them up too.
The idea with the hotkey triggers is good to know, but i want to have it in the main macro (my first post pseudo code) because when i have everything working, i want to be able to also remote control my game from a telegram chat when im not at home. (Does this mean i should trigger functions by hotkeys and by reading telegram chat who both change the same variables?)
I think i can read the Telegramchat with a telegram bot, but it would be cool if QM can handle that too. I already tried, but had no good results until now. Please see this thread for Telegram script (scanning for images too xD) https://www.quickmacros.com/forum/showth...p?tid=6963
Actually all my code is a mess like the one i posted right now and every macro has a few little bugs or missing code. But the main question that arises is, how should i create the structure of the main macro to have everything clean and working? Overall i think i need to scan for at least 3-5 different images at the same time and i want to prevent scanning for images too much. Would be great if there is a better solution for my telegram macro. Ingame there is no other way than scanning for images wich is ok.
Thanks very much for your help!