Jump to content

Structuring Script for Modularization


vlatte

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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