Jump to content

Bobrocket

Members
  • Posts

    1664
  • Joined

  • Last visited

  • Days Won

    4
  • Feedback

    100%

Posts posted by Bobrocket

  1. Looks pretty nice smile.png

     

    Inb4 make and correct typos doge.png

    I was thinking about typos. What I'm going to do is make a little keychar map with nested arrays (for example, "a" typos could be "q", "s", "z") and then have a chance to see and correct it before typing (pressing backspace x amount of times and then pressing the correct key) or simply not noticing and then in a new message doing the classic "word*".

     

    Edit: the equation for a random typo could just be (100000 / (wordsPM * 10) - rand.nextInt(5))? This way it still has a degree of randomness, but it still scales nicely with the words per minute factor (ofc you're not going to make many or any typos at 1wpm but you will at 120wpm)

     

    Edit 2: working typos!

    fed614e6aed00d7145319d5171ed04b9.png

    Set at 125wpm in the example, with the original text "The quick brown fox jumped over the lazy dog the quick brown".

    Currently, there is a 33% chance that the controller will actually fix the typo. You can change this in the typeString method (where it says if (typos && rand.nextInt(2) == 1 ) {)

     

    Good luck everyone, and happy botting :D

    • Like 1
  2. That may work, but only while you're not focusing on the man as well (eg. will not work right before you pickpocket the man, while the player is focusing the man).

     

    What you could do instead is simply check if your own player is under attack. If both you and the man are under attack, you'll be the one attacking him. If the man is under attack, but you are not, then it's probably someone else.

     

     

    Thanks, I will try that :)

     

  3. Alright, so after reading the "My Ban Theory" thread, I decided to take the idea of a normal distribution to keyboard typing. What I have made is experimental and may not work as expected to. All I aim to do with this is help to educate those with typing correctly.

     

    How it works:

    • Calculating based on words per minute, it sleeps a variable amount based on the value (assuming the average word has 6 characters)
    • With the help of normal distributions, the mean is the mode and the median (which is also usually the midpoint), so we can calculate a normal distribution of sleeping using the mean.
    • It types character per character
    • It wraps the Script sleep function to pause the appropriate time frame
    • (Version 1.1 and onwards) now makes typing errors based on the words per minute setting!

    Version 1.1 (newest; typos included):

    import java.util.ArrayList;
    import java.util.Random;
    
    import org.osbot.rs07.api.Keyboard;
    import org.osbot.rs07.script.Script;
    
    public class SmartKeyboard {
    	
    	public int wordsPM, charsPM, charsPS, msPC, minMS, maxMS, typoRate = 0;
    	public Random rand;
    	public Script baseScript;
    	public Keyboard kb;
    	
    	public int typoConstant = 100000; //You can change this if needed
    	
    	//This is a huge array of all potential typos for every alphabet character
    	public String[][] typos = new String[][] { { "q", "s", "z" }, //a
    		{ "v", "g", "n" }, { "x", "d", "v" }, { "s", "e", "f", "c" }, //bcd
    		{ "w", "d", "r" }, { "d", "r", "g", "v" }, { "f", "t", "h", "b" }, //efg
    		{ "g", "y", "j", "n" }, { "u", "k", "o" }, { "h", "m", "k", "u" }, //hij
    		{ "j", ",", "l", "i" }, { "k", ".", ";", "o" }, { "n", "j", "," }, //klm
    		{ "b", "h", "m" }, { "i", "l", "p" }, { "o", ";", "[" }, //nop
    		{ "w", "a", "s" }, { "e", "f", "t", "4" }, { "w", "a", "d", "x" },//qrs
    		{ "r", "g", "y", "5" }, { "y", "j", "i", "8" }, { "c", "f", "b" },//tuv
    		{ "q", "s", "e" }, { "z", "s", "c", "d" }, { "t", "h", "u", "j" }, //wxy
    		{ "a", "s", "x", "\\" }//z
    		};
    	
    	public String alphabet = "abcdefghijklmnopqrstuvwxyz";
    	
    	public SmartKeyboard(Script base, int wpm) {
    		baseScript = base;
    		kb = base.getKeyboard();
    		wordsPM = wpm;
    		charsPM = (wpm * 6);
    		charsPS = charsPM / 60;
    		msPC = 1000 / charsPS;
    		
    		rand = new Random();
    		minMS = msPC - (wordsPM / 2) + rand.nextInt(15); //Make this a little bit more random to simulate real key presses
    		maxMS = msPC + (wordsPM / 2) + rand.nextInt(15);
    	}
    	
    	public boolean typeString(String toType, boolean enter, boolean typos) throws InterruptedException {
    		int x = calculateTypo();
    		ArrayList<TypoChar> indexes = new ArrayList<TypoChar>();
    		int index = 0;
    		for (char ch : toType.toCharArray()) {
    			
    			//Here we are going to erase any typos
    			if (typos && rand.nextInt(2) == 1) {
    				for (TypoChar tc : indexes) {
    					if (tc.index == (index - 1)) { //We're going to erase this fucker
    						kb.typeKey((char)8); //8 is the backspace character (or 127 which is delete, not sure here)
    						sleep(rand(minMS, maxMS, msPC));
    						kb.typeKey(tc.original);
    						sleep(rand(minMS, maxMS, msPC));
    					}
    				}
    			}
    			
    			char old = ch;
    			if (typos && (rand.nextInt(x) == (x / 2))) {
    				ch = toTypo(String.valueOf(ch)).toCharArray()[0];
    				indexes.add(new TypoChar(index, old)); //We're going to see
    			}
    			kb.typeKey(ch);
    			sleep(rand(minMS, maxMS, msPC));
    			index++;
    		}
    		
    		if (enter) {
    			pressEnter();
    		}
    		
    		return true;
    	}
    	
    	public boolean typeCharacter(String character, boolean enter) throws InterruptedException {
    		kb.typeKey(character.toCharArray()[0]);
    		sleep(rand(minMS, maxMS, msPC));
    		
    		if (enter) {
    			pressEnter();
    		}
    		
    		return true;
    	}
    	
    	public boolean typeInteger(int integer, boolean enter) throws InterruptedException {
    		kb.typeKey(Character.forDigit(integer, 10));
    		sleep(rand(minMS, maxMS, msPC));
    		
    		if (enter) {
    			pressEnter();
    		}
    		
    		return true;
    	}
    	
    	public boolean pressEnter() {
    		kb.typeKey((char)13);
    		kb.typeKey((char)10);
    		return true;
    	}
    	
    	public int calculateTypo() {
    		int temp = typoConstant / (wordsPM * 10);
    		temp += rand.nextInt(6);
    		return temp;
    	}
    	
    	public String toTypo(String toTypo) { //TODO: preserve uppercase (if wanted)
    		toTypo = toTypo.toLowerCase();
    		int index = alphabet.indexOf(toTypo.charAt(0)); //Get the index to get typos for
    		
    		String[] charTypos = typos[index]; //We have our typos stored in the order abcdef...z
    		int len = charTypos.length;
    		toTypo = charTypos[getRandom(0, len - 1)]; //We do len - 1 as Java uses zero-based arrays.
    		
    		return toTypo;
    	}
    	
    	public int rand(int min, int max, int mean) { //Edited slightly; in a normal distribution, mean = mode = median = midpoint of graph
    		int n;
    		//int mean = (min + max) / 2;
    		int std = (max - mean) / 3;
    		Random r = new Random();
    		
    		do {
    			double val = r.nextGaussian() * std + mean;
    			n = (int) Math.round(val);
    		} while (n < min || n > max);
    		
    		return n;
    	}
    	
    	public int getRandom(int min, int max) {
    		int range = (max - min) + 1;
    		return rand.nextInt(range) + min;
    	}
    	
    	public void sleep(int t) throws InterruptedException {
    		Script.sleep(t);
    	}
    
    }
    
    class TypoChar { //We'll make an arraylist of these bad boys
    	public int index;
    	public char original;
    	
    	public TypoChar(int i, char o) {
    		original = o;
    		index = i;
    	}
    }
    

     

     

    Version 1.0 (old; no typos included):

    import java.util.Random;
    
    import org.osbot.rs07.api.Keyboard;
    import org.osbot.rs07.script.Script;
    
    public class SmartKeyboard {
    
    public int wordsPM, charsPM, charsPS, msPC, minMS, maxMS = 0;
    public Random rand;
    public Script baseScript;
    public Keyboard kb;
    
    public SmartKeyboard(Script base, int wpm) {
    baseScript = base;
    kb = base.getKeyboard();
    wordsPM = wpm;
    charsPM = (wpm * 6);
    charsPS = charsPM / 60;
    msPC = 1000 / charsPS;
    
    rand = new Random();
    minMS = msPC - (wordsPM / 2) + rand.nextInt(15); //Make this a little bit more random to simulate real key presses
    maxMS = msPC + (wordsPM / 2) + rand.nextInt(15);
    }
    
    public boolean typeString(String toType, boolean enter) throws InterruptedException {
    for (char ch : toType.toCharArray()) {
    kb.typeKey(ch);
    sleep(rand(minMS, maxMS, msPC));
    }
    
    if (enter) {
    pressEnter();
    }
    
    return true;
    }
    
    public boolean typeCharacter(String character, boolean enter) throws InterruptedException {
    kb.typeKey(character.toCharArray()[0]);
    sleep(rand(minMS, maxMS, msPC));
    
    if (enter) {
    pressEnter();
    }
    
    return true;
    }
    
    public boolean typeInteger(int integer, boolean enter) throws InterruptedException {
    kb.typeKey(Character.forDigit(integer, 10));
    sleep(rand(minMS, maxMS, msPC));
    
    if (enter) {
    pressEnter();
    }
    
    return true;
    }
    
    public boolean pressEnter() {
    kb.typeKey((char)13);
    kb.typeKey((char)10);
    return true;
    }
    
    public int rand(int min, int max, int mean) { //Edited slightly; in a normal distribution, mean = mode = median = midpoint of graph
    int n;
    //int mean = (min + max) / 2;
    int std = (max - mean) / 3;
    Random r = new Random();
    
    do {
    double val = r.nextGaussian() * std + mean;
    n = (int) Math.round(val);
    } while (n < min || n > max);
    
    return n;
    }
    
    public void sleep(int t) throws InterruptedException {
    Script.sleep(t);
    }
    
    }

    Usage example:

    SmartKeyboard sk = new SmartKeyboard(this, 60); //60 words per minute
    if (sk.typeString("The quick brown fox jumped over the lazy dog", true, true)) { //Third parameter to true -> enables typos
    	log("Typed the string and pressed enter!");
    }
    
    if (sk.typeCharacter("g")) {
    	log("Typed the character 'g'");
    }
    
    if (sk.typeInteger(4)) {
    	log("Typed the number 4!");
    }
    sk.typoConstant = 10000; //Default 100000; lower = more likely to cause a typo; equation ((typoConstant / (words per minute * 10))+ rand.nextInt(6))
    

    If there are any problems with this, let me know. Jagex may be smart, but we're smarter.

     

    Proof of typos:

    fed614e6aed00d7145319d5171ed04b9.png (set at 125wpm; original text "The quick brown fox jumped over the lazy dog the quick brown")

     

    Feel free to use the SmartKeyboard class however you want, but credit is always nice biggrin.png

    • Like 9
  4. If the sole purpose is to check if YOU are the one attacking the man, then you could just do:

    if (man.isUnderAttack() && !man.equals(myPlayer().getInteracting())) //I'm not attacking the man
    if (man.isUnderAttack() && man.equals(myPlayer().getInteracting())) //I'm attacking the man

    For the second case tho, you should probably add some more checks (We ARE in combat / the man is also interacting with us), in order to prevent any confusion that could occur if someone else is attacking the man, but we're still interacting with it for whatever reason.

     

    The idea is that if someone tries to attack the man while I am pickpocketing it, it will stop and say "dude wtf" or something similar. Sometimes, the bot does misclick and attack the man too (which I want to detect)

     

    So I would use the first example to check if someone is attacking him?

     

  5. So, I want to be able to see if someone else is attacking an NPC I targetted.

    For example:

    if (man.isUnderAttack() && man.<attacker> != myPlayer()) //I'm not attacking the man
    if (man.isUnderAttack() && man.<attacker> == myPlayer()) //I'm attacking the man
    

    Is there any way to do this?

  6. Most likely the same.

    It probably depends more on the scripts you use and how long you bot for rather than if your a member or not.

    You think so? I figured they would be more lenient towards those who pay for membership. Maybe it is less as I have access to places that not many people are at?

  7. good luck with your bot farm hopely you got a decent main to play legit on to make money with your farm....i farm the crap out of zulrah  to keep funds coming in

    My main is cb 72 lol, I don't have the patience to train usually and I don't want to bot on my main either.

     

  8. I think as long as the spacing is okay, two accounts on one IP is fine. You also could run a Windows VM with a VPN with virtualization.

    Sadly there are some problems with my processor - I can't find any drivers so I get blue screens sometimes.

    I was definitely considering having Windows VMs but it would take a while to set it up. I think my current set up is fine - having one account botting on my VPS while I play regularly with another and switch periodically.

     

  9. I think the point was being made that running two accounts from the same IP is not as bad. I'd have to agree that mirror mode is great. Although it doesn't support proxies, there are ways of running the program through a tunnel so you don't show your IP.

    Sadly the only way for me to tunnel IPs on my VPS is through Firefox, and 2 instances of Firefox can't have different IPs (+ mirror client doesn't actually work on Ubuntu)

     

  10. If you do have a path, you could just keep walking to the loaded position closest to your target destination. As you reach that position the next regions should load.

     

    Also, localWalker walk methods aren't asynchronous, so there shouldn't be a need for a conditional sleep after invoking it.

    I see, thank you. I know that localWalker is synchronous but I have that there because sometimes my client would lag a bit and would try to do the next bit without finishing walking so I added that check.

  11. It seems a bit silly to ask us about a walkTo method that you seemingly wrote yourself, and haven't provided the source for in this post.

     

    If however it uses some of the standard localWalker or WalkingEvent API, then the pathfinding is limited to the currently loaded region.

    Also, offtopic, but sequential execution like that is quite bad. Try to set it up to not rely on the previous action to have completed successfully. Easily done by ensuring that only 1 thing is done in every loop cycle.

    Sorry, I forgot to say here but the walkTo method is just localWalker.walkTo(position) and then a conditional sleep until the player is no longer moving.

    I am going to make sure that I am not using sequential execution later, as right now this is just a test to ensure that everything actually works.

     

    So how am I going to get my bot to walk there? Is there any way I could generate a path there?

  12. So, for part of my quest bot it has to fill a bucket of milk.

    Code:

    /* Go to dairy cows if we have a bucket */
                    if (hasItem("Bucket")) {
                        walkTo(placesToGo[2]);
                        sleep(750);
                        /* Open the gate if needed */
                        Entity gate = closestEntity("Gate");
                        openDoor(gate);
                        /* Milk the cow */
                        Entity cow = closestEntity("Dairy cow");
                        if (cow != null && cow.isVisible()) {
                            moveCamera(cow);
                            sleep(750);
                            cow.interact("Milk");
                            new ConditionalSleep(750000) {
                                @Override
                                public boolean condition() {
                                    return parent.getInventory().contains(itemsNeeded[1]);
                                }
                            }.sleep();
                        }
                        sleep(750);
                    }
    

    For some reason, the bot will not walk from lumbridge castle to dairy cows. Is there any reason for this?

  13. Teleport tabs have some of the best margins for merching in my experiences. I would get camelot tabs for ~450 and sell them for ~600. Not as impressive as what you've done here, but still pretty good.

  14. Mirror over proxies mate, u were just running two accounts..

    • I'm not going to bot on my home IP as I have a main
    • I'm not going to bot on an IP from this site as they have likely been blacklisted already

    It doesn't matter if I was just running two accounts, I can get as many proxies as I need for super cheap.

     

  15. If there is a chat message, you can listen for that.

    if there is XP gain, you can calculate it from that.

     

     

     I ended up just making a Thread and checking the animation from that (and then doing a conditonalsleep until the animation was finished). Not the best, but it works.

     

    Thanks everyone!

     

  16. YW

     

    Alright, so I really cannot figure this out.

    When smithing an item, the animation ID is 899.

    So it will smith the item, go back to no animation, and then smith another. How would I detect this and add another item to my counter?

     

  17. API Is very useful when you understand it tongue.png

     

    For the typing and pressing enter use this

     

    keyboard.typeString(String.valueOf(random(50,100)), true);

     

    Or something similar, the true means press enter after the strign has been typed i believe

     

    I see. I wanted to type each character individually as then it feels more like a human click. I seem to be reinventing the wheel every time :p

    Thank you though. My script seems to be working well so far so all is good.

     

    Is there a way to find out when my character has crafted a gold item? Usually you would use Onmessage (right?) but there is no message when you create a gold item.

×
×
  • Create New...