Random Click Within Needle Image?
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
Random Click Within Needle Image?
Hello. I have a few questions actually. I am making a macro for runescape.
The first question: I want the macro to click in a random spot within the needle image. For example, in runescape I want it to click an item, it will click the center of it, but I want it to click in a random point within that item.
Second: I want the macro to click an item. Every item has a light brownish border with the image inside (noted items). The item can be anything the user chooses but I want to use one image to classify all of them. Do I have to change the tolerance or something for it to be able to click any item?
Lastly, I would like it to have an anti-ban system. For example, I want it to do something randomly at any given time. So, it should pause what it's doing, click on something or type something, then resume what it was doing.
Thanks!
MY CODE:
// COMPILE_OPTS|C:\Documents and Settings\mokshal\My Documents\AutoAlcher.exe|C:\Documents and Settings\mokshal\My Documents\high alch.ico|CONSOLE=0|INCLUDES=1|
//By Mokey. This script is copyrighted and is only available through purchase from Mokey. Email: [email protected]
//Starting Message
Message>The Bot Is Starting. Press Shift+Esc to exit. It is best to start at you're player owned house. Press OK To Continue. By Mokey!
Wait>10
//User & Pass Request
Input>user,Type You're User Name Please,
Input>pass,Type You're Password Please,
Wait> 3
//Open Runescape In Default Browser
ExecuteFile>http://www.runescape.com/game.ws?j=1
//Wait until the login button is seen (Done Loading)
WaitScreenImage>C:\Documents and Settings\mokshal\My Documents\LogIn.bmp,0
//Find Position of the Login Button 1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\LogIn.bmp,SCREEN,0,1,X,Y,LogIn
//Find location of the click here to play button
FindImagePos>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,SCREEN,0,1,X,Y,play
//Log into runescape if not already logged in
if>LogIn>0
MouseMove>X_0,Y_0
LClick
Wait>2
SendText>user
Wait>2
Press Tab
Wait>2
SendText>pass
Wait>2
Press Enter
WaitScreenImage>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,0
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,SCREEN,0,1,X,Y,play
MouseMove>X_0,Y_0
Wait>0.5
LCLick
Endif
Wait>10
//Find The Spell Book And Click It
FindImagePos>C:\Documents and Settings\mokshal\My Documents\Spellbook.bmp,SCREEN,0,1,X,Y,Spell
MouseMove>X_0,Y_0
Wait>1
LCLick
Wait>2
//Begin Alching
Repeat>Alch
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\Alch.bmp,SCREEN,0,1,X,Y,alch
MouseMove>X_0,Y_0
Wait>1
LClick
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\noted.bmp,SCREEN,0,1,X,Y,Note
MouseMove>X_0,Y_0
LClick
Wait>0.5
//Check If Logged out
FindImagePos>C:\Documents and Settings\mokshal\My Documents\LogIn.bmp,SCREEN,0,1,X,Y,LogIn
//Click the "Click Here To Play" if connection resetted
if>play>0
MouseMove>X_0,Y_0
Wait>0.5
LCLick
Endif
//Login of logged out
if>LogIn>0
MouseMove>X_0,Y_0
LClick
Wait>2
SendText>user
Wait>2
Press Tab
Wait>2
SendText>pass
Wait>2
Press Enter
WaitScreenImage>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,0
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,SCREEN,0,1,X,Y,play
MouseMove>X_0,Y_0
Wait>0.5
LCLick
Endif
Until>Alch
The first question: I want the macro to click in a random spot within the needle image. For example, in runescape I want it to click an item, it will click the center of it, but I want it to click in a random point within that item.
Second: I want the macro to click an item. Every item has a light brownish border with the image inside (noted items). The item can be anything the user chooses but I want to use one image to classify all of them. Do I have to change the tolerance or something for it to be able to click any item?
Lastly, I would like it to have an anti-ban system. For example, I want it to do something randomly at any given time. So, it should pause what it's doing, click on something or type something, then resume what it was doing.
Thanks!
MY CODE:
// COMPILE_OPTS|C:\Documents and Settings\mokshal\My Documents\AutoAlcher.exe|C:\Documents and Settings\mokshal\My Documents\high alch.ico|CONSOLE=0|INCLUDES=1|
//By Mokey. This script is copyrighted and is only available through purchase from Mokey. Email: [email protected]
//Starting Message
Message>The Bot Is Starting. Press Shift+Esc to exit. It is best to start at you're player owned house. Press OK To Continue. By Mokey!
Wait>10
//User & Pass Request
Input>user,Type You're User Name Please,
Input>pass,Type You're Password Please,
Wait> 3
//Open Runescape In Default Browser
ExecuteFile>http://www.runescape.com/game.ws?j=1
//Wait until the login button is seen (Done Loading)
WaitScreenImage>C:\Documents and Settings\mokshal\My Documents\LogIn.bmp,0
//Find Position of the Login Button 1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\LogIn.bmp,SCREEN,0,1,X,Y,LogIn
//Find location of the click here to play button
FindImagePos>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,SCREEN,0,1,X,Y,play
//Log into runescape if not already logged in
if>LogIn>0
MouseMove>X_0,Y_0
LClick
Wait>2
SendText>user
Wait>2
Press Tab
Wait>2
SendText>pass
Wait>2
Press Enter
WaitScreenImage>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,0
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,SCREEN,0,1,X,Y,play
MouseMove>X_0,Y_0
Wait>0.5
LCLick
Endif
Wait>10
//Find The Spell Book And Click It
FindImagePos>C:\Documents and Settings\mokshal\My Documents\Spellbook.bmp,SCREEN,0,1,X,Y,Spell
MouseMove>X_0,Y_0
Wait>1
LCLick
Wait>2
//Begin Alching
Repeat>Alch
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\Alch.bmp,SCREEN,0,1,X,Y,alch
MouseMove>X_0,Y_0
Wait>1
LClick
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\noted.bmp,SCREEN,0,1,X,Y,Note
MouseMove>X_0,Y_0
LClick
Wait>0.5
//Check If Logged out
FindImagePos>C:\Documents and Settings\mokshal\My Documents\LogIn.bmp,SCREEN,0,1,X,Y,LogIn
//Click the "Click Here To Play" if connection resetted
if>play>0
MouseMove>X_0,Y_0
Wait>0.5
LCLick
Endif
//Login of logged out
if>LogIn>0
MouseMove>X_0,Y_0
LClick
Wait>2
SendText>user
Wait>2
Press Tab
Wait>2
SendText>pass
Wait>2
Press Enter
WaitScreenImage>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,0
Wait>1
FindImagePos>C:\Documents and Settings\mokshal\My Documents\click2play.bmp,SCREEN,0,1,X,Y,play
MouseMove>X_0,Y_0
Wait>0.5
LCLick
Endif
Until>Alch
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
First: FindImagePos can return top left or center. You know the dimensions of the needle since you capture it. So return top left and then use the Random function to return a value between 0 and the width/height of the image to get a random value within the image. Do this for both dimensions.
Second: Not entirely sure I follow, but if the image changes significantly then you probably need to capture each one. If the border is the same you could maybe scan for a portion of the border and then loop through all found and apply an offset for the inner image.
Lastly: Probably best to use a second macro running continuously to do the random thing.
Second: Not entirely sure I follow, but if the image changes significantly then you probably need to capture each one. If the border is the same you could maybe scan for a portion of the border and then loop through all found and apply an offset for the inner image.
Lastly: Probably best to use a second macro running continuously to do the random thing.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
Sorry To Bother
Sorry to bother you, im a noob. Could you please show an example for the random click?
Example please? I don't know how to offset. I got the border image in findIMagePos but how can I offset?
How would I code the second macro to randomly do things overtime while not coming in the way of the other one?
thanks!
Mokshal1663
Example please? I don't know how to offset. I got the border image in findIMagePos but how can I offset?
How would I code the second macro to randomly do things overtime while not coming in the way of the other one?
thanks!
Mokshal1663
Here are a couple of examples of offsets.
MacroScheduler has a command called Random that will let you generate a random number. I think I would have a 2nd macro generate an event in the background, maybe by creating or deleting a flag file. This could trigger an OnEvent in the main macro to do your random thing. Read up on OnEvent and try adding it to your script.
Gale
Code: Select all
//Using simple expressions
Let>xwithoffset=%X_0%-5
MouseMove>xwithoffset,y_0
//Using complex expression
MouseMove>{%X_0%-5},{%Y_0%}
Gale
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
Not Working
The code isn't working. I mean it moves the mouse to the image, but every time I test it, it goes to the same location. Is it possible to create a random offset? Thanks!
Here is how to use random:
Gale
Code: Select all
//Let's say you want an offset between -5 and 5
//Produce one of 11 random numbers between 0 and 10 inclusively
Random>11,PositiveOffset
//Convert that to between -5 and 5
Let>Offset=PositiveOffset-5
Message>Offset: %offset%
Last edited by gdyvig on Tue Mar 02, 2010 3:10 pm, edited 1 time in total.
im sorry but i refuse to help anyone not giving me credit for my work and using one of my scripts your a jerk taking credit for my old scripts is not cool maybe if you actually made it and not just added your name to it you might know how to do something as simple as random or might even know how to open the help file to see it tells you there i hope you get banned omfg your selling it to !!!!!! your scum your pathetic get a life and learn how to make your own scripts you loser!!!selling my work i hope you choke !!!
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
-
- Newbie
- Posts: 18
- Joined: Thu Mar 25, 2010 11:00 am
- Location: Vancouver
I don't mean to jump in or pick sides on this but I must add this.idiot wrote:im sorry but i refuse to help anyone not giving me credit for my work and using one of my scripts your a jerk taking credit for my old scripts is not cool maybe if you actually made it and not just added your name to it you might know how to do something as simple as random or might even know how to open the help file to see it tells you there i hope you get banned omfg your selling it to !!!!!! your scum your pathetic get a life and learn how to make your own scripts you loser!!!selling my work i hope you choke !!!
Before you or anyone accuses someone of stealing a script or anything that one has created you must provide proof. With no valid proof and only calling someone a jerk and other rude comments makes you look like nothing than another troll on the internet.
After looking over his script in the first post, I simply say this is a VERY basic script with very little to make it unique to any single person. If I was making a script to automatically launch a game, log in and then start a "bot" and reconnect when disconnected from the server I would create a nearly identical script without even knowing this one existed.
The script itself is also rather messy I'd assume its an early beta just for proof of concept seeing as hes using direct paths instead of importing/exporting the files to %Temp_Dir% or %Script_Dir% or where ever he wanted them because as you said hes trying to sell this, which would be impossible since not everyone has those exact file paths, let alone the files.
But never the less I just look at your name and I understand your unjust and irrational jumps to conclusions without having any proof.
On a side note,
Why must people even bother creating things like this, assuming this is to have "bot" play and train your characters using hacks or other third party applications in a ~GAME~ which is meant to be played for fun....
When it reaches a point where the term "playing a game" doesn't even require the player to sit in front of the computer and do some hands on playing for enjoyment of the game itself or as a pass time. I think its time to find something new to do with your time.
And don't say you want to have a strong character without spending time to make it that's is just lazy. It would be like making a script to watch tv for you, create a log file, and then that told you what you missed and what was on while you were away.... If you're not going to be there enjoying it first hand then turn it off.
As a gamer myself, although I've never played Runescape I know one thing. There is no glory, pride, or respect when let a program cheat your way to the top.
yes it was a beta and yes i make much better stuff now then this program i gave him this program it has to do with the fact he taking credit for work wich wasnt his and yeah my work is sloppy but it works
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!