Jump to content

Structuring Script for Modularization


Recommended Posts

Posted

I've been writing a script recently and would like to modularize my code into different classes to do a collection of things. Is there an annotation to add to submodules to allow access to the main methods (myPlayer(), getBank(), etc.)? Right now, I'm just making methods small in my main script, but it is driving me crazy not to have it logically separated.

Posted (edited)
53 minutes ago, vlatte said:

I've been writing a script recently and would like to modularize my code into different classes to do a collection of things. Is there an annotation to add to submodules to allow access to the main methods (myPlayer(), getBank(), etc.)? Right now, I'm just making methods small in my main script, but it is driving me crazy not to have it logically separated.

You can pass on the Methodprovider or Script class :)
Since the main class extends those you can pass them on by using "this"
Example:

new PriceChecker(this).start();

 

Edited by Khaleesi
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...