Jump 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.

GUI Script merging

Featured Replies

So as the title suggests I have a menu created with swing and a OSbot script.

-Both classes are under the same package

-I currently have the start button actionhandler create a new script() on pressing it

-Im positive this is the wrong way to do it, anyone have some insight that could guide me onto the right path?

	public GUI(){
		super("Menu");
		setLayout(new FlowLayout());
		setSize(300, 200);
		setResizable(true);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
	
		
		Panel = new JPanel();
		Panel.setBackground(Color.yellow);
		add(Panel);
		Panel.add(Box1);
		Panel.add(Box2);
		Panel.add(Button1);
		HandlerClass Handler = new HandlerClass();
		Button1.addActionListener(Handler);
		
		setVisible(true);
	}

	public static void main(String[] args){
		new GUI();
		
	}
	private class HandlerClass implements ActionListener{
		public void actionPerformed(ActionEvent event){
			if(!Box1.isSelected() && !Box2.isSelected()){
				new CatchBirds(); //new script()
			}
		}
	}
}

An easy way would just be to create an abstract class with a looping method.

public abstract AbstractScript {

    public abstract void loop() throws InterruptedException;

}

Then have your GUI decide which "script" to run and then in your main classes onLoop execute that "scripts" loop method.

  • Author

yea so your saying create a main class then make the GUI return which script to use then depending on the return execute that script?

 

An easy way would just be to create an abstract class with a looping method.

public abstract AbstractScript {

    public abstract void loop() throws InterruptedException;

}

Then have your GUI decide which "script" to run and then in your main classes onLoop execute that "scripts" loop method.

strange question, could you:

 

public int loop(){
if(firstScript){
    scrtipOne();
}else if (secondScript){
   scriptTwo();
}
}



public int scriptOne(){
//thecode
}
public int scriptTwo(){
//thecode
}

(void most likly better used void but this was faster to write)

or would this be a bad way of doing it?

  • Author

what i ended up doing was create a INT member variable in the GUI Class and depending on what script it selects it changes the value, then in the main it checks that integer.

 

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.