Random Stuff Forums
 

Go Back   Random Stuff Forums > RSF Exclusive Content > User Knowledgebase and Help > Computing

Computing Discuss anything related to computing here, such as hardware and technical problems.

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 25-10-2007, 12:15 AM
Woody's Avatar
Woody (Offline)
Hmmmm
 
Join Date: Feb 2007
Location: Virginia
Posts: 1,609
Woody is an unknown quantity at this point
Default JMacro Script Help

JMacro Script Help
By Woody

Table of Contents
  • 1.0 Introduction
  • 2.0 Creating Scripts
    • 2.01 FindColor
    • 2.02 LeftClick/RightClick
    • 2.03 LeftDown
    • 2.04 LeftUp
    • 2.05 RightDown
    • 2.06 RightUp
    • 2.07 MoveMouse
    • 2.08 Pause
    • 2.09 Print
    • 2.10 SendKey
    • 2.11 FindEnt
  • 3.0 Compiling Scripts
    • 3.1 Error Messages
  • 4.0 Running Scripts
  • 5.0 How to find RGB
    • 5.1 Paint
    • 5.2 Photoshop


1.0 Introduction
Welcome, Im making this guide in the hopes that this will be the first version of what may become the documentation for Speedsters JMacro bot. Also this might help the tons of messages he gets from people needing help. I also dont expect people to read this linearly. So without further ado let the guide begin.


2.0 Creating Scripts
The Creation of a script is somewhat simple but if you don't do it right your scripts wont work.

First Open up Notepad
Then go to File > Save As

Find the scripts directory of Jmacro. Save the file with your script name and a ".java" after it. Make sure that you select "all files" under the file type option.


Now to start your script. There are 3 lines that it must contain for it to work properly.

1. package scripts;
Before importing any .class functions you must tell the script to include them with this line.

