Skip to content

Comments

[ENHANCEMENT] Add scriptInit and listScriptClasses to every script class#349

Merged
AbnormalPoof merged 1 commit intoFunkinCrew:experimentalfrom
KoloInDaCrib:patch-3
Feb 20, 2026
Merged

[ENHANCEMENT] Add scriptInit and listScriptClasses to every script class#349
AbnormalPoof merged 1 commit intoFunkinCrew:experimentalfrom
KoloInDaCrib:patch-3

Conversation

@KoloInDaCrib
Copy link

Since scripted classes can extend each other now, it is a no-brainer to add functions from normal script class bases into scripted classes.
I initially wanted to add onto the staticFields array when initializing a class, however I couldn't figure out how to convert the functions into hscript.Expr blocks without using a different interpreter for them, as I would need some of Polymod's classes which are normally blacklisted.

image

@EliteMasterEric
Copy link
Member

EliteMasterEric commented Feb 19, 2026

Oh I see, you're looking to dynamically instantiate scripts from ANOTHER script! I was going to suggest using the constructor but this is a different thing.

As for the actual implementation, this could probably be handled using a single Map<String, Function>, I could see a bug happening where a function gets added in one place and not the other, causing issues.

Copy link
Member

@AbnormalPoof AbnormalPoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is correct, but the code for scriptInit could imply that you can instantiate ANY class instead of only ones that extend said class.

@KoloInDaCrib
Copy link
Author

I'm not sure if this is correct, but the code for scriptInit could imply that you can instantiate ANY class instead of only ones that extend said class.

This is true, as the code for this PR was taken directly from how scriptInit is handled by the script class bases. The only difference between the two is that the script class bases force a return type.
image

Copy link
Member

@AbnormalPoof AbnormalPoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great!

@AbnormalPoof AbnormalPoof merged commit f989509 into FunkinCrew:experimental Feb 20, 2026
@KoloInDaCrib KoloInDaCrib deleted the patch-3 branch February 20, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants