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.

JavaFX

Featured Replies

I don't know how to connect the Script variables or anything related to the Controller class for the JavaFX application, any ideas?

Edited by Orient

Pass the script instance into the class?

  • Author

Pass the script instance into the class?

 

JavaFX applications need a no-args constructor and the controller class doesn't take the argument and act as a controller for some reason

JavaFX applications need a no-args constructor and the controller class doesn't take the argument and act as a controller for some reason

 

I see, I've never touched JavaFX so I'm not exactly sure how to do this the best way.

Have you seen this? http://stackoverflow.com/questions/30814258/javafx-pass-parameters-while-instantiating-controller-class

 

Alternatively, if you don't really care about the code design you could just have a static getter in your main class, or in some sort of data class.

// don't forget the manifest
public class Unicorns extends Script {

    public static Script script;

    @ Override
    public void onStart() {
        script = this;
    }
    
    @ Override
    public int onLoop() {
        return 69;
    }

}

This wonderful piece of code solves all your OOP problems

Edited by Token

  • Author

I see, I've never touched JavaFX so I'm not exactly sure how to do this the best way.

Have you seen this? http://stackoverflow.com/questions/30814258/javafx-pass-parameters-while-instantiating-controller-class

 

Alternatively, if you don't really care about the code design you could just have a static getter in your main class, or in some sort of data class.

 

Alright, well I can't pass arguments to the Controller/Test classes properly so I'll have to do that. How can I go about doing that because it won't let me reference Script from a static context

 

// don't forget the manifest
public class Unicorns extends Script {

    public static Script script;

    @ Override
    public void onStart() {
        script = this;
    }
    
    @ Override
    public int onLoop() {
        return 69;
    }

}
This wonderful piece of code solves all your OOP problems

 

I think I'm retarded

Edited by Orient

// don't forget the manifest
public class Unicorns extends Script {

    public static Script script;

    @ Override
    public void onStart() {
        script = this;
    }
    
    @ Override
    public int onLoop() {
        return 69;
    }

}

This wonderful piece of code solves all your OOP problems

 

 

Feel like starting a debate so Ill go ahead and say that I wouldn't call it wonderful, bad code design and lack of encapsulation.

 

Your turn.

  • Author

Feel like starting a debate so Ill go ahead and say that I wouldn't call it wonderful, bad code design and lack of encapsulation.

 

Your turn.

 

Well, there's really no alternative in this case unless you can somehow pass a constructor to an application class to retrieve the Script methods.

Well, there's really no alternative in this case unless you can somehow pass a constructor to an application class to retrieve the Script methods.

 

As a further note, I don't think you should be accessing Script methods in your JavaFX, instead of creating a Script instance, create a Unicorns instance (as demonstrated in @@Token's demonstration) and use that to pass the needed data into main.

Just a thought, don't have to do it but I think its better practice

Feel like starting a debate so Ill go ahead and say that I wouldn't call it wonderful, bad code design and lack of encapsulation.

 

Your turn.

It decreases the stack frame size on all methods that require access to your Script instance by 64 bits :troll:

 

Your turn.

  • Author

As a further note, I don't think you should be accessing Script methods in your JavaFX, instead of creating a Script instance, create a Unicorns instance (as demonstrated in @@Token's demonstration) and use that to pass the needed data into main.

Just a thought, don't have to do it but I think its better practice

 

Well, I'm just grabbing things like name among other things, I just needed to gain access to those

 

Nope, still retarded. Just going to pull the data from a separate class like a good little boy. Don't know what I'm talking about.

Edited by Orient

It decreases the stack frame size on all methods that require access to your Script instance by 64 bits Troll.png

 

Your turn.

 

Who cares this is runescape

 

your turn

 

I used all my cards in my first reply, i concede defeat

Edited by Tom

ohmy.png

 

your turn

 

Edited my post 3 times while you were creating this reply, 

your turn

Edited my post 3 times while you were creating this reply, 

your turn

I was desperately browsing stackoverflow for an answer to "this is runescape" so as not to look overwhelmed by your argument while you were editting your reply

 

your turn

Create an account or sign in to comment

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.