This is being used in rs3 with gold ore but I'm sure it could be easily modified for another setting. I'm loading Bitmaps from a file; you can create your own bitmaps by using Snipping Tool or Paint.
If anyone can figure out how to get keypresses to register please let me know...
If anyone can figure out how to get keypresses to register please let me know...
Code:
SetVirtualMouseJavaModeOn();
if (SetWindow("RuneScape") == ""){Die("Could not find runescape");}while(SelectInnerWindow("SunAwtCanvas")){}
SetVirtualInputsOff();
// def ClickRandom(minX, minY, maxX, maxY){
// Click(RandomInt(minX, maxX), RandomInt(minY, maxY));
// }
def Click(x, y){
MoveMouse(x, y);
ClickMouse(x, y, 1);
}
def ClickRandomOffset(x, y, offset){
Click(x + RandomInt(-offset, offset),y + RandomInt(-offset, offset));
}
def FindClickBitmap(bitmap, sleepTime){
FindClickBitmap(bitmap,sleepTime, 0);
}
def FindClickBitmap(bitmap, sleepTime, deformation){
FindClickBitmapRegion(bitmap, 0, 0, GetWidth(), GetHeight(), deformation, sleepTime);
}
def FindClickBitmapRegion(bitmap, minX, minY, maxX, maxY, deformation, sleepTime){
var x = 0; var y = 0; var i = 0;
while(i < 5){
i = i + 1;
Scrape();
if(FindBitmap(x, y, bitmap, minX, minY, maxX, maxY, 20, deformation, 90, false)){
ClickRandomOffset(x,y, 10);
Sleep(RandomInt(sleepTime, sleepTime * 1.1));
return true;
} else {
print("Couldn't find bitmap, retrying");
Sleep(1000);
}
}
return false;
}
def AutoClick(runTime) {
var bankChest = LoadBitmapFromFile("bank_chest.bmp", 0xff00ff, false);
var goldOre = LoadBitmapFromFile("gold_ore_2.bmp", 0xff00ff, false);
var preset2 = LoadBitmapFromFile("preset_2_2.bmp", 0xff00ff, false);
var superheat = LoadBitmapFromFile("superheat_2.bmp", 0xff00ff, false);
var runTimes = runTime;
while (runTimes > 0){
print(runTimes);
runTimes = runTimes - 1;
// Click Bank Chest
if(!FindClickBitmap(bankChest, 1200)){
print("can't find bank chest");
return;
}
// Click Preset
if(!FindClickBitmap(preset2, 1200)){
print("can't find preset");
return;
}
var i = 0;
while(i < 27){
// Superheat
if(!FindClickBitmap(superheat, 10)){
print("can't find superheat");
return;
}
// Select Gold Ore
if(!FindClickBitmapRegion(goldOre, 1683, 785, 1747, 835, 0, 800)){
print("can't find gold ore");
return;
}
i = i + 1;
}
}
}
// Superheats x inventories
// Assumes preset 2 is correctly set up for your ore / nature runes
AutoClick(100);





