Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Why is this instant typer not working?

Featured Replies

I wanted to code an instant typer with webwalking to GE but I wanted to solve the typing speed first. When I try to save it and run it I get an error.

Is there anything visibly wrong with the code? I'm still new to to this and used someones help.

 

package main;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import org.osbot.rs07.script.Script;
import org.osbotbot.rs07.script.ScriptManifest
 
@ScriptManifest(author = "", info = "", name = "", version = "0", logo = "")
public class main extends Script {
	private void typeStringInstant(String output) {

        for (int i = 0; i < output.length(); i++) {

            char c = output.charAt(i);
            int code = KeyEvent.getExtendedKeyCodeForChar(c);
            getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
        }

        getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000');
        getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000');
    }
	
	@Override
	public void onStart();
		log("");
}

	@Override
	public int onLoop(); throws InterruptedException {
		typingStringInstant("");
		return random(200,300);
	}
	
	@Override
	public void onExit(); {
		log("");
	}
	
	@Override
	public void onPaint(Graphics2D g) {

}

My Discord is: Pod#8714 if anyone would help me one on one that would be spectacular. I've spent hours trying to figure it out myself.

Edited by iLeggy

Remove the semi colon from onLoop() would be a good place to start.

First of all, you're not telling us what error you're receiving so how should we be able to help you?
Secondly, as @Slut spotted, you have a semicolon at the declaration of your onLoop method. Your IDE most likely tells you that this is not possible. If you couldn't figure this out yourself this probably means that you don't have a single clue about what you're doing. I'd like to suggest for you to learn Java first before trying to write a script :).

We're more than willing to help out those in need of assistance but we expect them to at least be able to handle syntax and have at least some knowledge about the language.

Edited by Eagle Scripts

  • Author
5 hours ago, Eagle Scripts said:

First of all, you're not telling us what error you're receiving so how should we be able to help you?
Secondly, as @Slut spotted, you have a semicolon at the declaration of your onLoop method. Your IDE most likely tells you that this is not possible. If you couldn't figure this out yourself this probably means that you don't have a single clue about what you're doing. I'd like to suggest for you to learn Java first before trying to write a script :).

We're more than willing to help out those in need of assistance but we expect them to at least be able to handle syntax and have at least some knowledge about the language.

I've written scripts before. Muling scripts, woodcutting scripts, simple scripts. This is my first time using complicated snippets.

 

My friend learned ALL of Java by coding Minecraft plugins starting with simple ones moving upward. I figure I can do the same. 

 

 

5 hours ago, Slut said:

Remove the semi colon from onLoop() would be a good place to start.

Besides the semi-colon, is there any other issues?

10 minutes ago, iLeggy said:

I've written scripts before. Muling scripts, woodcutting scripts, simple scripts. This is my first time using complicated snippets.

 

My friend learned ALL of Java by coding Minecraft plugins starting with simple ones moving upward. I figure I can do the same. 

 

 

Besides the semi-colon, is there any other issues?

Replace

onExit();

with 

onExit()

Replace

public void onStart();

with 

