The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Java Code
Posted by: cheese3 | June 16, 2010 @ 3:54pm
Java Code
[
Download
]
import java.awt.*; import java.awt.event.KeyEvent; import java.util.*; import org.rsbot.script.*; import org.rsbot.script.wrappers.*; import org.rsbot.bot.Bot; import org.rsbot.bot.input.Mouse; import org.rsbot.event.listeners.PaintListener; import org.rsbot.event.listeners.ServerMessageListener; import org.rsbot.event.events.ServerMessageEvent; @ScriptManifest(authors = "Rapid", category = "Rapid", name = "Cheese Producer ;) v2", version = 1.0, description = "WHAT_YOU_WANT_IT_TO_SAY_IN_DESCRIPTION") public class CheeseProducer extends Script implements PaintListener, ServerMessageListener { public String status; //Counters public int TomatoCount; public int PizzaBaseCount; public int IncPizzaCount; //IDs public int TomatoID = 1982; public int PizzaBaseID = 2283; //Pizza to Incomplete Pizza Variables public Boolean makingIncompletePizza = false; //Summoning Regeneration Timers public long SummoningTimer; public long CurrentTime; public long TimeToNextSpecial; public Boolean SpecialRegained; //SkillsTab public int FirstTabX = 554; public int FirstTabY = 211; public int TabDifferenceX = 62; public int TabDifferenceY = 23; //Log Variables public int TotalPizzaMade; //General Variables public int RandomNumber; public int RandomX; public int RandomY; //Summoning/Pizza Swap public Boolean usingScrolls = true; public Boolean makingPizza = false; //Pizza Variables public int CheeseID = 1985; public int UncookedID = 2287; public int IncompleteID = 2285; public int CheeseCount; public int PizzaCount; public int PizzaMade; public int CombinedWithdraw; public int CheeseInv; public int PizzaInv; //Make-All ID's public int PizzaX = 236; public int PizzaY = 397; public int MakeX = 192; public int MakeY = 457; //Withdraw public Boolean WithdrawPotion = false; //Objects public RSObject FindBank; //ID's public int SummoningPotion1 = 12146; public int SummoningPotion2 = 12144; public int SummoningPotion3 = 12142; public int VialID = 229; public int ScrollID = 12430; public int PouchID = 12067; public int BankBoothID = 11402; public int Animation = 7660; //Mouse Variables public int DepositSummonX = 457; public int DepositSummonY = 295; public int SummonIconX = 695; public int SummonIconY = 135; //Count Variables public int SpecialCount; public int SummoningPotionCounter; //Check Variables public int CheckScroll; public int CheckPotion; public int CheckPotionInv; public Boolean CheckDeposit; public Boolean PotUp; public int SummoningPoint = 60; public int SummoningPotionCount; public boolean onStart(Map<String, String> args){ startTime = System.currentTimeMillis(); return true; } public void doAntiBanPizza(){ status = "Doing anti-ban."; RandomNumber = random(1, 3); if (RandomNumber == 1){ log("Using anti-ban method 1."); RandomX = 520 + random(0, 15); RandomY = 53 + random(0, 15); moveMouse(RandomX, RandomY); clickMouse(true); WaitRandom(); RandomX = RandomX + random(-200, 200); RandomY = RandomY + random(-200, 200); moveMouse(RandomX, RandomY); WaitRandom(); RandomX = 520 + random(0, 15); RandomY = 53 + random(0, 15); moveMouse(RandomX, RandomY); clickMouse(true); WaitRandom(); } if (RandomNumber == 3){ log("Using anti-ban method 2."); RandomX = 553 + random(0, 20); RandomY = 168 + random(0, 30); moveMouse(RandomX, RandomY); clickMouse(true); WaitRandom(); RandomNumber = random(1, 24); if (RandomNumber == 1){ RandomX = 554 + random(0, 40); RandomY = 211 + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 2){ RandomX = FirstTabX + TabDifferenceX + random(0, 40); RandomY = FirstTabY + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 3){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0, 40); RandomY = FirstTabY + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 4){ RandomX = FirstTabX + random(0, 40); RandomY = FirstTabY + TabDifferenceY + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 5){ RandomX = FirstTabX + TabDifferenceX + random(0, 40); RandomY = FirstTabY + TabDifferenceY + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 6){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0, 40); RandomY = FirstTabY + TabDifferenceY + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 7){ RandomX = FirstTabX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 2) + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 8){ RandomX = FirstTabX + TabDifferenceX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 2) + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 9){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 2) + random(0, 20); moveMouse(RandomX, RandomY); } if (RandomNumber == 10){ RandomX = FirstTabX + random(0, 40); RandomY = FirstTabY + (TabDifferenceY * 3) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 11){ RandomX = FirstTabX + TabDifferenceX + random(0, 40); RandomY = FirstTabY + (TabDifferenceY * 3) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 12){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 3) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 13){ RandomX = FirstTabX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 4) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 14){ RandomX = FirstTabX + TabDifferenceX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 4) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 15){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 4) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 16){ RandomX = FirstTabX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 5) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 17){ RandomX = FirstTabX + TabDifferenceX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 5) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 18){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 5) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 19){ RandomX = FirstTabX + random(0, 40); RandomY = FirstTabY + (TabDifferenceY * 6) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 20){ RandomX = FirstTabX + TabDifferenceX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 6) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 21){ RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 6) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 21){ RandomX = FirstTabX + random(0, 40); RandomY = FirstTabY + (TabDifferenceY * 7) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 22){ RandomX = FirstTabX + TabDifferenceX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 7) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 23){ RandomX = FirstTabX + TabDifferenceX + random(0, 40); RandomY = FirstTabY + (TabDifferenceY * 7) + random(0,20); moveMouse(RandomX, RandomY); } if (RandomNumber == 24){ RandomX = FirstTabX + random(0,40); RandomY = FirstTabY + (TabDifferenceY * 8) + random(0,20); moveMouse(RandomX, RandomY); } WaitRandom(); WaitRandom(); } if (RandomNumber == 2){ log("Using anti-ban method 2."); RandomX = random(0, 500); RandomY = random(0, 250); moveMouse(RandomX, RandomY); wait(random(10000, 30000)); } } public void doAntiBan(){ } public void WaitRandom(){ RandomNumber = random(1, 5); if (RandomNumber == 1){ wait(random(500,1000)); } if (RandomNumber == 2){ wait(random(750,1250)); } if (RandomNumber == 3){ wait(random(1000, 1500)); } if (RandomNumber == 4){ wait(random(1500,2000)); } if (RandomNumber == 5){ wait(random(2000, 2500)); } } public void WithdrawPot(){ CheckPotionInv = getInventoryCount(SummoningPotion3); CheckPotionInv = CheckPotionInv + getInventoryCount(SummoningPotion2); CheckPotionInv = CheckPotionInv + getInventoryCount(SummoningPotion1); if (CheckPotionInv == 0); RSObject FindBank = getNearestObjectByID(BankBoothID); if (FindBank != null){ while (!bank.open()){ if (!bank.open()){ atObject(FindBank, "Use-quickly"); wait(random(4000, 5000)); bank.getCount(SummoningPotion3); if (SummoningPotionCount == 0){ log("Out of potions"); stopScript(); } } } } bank.withdraw(SummoningPotion3, 1); } public void DrinkPot(){ bank.close(); SummoningPotionCount = getInventoryCount(SummoningPotion3); while (SummoningPotionCount == 1){ SummoningPotionCount = getInventoryCount(SummoningPotion3); atInventoryItem(SummoningPotion3, "Drink"); SummoningPoint = SummoningPoint + 15; wait(random(2000,3000)); atInventoryItem(SummoningPotion2, "Drink"); SummoningPoint = SummoningPoint + 15; wait(random(2000,3000)); atInventoryItem(SummoningPotion1, "Drink"); SummoningPoint = SummoningPoint + 15; wait(random(2000,3000)); } } public void MakePizza(){ status = "Making Pizza."; atInventoryItem(IncompleteID, "Use"); wait(random(1000,2000)); atInventoryItem(CheeseID, "Use"); wait(random(1000,2000)); PizzaX = PizzaX + random(0, 30); PizzaY = PizzaY + random(0, 10); moveMouse(PizzaX, PizzaY); PizzaX = 236; PizzaY = 397; clickMouse(false); MakeX = 194 + random(0, 90); MakeY = 457 + random(0, 5); moveMouse(MakeX, MakeY); clickMouse(true); MakeX = 194; MakeY = 457; } public void MakeIncomplete(){ status = "Making Incomplete Pizza's."; atInventoryItem(TomatoID, "Use"); WaitRandom(); atInventoryItem(PizzaBaseID, "Use"); WaitRandom(); PizzaX = PizzaX + random(0, 30); PizzaY = PizzaY + random(0, 10); moveMouse(PizzaX, PizzaY); PizzaX = 236; PizzaY = 397; clickMouse(false); MakeX = 194 + random(0, 90); MakeY = 457 + random(0, 5); WaitRandom(); moveMouse(MakeX, MakeY); clickMouse(true); MakeX = 194; MakeY = 457; } public int loop(){ if (usingScrolls == true){ //TimeToNextSpecial = System.currentTimeMillis() - SummoningTimer; //if (TimeToNextSpecial == 300000){ //SpecialRegained = true; //SummoningPoint = SummoningPoint + 10; //} //if (SpecialRegained == true){ //SummoningTimer = System.currentTimeMillis(); //SpecialRegained = false; //} CheckScroll = getInventoryCount(ScrollID); if (CheckScroll == 0){ log("No scrolls."); usingScrolls = false; makingPizza = true; } } if (usingScrolls == true){ log("Using scrolls option."); while (SpecialCount <= 7){ status = "Doing Special."; SummonIconX = SummonIconX + random(0, 50); SummonIconY = SummonIconY + random(0, 10); moveMouse(SummonIconX, SummonIconY); clickMouse(true); SummonIconX = 695; SummonIconY = 135; SummoningPoint = SummoningPoint - 6; SpecialCount = SpecialCount + random(1, 2); WaitRandom(); if (SummoningPoint <= 6){ WithdrawPot(); WaitRandom(); DrinkPot(); } } SpecialCount = 0; status = "Banking."; RSObject FindBank = getNearestObjectByID(BankBoothID); if (FindBank == null){ log("Couldn't find bank..."); stopScript(); } while (!bank.isOpen()){ atObject(FindBank, "Use-quickly"); WaitRandom(); } if (bank.isOpen()); bank.depositAllFamiliar(); } if (makingPizza == true){ log("Making Pizza"); PizzaCount = getInventoryCount(IncompleteID); CheeseCount = getInventoryCount(CheeseID); CombinedWithdraw = PizzaCount + CheeseCount; RSObject FindBank = getNearestObjectByID(BankBoothID); while (!bank.isOpen()){ atObject(FindBank, "Use-quickly"); WaitRandom(); } PizzaCount = bank.getCount(IncompleteID); CheeseCount = bank.getCount(CheeseID); if (PizzaCount == 0){ TomatoCount = bank.getCount(TomatoID); if (TomatoCount > 0){ log("Making uncomplete pizza's"); makingPizza = false; usingScrolls = false; makingIncompletePizza = true; return random(500,1000); } if (TomatoCount == 0){ log("no tomato's"); stopScript(); } } if (CheeseCount == 0){ stopScript(); } } if (makingPizza == true){ try{ bank.depositAll(); bank.withdraw(IncompleteID, 14); wait(random(100,200)); bank.withdraw(CheeseID, 14); WaitRandom(); CheeseInv = getInventoryCount(CheeseID); PizzaInv = getInventoryCount(IncompleteID); CombinedWithdraw = PizzaInv + CheeseInv; while (CombinedWithdraw != 28){ CombinedWithdraw = 0; bank.depositAll(); bank.withdraw(IncompleteID, 14); wait(random(100,200)); bank.withdraw(CheeseID, 14); WaitRandom(); CheeseInv = getInventoryCount(CheeseID); PizzaInv = getInventoryCount(IncompleteID); CombinedWithdraw = PizzaInv + CheeseInv; } bank.close(); WaitRandom(); while(bank.isOpen()){ bank.close(); WaitRandom(); } MakePizza(); WaitRandom(); WaitRandom(); PizzaMade = getInventoryCount(UncookedID); while (PizzaMade == 0){ MakePizza(); WaitRandom(); PizzaMade = getInventoryCount(UncookedID); } doAntiBanPizza(); while (PizzaMade < 14){ PizzaMade = getInventoryCount(UncookedID); wait(random(100,200)); } log("Pizza's done."); atObject(FindBank, "Use-quickly"); WaitRandom(); while (!bank.isOpen()){ atObject(FindBank, "Use-quickly"); WaitRandom(); } bank.depositAll(); bank.withdraw(IncompleteID, 14); wait(random(100,200)); bank.withdraw(CheeseID, 14); WaitRandom(); CheeseInv = getInventoryCount(CheeseID); PizzaInv = getInventoryCount(IncompleteID); CombinedWithdraw = PizzaInv + CheeseInv; while (CombinedWithdraw != 28){ bank.withdraw(IncompleteID, 14); wait(random(100,200)); bank.withdraw(CheeseID, 14); WaitRandom(); CheeseInv = getInventoryCount(CheeseID); PizzaInv = getInventoryCount(IncompleteID); CombinedWithdraw = PizzaInv + CheeseInv; } bank.close(); WaitRandom(); while(bank.isOpen()){ bank.close(); wait(random(1000,2000)); } } catch(Exception ignored){ } } if (makingIncompletePizza == true){ log("No Incompletes, Making Incomplete Pizza"); try{ if (!bank.open()){ atObject(FindBank, "Use-quicky"); WaitRandom(); while (!bank.isOpen()){ status = "Banking."; atObject(FindBank, "Use-quickly"); WaitRandom(); } } bank.depositAll(); WaitRandom(); bank.withdraw(TomatoID, 14); WaitRandom(); bank.withdraw(PizzaBaseID, 14); WaitRandom(); TomatoCount = getInventoryCount(TomatoID); PizzaBaseCount = getInventoryCount(PizzaBaseID); CombinedWithdraw = TomatoCount + PizzaBaseCount; WaitRandom(); while (CombinedWithdraw != 28){ bank.withdraw(TomatoID, 14); WaitRandom(); bank.withdraw(PizzaBaseID, 14); WaitRandom(); TomatoCount = getInventoryCount(TomatoID); PizzaBaseCount = getInventoryCount(PizzaBaseID); CombinedWithdraw = TomatoCount + PizzaBaseCount; WaitRandom(); } bank.close(); WaitRandom(); while (bank.isOpen()){ WaitRandom(); bank.close(); } MakeIncomplete(); WaitRandom(); WaitRandom(); IncPizzaCount = getInventoryCount(IncompleteID); while (IncPizzaCount == 0){ WaitRandom(); MakeIncomplete(); WaitRandom(); IncPizzaCount = getInventoryCount(IncompleteID); } doAntiBanPizza(); while (IncPizzaCount < 14){ wait(random(10,100)); IncPizzaCount = getInventoryCount(IncompleteID); } } catch(Exception ignored){ } } return random(500,1000); } public void onFinish(){ log("Thanks for using I2HYCheeseProducer"); log("Uncooked pizza's made: " + TotalPizzaMade + "."); } //Paint public long startTime; public void onRepaint(final Graphics g) { long millis = System.currentTimeMillis() - startTime; Mouse m = Bot.getClient().getMouse(); long PizzaPerHour = 0; int startlvl = 0; if (TotalPizzaMade > 0){ PizzaPerHour = TotalPizzaMade * 3600 / (millis / 1000); } long hours = millis / (1000 * 60 * 60); millis -= hours * (1000 * 60 * 60); long minutes = millis / (1000 * 60); millis -= minutes * (1000 * 60); long seconds = millis / 1000; //Status g.setColor( new Color(70, 234, 40, 150)); g.fillRect(337, 322, 60, 16); g.setColor(new Color(0, 0, 0)); g.drawRect(337, 322, 60, 16); g.setColor( new Color(70, 234, 40, 200)); g.drawRect(338, 323, 58, 14); g.setColor(new Color(255, 255, 255)); g.setFont(new Font("Comic Sans", Font.BOLD, 12)); g.setColor(Color.black); g.drawString("Status", 341,334); g.setColor( new Color(70, 234, 40, 100)); g.fillRect(337, 322, 60, 8); //Time Ran g.setColor( new Color(70, 234, 40, 150)); g.fillRect(226, 322, 110, 16); g.setColor(new Color(0, 0, 0)); g.drawRect(226, 322, 110, 16); g.setColor( new Color(70, 234, 40, 200)); g.drawRect(227, 323, 108, 14); g.setColor(new Color(255, 255, 255)); g.setFont(new Font("Comic Sans", Font.BOLD, 12)); g.setColor(Color.black); g.drawString( hours +"h " +minutes +"min " +seconds +"sec ", 234,334); g.setColor( new Color(70, 234, 40, 100)); g.fillRect(226, 322, 110, 8); g.setColor( new Color(70, 234, 40, 150)); g.fillRect(337, 175, 182, 147); g.setColor(new Color(0, 0, 0)); g.drawRect(337, 175, 182, 147); g.setColor(new Color(255, 255, 255)); g.setColor(Color.black); g.setFont(new Font("Comic Sans", Font.BOLD, 12)); g.drawString("PizzaMade: " + Integer.toString(PizzaMade) + "", 360, 217); g.drawString("Averaging: " +PizzaPerHour+ " Pizza/Hr", 360, 257); g.drawString("Status: "+ status , 360, 317); g.setColor(new Color(255, 255, 255)); g.setColor(Color.white); g.drawString("I2HYCheeseProducer!", 360, 197); g.setColor(Color.red); //Color(white); g.setColor(new Color(255, 255, 255)); } @Override public void serverMessageRecieved(ServerMessageEvent e) { String word = e.getMessage(); if (word.contains("You add the cheese to the pizza.")){ TotalPizzaMade = TotalPizzaMade + 1; } } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.61 / 8
59 Votes
http://codebin.yi.org/697
page generated in 0.01 seconds