Sign in to follow this  
Followers 0
mutalisk46802

Click "reuse" how?

9 posts in this topic

In a game called "Tibia" (The title window is called "Tibia" also) if you hold CTRL and click on like a rune, the cursor changes and then you have to click (holding CTRL still doesnt affect anything right now) on waht you want to use that rune on, and after you click even if it was a succesful hit or miss, the cursor changes back to normal, so you have to hold CTRL, click the object (a rune in this case) then click the target (you can hold CTRL through the whole process). What I want to accomplish is to make it so if you hold CTRL, click on something, then click on the target (anywhere on the screen) the cursor does not go back to normal, it stays changed so you only have to do the first click one time. But I also want it so if you right click on your mouse, the cursor goes back to normal so its not stuck changed forever. I hope I explained it good enough but if I didnt then please ask because I really need help coding this.

P.S. I only got autoit about a couple days ago and have only made one other program using it which I recieved much help from people on this forum so thats why I might seem terrible at coding :">

Share this post


Link to post
Share on other sites



Send("{CTRL DOWN}") ?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Well making it hold CTRL down wouldnt help much because basically what I do right now is hold CTRL down myself, click the first object (a rune) then while still holding CTRL click the target, but after clicking the target the cursor changes back so that you have to click the object (still a rune) and click the target and you have to do that over and over, I want it so that the cursor doesnt change back to normal, you hold CTRL and click the object, then click the target and what im trying to do is make it so you can just click the target again right after clicking the target. Is that confusing :D

Share this post


Link to post
Share on other sites

No one knows how to code this? :D

Share this post


Link to post
Share on other sites

Ok let me attempt to explain it better.

Note that all the "clicks" im talking about are ALL left clicks, except if i say its a right click.

A "rune" is basically an item in your backpack that if you hold down CTRL and click on the slot (a box) that it is in, then your cursor will change from normal to a different looking cursor (4 arrows pointing in to a center point). Now that the different cursor is there, you have to click on your target which could be an enemy in the battle list window or if you accidently held CTRL and clicked a rune and you dont want to use it, you can click anywhere on the screen taht a person or a monster is not there and the rune will not shoot since it has no target and your cursor will change back to normal. If you do click on a monster/person or a monster in the battlelist, then the rune will shoot and the cursor will change back to normal. Now if you want to shoot the rune again, then you must do the process once again by holding CTRL, clicking on the rune then clicking somewhere. Most of the time when I am trying to kill a monster, I have to hold CTRL the whole time and keep clicking the rune, then the monster in the battlelist, then the rune, then the monster in the battlelist, then the rune and etc. But what I want to do is make it so that first off you hold CTRL and click on the rune. Then of course you click on the monster in the battlelist BUT with the program im trying to make, after you shoot the rune at the monster from the battlelist, the cursor DOESNT change back to normal so you can just click on the monster on the battlelist, click again, click again, and you never have to go over and hold CTRL and click on the rune. BUT also I want it so that when you right click, the cursor DOES go back to normal so that the cursor isnt indefinetly stuck so that whenever you click you shoot a rune.

I hope that clears any questions up, please help me out with this because the only way I can think of how to do this is to make a script where "it" holds CTRL down and then clicks on the spot where the rune is then returns the cursor to the position it was at before but there are many problems with this like, what if the rune was in a different place, then it would just not work and how would it know when to click on the rune and I bet there would be many other problems with this. SORRY FOR THE LONG POST BUT I HAD TO EXPLAIN WHAT IM TALKING ABOUT :">

Share this post


Link to post
Share on other sites

You need to attempt something (for real) on your own, then post for help. What your saying is what you want with no attempt on your own (to show for anyway).

Here are some things you might want to look at:

MouseClick()

Send('{CTRL DOWN}')

MouseGetPos()