public void onStart() {

and lastly the

onLoop();

with 

onLoop()

but the onLoop was already explained by @Slut

That's all I can see from skimming over.. guess try executing and telling us the response & whether you got the expected outcome

 

Suggestion -

Use IDE such as IntelliJ

Read start guide tutorials in the tutorial section.

Edited by Jar

  • Author
27 minutes ago, Jar said:

Replace


onExit();

with 


onExit()

Replace


public void onStart();

with 


public void onStart() {

and lastly the


onLoop();

with 


onLoop()

but the onLoop was already explained by @Slut

That's all I can see from skimming over.. guess try executing and telling us the response & whether you got the expected outcome

 

Suggestion -

Use IDE such as IntelliJ

Read start guide tutorials in the tutorial section.

I am using Eclipse. I think I got it.

 

package main;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "", info = "", name = "", version = 0, logo = "")
public class main extends Script {
	
	private void typeStringInstant(String output) {

        for (int i = 0; i < output.length(); i++) {

            char c = output.charAt(i);
            int code = KeyEvent.getExtendedKeyCodeForChar(c);
            getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
        }

        getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000');
        getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000');
    }
	

	@Override
	public void onStart() {
		log("");
	}

	@Override
	public int onLoop() throws InterruptedException {
		typeStringInstant("Spam goes here...");
		return random(200, 300);
	}

	@Override
	public void onExit() {
		log("");
	}

	@Override
	public void onPaint(Graphics2D g) {

	}

}

 

1 hour ago, iLeggy said:

I've written scripts before. Muling scripts, woodcutting scripts, simple scripts. This is my first time using complicated snippets.

 

My friend learned ALL of Java by coding Minecraft plugins starting with simple ones moving upward. I figure I can do the same. 

 

 

Besides the semi-colon, is there any other issues?

Hhm but how can you have written muling scripts while using an IDE but not know that the syntax of `onLoop();` instead of `onLoop() { }` doesn't work? :(

26 minutes ago, Eagle Scripts said:

Hhm but how can you have written muling scripts while using an IDE but not know that the syntax of `onLoop();` instead of `onLoop() { }` doesn't work? :(

This is my first time using complicated snippets. "

Which suggests he's been puzzling snippets ( from the snippet section ) together to create his expectation/script ( Which I guess isn't a bad route if you actually read the code and not just copy/paste ).. but it's irrelevant if he has or hasn't scripted before, he's here for help so it's only right to give him some..

50 minutes ago, Eagle Scripts said:

Hhm but how can you have written muling scripts while using an IDE but not know that the syntax of `onLoop();` instead of `onLoop() { }` doesn't work? :(

this ^ 


How did it even compile

35 minutes ago, Jar said:

This is my first time using complicated snippets. "

Which suggests he's been puzzling snippets ( from the snippet section ) together to create his expectation/script ( Which I guess isn't a bad route if you actually read the code and not just copy/paste ).. but it's irrelevant if he has or hasn't scripted before, he's here for help so it's only right to give him some..

Of course. As I stated, most of us are more than willing to help people out, including me. What you can't expect from me, however, is that I will just spoonfeed everything when I, in fact, know that he won't learn from it. 

Would you explain how to shift gears to somebody who doesn't know how to get the engine to start but got the engine running because he was able to mimic something without actually understanding what he just mimicked? I wouldn't. 

  • Author
4 hours ago, Eagle Scripts said:

Of course. As I stated, most of us are more than willing to help people out, including me. What you can't expect from me, however, is that I will just spoonfeed everything when I, in fact, know that he won't learn from it. 

Would you explain how to shift gears to somebody who doesn't know how to get the engine to start but got the engine running because he was able to mimic something without actually understanding what he just mimicked? I wouldn't. 

I never asked for a spoonfeed and yeah, I made mistakes. I was into this over a year ago and it's like I'm re-learning it. - Thought this was the help section but it's just the insult section.

3 hours ago, iLeggy said:

I never asked for a spoonfeed and yeah, I made mistakes. I was into this over a year ago and it's like I'm re-learning it. - Thought this was the help section but it's just the insult section.

Well technically they're right in what they said, Like @Eagle Scripts stated "  you have a semicolon at the declaration of your onLoop method. Your IDE most likely tells you that this is not possible. If you couldn't figure this out yourself this probably means that you don't have a single clue about what you're doing. " 

 

I would definitely suggest just reading a basic starter tutorial in the tutorial section, you're making below intermediate mistakes.. no disrespect either could just be a typo and you didn't notice, but I think it's more to the fact you didn't notice your error, especially when you're using Eclipse IDE which would have told you that isn't possible. 

 

Goodluck :).

 

8 hours ago, Eagle Scripts said:

Of course. As I stated, most of us are more than willing to help people out, including me. What you can't expect from me, however, is that I will just spoonfeed everything when I, in fact, know that he won't learn from it. 

Would you explain how to shift gears to somebody who doesn't know how to get the engine to start but got the engine running because he was able to mimic something without actually understanding what he just mimicked? I wouldn't. 

Yeah I completely get where you're coming from, however just felt a little sarcastic in your last response to him.. but you're right in what you're saying.

Didn’t want to insult anybody, just wanted to state that you should learn the language first before attempting to script, you’ll benefit from it in the long run :).

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.