2. public class ScriptName {
This is the start of your script and is very important. The "ScriptName" part of the line must be exactly the same as your filename in order for the script to compile correctly.

3. public static void jbot() {
Place this right under the public class line. It merely tells the program that this is to be run by JMacro.


Now to add Functions to your script.


2.01 FindColor
import static com.vibesoft.bots.findcolor.findcolor;
Add this function by placing the above line after the package scripts line.

Function Syntax: findcolor(R,G,B,R Tolerance,G Tolerance, B Tolerance,Case);

How it works:
This searches for an RGB color within the R,G or Btolerance (+ or -) and which pixel (in the even their are more than one of the same pixel) to choose in order from left to right and down. Default tolerance for a script is 1, it must be one or more always.

2.02 LeftClick/RightClick
import static com.vibesoft.bots.leftclick.leftclick;
import static com.vibesoft.bots.rightclick.rightclick;
Add this function by placing the above line after the package scripts line.

Function Syntax: rightclick();


How it works:
This right clicks the mouse at the position it is over.


Function Syntax: leftclick();


How it works:
This left clicks the mouse at the position it is over.

2.03 LeftDown
import static com.vibesoft.bots.leftdown.leftdown;
Add this function by placing the above line after the package scripts line.

Function Syntax: leftdown();


How it works:
Holds the left mouse button down.

2.04 LeftUp
import static com.vibesoft.bots.leftup.leftup;
Add this function by placing the above line after the package scripts line.

Function Syntax: leftup();


How it works:
Releases the left mouse button.

2.05 RightDown
import static com.vibesoft.bots.rightdown.rightdown;
Add this function by placing the above line after the package scripts line.

Function Syntax: rightdown();


How it works:
Holds down the right mouse button.

2.06 RightUp
import static com.vibesoft.bots.rightup.rightup;
Add this function by placing the above line after the package scripts line.

Function Syntax: rightup();


How it works:
Releases the right mouse button.

2.07 MoveMouse
import static com.vibesoft.bots.movemouse.movemouse;
Add this function by placing the above line after the package scripts line.

Function Syntax: movemouse(x,y);


How it works:
This moves the mouse to the specified X,Y position on the screen.

2.08 Pause
import static com.vibesoft.bots.pause.pause;
Add this function by placing the above line after the package scripts line.

Function Syntax: pause(ms);


How it works:
Pauses the script for the specified period of time in milliseconds.

2.09 Print
import static com.vibesoft.bots.print.print;
Add this function by placing the above line after the package scripts line.

Function Syntax: print("String of text");


How it works:
Print's the specified string of text to the "black box" or "JVM" or "log"

2.10 SendKey
import static com.vibesoft.bots.sendkey.sendkey;
Add this function by placing the above line after the package scripts line.

Function Syntax: sendkey("");


How it works:
This sends A SINGAL KEY to the board.
Also includes:
ENTER
SHIFT


2.11 FindEnt
import static com.vibesoft.bots.findent.findent;
Add this function by placing the above line after the package scripts line.

Function Syntax: findent();


How it works:
Returns a boolean, (true or false), of whether or not a tree entity is under the mouse cursor. (85% accuracy rate)

3.0 Compiling Scripts
Once you have created your script then you are read to compile it into the class file that JMacro uses.

Return to the origin folder and find the files named "Compile-JDK 6, Up 3" and "Compile-JDK 6, Up 2."

First open the "Compile-JDK 6, Up 3" file. Some text should come up and after a bit of time it should look like this.

If you see that the congratulation's you have created your brand new script for JMacro. If you get something else read on.

If you get this error message then use the "Compile-JDK 6, Up 2" program.


If you are getting another error message then look at section 3.1 for more help.

3.1 Error Messages
This is not meant to be all inclusive but I will add to it as people report errors and Speedster or other smart people answer them.

class **** is public, should be declared in a public class

This is caused because your file name does not match the name in the "public class" line. Ensure that both of these are the same and remember it's case sensitive.

";" expected

Just add a semi-colon at the end of the line mentioned.

cannot find symbol
symbol : variable


This is because you forgot to add parentheses to the sendkey command.

cannot find symbol
symbol : method sendkey(java.lang.string)


This is because you forgot to add the class include for sendkey at the beginning of the script.

cannot find symbol
symbol : method findcolor(int,int,...)


This is because you forgot to add the class include for findcolor at the beginning of the script.

4.0 Running Scripts
Really basic and im fealing lazy atm but I'll add something to this tomorrow.

5.0 How to find RGB
Since I have seen people wondering how you find the RGB color of an object I'm adding this. Speedster says he will be adding a script to JMacro that will tell you what the RGB of something is in the near future.

5.1 Paint
Everyone with a PC has this program(hopefully) so this is the fastest way to get a colors RGB

To find out RGB color value, use Paint program included into standard Windows package.

* Launch Paint; open an image containing the needed color
* Go to Instruments panel; select Picker instrument
* Click the needed color to select it. This color will appear in the palette as brush color
* In the "Colors" section of the main menu, select "Edit Colors" menu item
* Press "Define custom colors" button. The window will expand to present the color you have selected as well as its RGB numeric values for every channel.

Images Soon


5.2 Photoshop
If you have photoshop this method is handy since you can quickly change colors unlike in paint.

Simply open the image your trying to get the RGB of.

Use the color picker tool and the exact RGB should appear in the color tab of the toolbar.

Images Soon
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

I heart my weighted companion cube.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
And then jesus said "Let there be Asterisks!"
Reply With Quote
  #2  
Old 25-10-2007, 12:17 AM
Speedster239's Avatar
Speedster239 (Offline)
Active Member
 
Join Date: Jul 2007
Location: The Internet
Posts: 271
Speedster239 is an unknown quantity at this point
Default

This is reall amazing! You have no idea how much I appreciate the hardwork you put into creating this resource. <3
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

My goal ^
Reached on Sunday, November 11th, 2007. Next skill to max out: Magic - 13.04 or 200mil fletch xp

I program PHP, Java and Vb.

MSN:
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Reply With Quote
  #3  
Old 25-10-2007, 12:24 AM
Alex's Avatar
Alex (Offline)
Active Member
 
Join Date: Jan 2007
Posts: 1,042
Alex is an unknown quantity at this point
Default

thanks but speedy kind already went over all this in his posts, anyway +rep
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


GT: Alex5666

I've dropped over 18m total for rsf and sythe and donated
over 20m
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
.

I DO NOT play rs.

98% of teens surrond their minds with rap, GET OVER IT!:straightface:


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Since im recognized as hte best ruenscape player at my school
Reply With Quote
  #4  
Old 25-10-2007, 12:45 AM
Woody's Avatar
Woody (Offline)
Hmmmm
 
Join Date: Feb 2007
Location: Virginia
Posts: 1,609
Woody is an unknown quantity at this point
Default

ya I know a lot of this is just repeating what he said but this way he can keep the size of update posts down by just linking to this.

anyways im going to rework some of it and add some more tomorrow i just need my sleep and wanted to post it.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

I heart my weighted companion cube.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
And then jesus said "Let there be Asterisks!"
Reply With Quote
  #5  
Old 25-10-2007, 05:25 PM
Speedster239's Avatar
Speedster239 (Offline)
Active Member
 
Join Date: Jul 2007
Location: The Internet
Posts: 271
Speedster239 is an unknown quantity at this point
Default

Nah, Zeta. This is definetley more in depth and it's a great resource :P
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

My goal ^
Reached on Sunday, November 11th, 2007. Next skill to max out: Magic - 13.04 or 200mil fletch xp

I program PHP, Java and Vb.

MSN:
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Reply With Quote
  #6  
Old 25-10-2007, 05:36 PM
M.D. Alemi's Avatar
M.D. Alemi (Offline)
AKA loadingNOW
 
Join Date: Feb 2007
Location: On a mission to kill Louis.
Posts: 2,665
M.D. Alemi is an unknown quantity at this point
Default

Nice details and pictures, good job woody.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Credits to Tdd for the origins of this sig
Reply With Quote
  #7  
Old 25-10-2007, 05:38 PM
Kashif (Offline)
AKA kmalik
 
Join Date: May 2007
Location: Nintendo 64
Posts: 583
Kashif is an unknown quantity at this point
Default

speedster im not getting the tolerance part
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

My main goal for being at rsf is to become an offical mm
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
lol 80% of the people here are nerds.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Hahaha I love 12 year old black kids.

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

Reply With Quote
  #8  
Old 25-10-2007, 11:05 PM
Speedster239's Avatar
Speedster239 (Offline)
Active Member
 
Join Date: Jul 2007
Location: The Internet
Posts: 271
Speedster239 is an unknown quantity at this point
Default

Tolerance means the range of the pixel atribute. So your allowing for more than one pixel when you do tolerance of 2 and so forth.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

My goal ^
Reached on Sunday, November 11th, 2007. Next skill to max out: Magic - 13.04 or 200mil fletch xp

I program PHP, Java and Vb.

MSN:
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:41 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright © 2006 - 2012, Rsforums.org