MouseGetCursor() (I believe this one is in Beta: http://www.autoitscript.com/forum/index.php?showtopic=23823 )

PixelSearch()/PixelGetColor()/PixelCheckSum()

Opt('MouseCoordMode', 2)

Opt('PixelCoordMode', 2)

If you feel these things are difficult to understand then you should start here: http://www.autoitscript.com/forum/index.php?showtopic=21048

Good Luck.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Ok I made the code and here is what it is supposed to do.

NUMPAD1- Holds down CTRL, clicks on the rune, lets go of CTRL, then moves cursor to the top monster on the battlelist.

NUMPAD2- Same thing as NUMPAD1 except moves the cursor to the second monster on the battlelist.

NUMPAD4- Same thing as NUMPAD1 except clicks the top monster on the battlelist.

NUMPAD5- Same thing as NUMPAD2 except clicks the second monster on the battlelist.

NUMPAD9- Exits the script

When I ran Tibia, logged on, then ran the script first off the msgbox took a while to load up (Tibia lags your computer when its running) then the hotkeys just entered the number, when I turned Num Lock off, it just moved my character like its supposed to like hitting 1 moved my character diagnol southwest. Even when I hit numpad9 nothing happened. Now that I have attempted a script could I get some help :D

The location of the rune is 873,533

The location of the top monster on the battlelist is 860,460

The location of the second monster on the battleist is 860, 480

And heres the code:

MsgBox(0, "Rune Shooter", "Just click OK...")
HotKeySet("{numpad1}", "capturenumpad1")
Func capturenumpad1()
    Send("{CTRLDOWN}")
    MouseClick("left", 873, 533, 1, 0)
    Send("{CTRLUP}")
    MouseMove(860, 460, 0)
    HotKeySet("{numpad1}")
    Send("{numpad1}")
    HotKeySet("{numpad1}", "capturenumpad1")
EndFunc
HotKeySet("{numpad2}", "capturenumpad2")
Func capturenumpad2()
    Send("{CTRLDOWN}")
    MouseClick("left", 873, 533, 1, 0)
    Send("{CTRLUP}")
    MouseMove(860, 480, 0)
    HotKeySet("{numpad2}")
    Send("{numpad2}")
    HotKeySet("{numpad2}", "capturenumpad2")
EndFunc
HotKeySet("{numpad4}", "capturenumpad4")
Func capturenumpad4()
    Send("{CTRLDOWN}")
    MouseClick("left", 873, 533, 1, 0)
    Send("{CTRLUP}")
    MouseClick("left", 860, 460, 1, 0)
    HotKeySet("{numpad4}")
    Send("{numpad4}")
    HotKeySet("{numpad4}", "capturenumpad4")
EndFunc
HotKeySet("{numpad5}", "capturenumpad5")
Func capturenumpad5()
    Send("{CTRLDOWN}")
    MouseClick("left", 873, 533, 1, 0)
    Send("{CTRLUP}")
    MouseClick("left", 860, 480, 1, 0)
    HotKeySet("{numpad5}")
    Send("{numpad5}")
    HotKeySet("{numpad5}", "capturenumpad5")
EndFunc
HotKeySet("{numpad9}", "capturenumpad9")
Func capturenumpad9()
    Exit
    HotKeySet("{numpad9}")
    Send("{numpad9}")
    HotKeySet("{numpad9}", "capturenumpad9")
EndFunc

Share this post


Link to post
Share on other sites

I remember my first program I made that people helped me with had the same problem about something with when I ran it, the program just closed. I could do a Sleep(5000) but then it would just stay up for 5 seconds doing nothing then close. I dont think this is the only problem with my script but could someone help me to get it not to close itself? Also is there any better way to do what I'm trying to do because right now if I got the script to work, only I could use it because it clicks on a certain spot and other people might have their runes in another spot and you have to press a hotkey, its not automatic.

Share this post


Link to post
Share on other sites

Put a

While 1
    Sleep(1000)
WEnd
At the top of your script. (That's a loop, that keeps your script running... )

But be sure all your HotKeySet()'s are above that While 1


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0