Posts: 5
Threads: 2
Joined: Mar 2017
Reputation:
0
I'm playing an OT server. The conversation for selecting a task bring up a window to select which creature I want. I need a macro for the bot to select the creature "Cockroaches" and the "Do Task" button. I am not able to just NPCSay it.
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
03-16-2017, 08:25 AM
(This post was last modified: 03-16-2017, 08:31 AM by Catar.)
I think it's possible, but it won't be easy, it would require either using manual macro with
Misc.ClickEx(X, Y) which is basically left click mouse ( here is example of use)
Or Sending arrow Keys and Enter with Tibia.SendKey( VirtualKeyCode)
You would have lent me some account on this OTS logged out already near NPC, so I could do macro for you quick way,
or slower way, by using the remote desktop app on your computer.
Posts: 5
Threads: 2
Joined: Mar 2017
Reputation:
0
03-16-2017, 08:38 AM
(03-16-2017, 08:25 AM)Catar Wrote: You would have lent me some account on this OTS logged out already near NPC, so I could do macro for you quick way
Just sent you a PM my bro. Thanks very much
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
03-16-2017, 08:49 AM
(This post was last modified: 03-16-2017, 10:29 AM by Catar.)
OK FINISHED
REMEMBER TIBIA CAN NOT BE MINMIZED WITH THIS KIND OF MACRO
Tibia.WindowHeight/Width() canot take sizes of window that is minimized to windows bar, so it would maximize it first, which my interupt with your other activities
also Misc.ClickEx(X, Y) need window to NOT be minmized (however it CAN be covered by other windows)
Paste this in macros
[macro]0 {TASKS} Number_on_LIST:=1 {DO NOT TOUCH} loop:=1 tW:=Tibia.WindowWidth() tH:=Tibia.WindowHeight() VarDiv(tW, 2) VarAdd(tW, 213) VarDiv(tH, 2) VarAdd(tH, 122) {TALK} NPC.Say(hi) Macro.Wait(150) NPC.Say(task) {down} !Number_on_LIST!>!loop! [loop] Macro.Wait(150) Tibia.SendKey(40) VarAdd(loop, 1) Macro.Wait(150) Label(down) {loop} Macro.Wait(150) Misc.ClickEx(!tW!, !tH!) exit()[/macro]
And instead of NPC.Say add macro waypoint
like this: Remeber about Fixed point and Delay
Also u can EDIT this variable in macro ( where 0 works also as 1)
Number_on_LIST:=1
To chose WHICH MOSNTER on a list to pick
For example, 8 for Dragons
Posts: 5
Threads: 2
Joined: Mar 2017
Reputation:
0
(03-16-2017, 08:49 AM)Catar Wrote: OK FINISHED
Thanks so much dude, this works perfectly!!!
Thank god for people like you on this thread
+ REP
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
03-16-2017, 10:00 AM
(This post was last modified: 03-16-2017, 10:34 AM by Catar.)
I gotta say, I LOVE this kind of challenges.
EXPLANATION HOW ITS DONE
Since SendKey enter wouldn't start task, i had to use Mouse Click,
But to do so, I had do know position of Do Task button.
So I had to find fixed position of that button, on ANY TIBIA WINDOW SIZE,
Had to collect some data of button position in different size of windows
distance from center of screen to button
Code: W ~41 AVG = 213
851-638 = 213
748-540 = 208
1465-1248 = 217
515-301 = 214
H ~19 AVG =122
829-719 = 110
829-704 = 125
645-518 = 127
444-320 = 124
Knowing that I could make commands sequence to calculate position of button on any window size
Code: tW:=Tibia.WindowWidth()
tH:=Tibia.WindowHeight()
VarDiv(tW, 2)
VarAdd(tW, 213)
VarDiv(tH, 2)
VarAdd(tH, 122)
rest was easy
Posts: 5
Threads: 2
Joined: Mar 2017
Reputation:
0
(03-16-2017, 10:00 AM)Catar Wrote: = 110
829-704 = 125
645-518 = 127
444-320 = 124[/code]
Knowing that I could make commands sequence to calculate position of button on any window size
Hi mate, the macro is no longer working.
i've followed it to the tee with waypoints and delays. But whenever it begins to run the macro on cavebot it walks down 4 blocks to NPCsay then walks back up.
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
03-18-2017, 01:06 AM
(This post was last modified: 03-18-2017, 01:17 AM by Catar.)
send me that script you made on PW.
btw tried that again, and it still works for me, without issue (even with over 240ms latency to the server)
What tibia window size u have? make SS
(its 1 am atm where i live, going to sleep now)
|