Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-Game: Add support for script_execute()/script_execute_ext() to call constructors #7995

Closed
rwkay opened this issue Oct 14, 2024 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation are required by this issue feature request New feature (or a request for one)
Milestone

Comments

@rwkay
Copy link

rwkay commented Oct 14, 2024

Is your feature request related to a problem?

With the addition of the error check to disallow constructors from being called normally - there is a requirement for library writers to be able to call a constructor with an array (in the way that script_execute_ext allows).

This will allow for more dynamic code to created without having a tower of doom to support different numbers of arguments.

Describe the solution you'd like

Allow the following code to work



function blah() constructor 
{
    baby = 5;
}

function foo() : blah() constructor 
{
    one = 10;
}

function bar() constructor
{
    two = 20;
    foo = new foo();
}

var a = {};
with( a ) {
    show_debug_message( $"{instanceof(self)} -> {a}" );
    script_execute( foo );
    show_debug_message( $"{instanceof(self)} -> {a}" );
    script_execute( bar );
    show_debug_message( $"{instanceof(self)} -> {a}" );
}

var b = {};
with( b ) {
    show_debug_message( $"{instanceof(self)} -> {b}" );
    script_execute_ext( foo );
    show_debug_message( $"{instanceof(self)} -> {b}" );
    script_execute_ext( bar );
    show_debug_message( $"{instanceof(self)} -> {b}" );
}

Project attached -
Bug-7995.zip

Describe alternatives you've considered

constructor_call and other new functions - but we do not want to add a new function at this time

Additional context

No response

@rwkay rwkay added the feature request New feature (or a request for one) label Oct 14, 2024
rwkay pushed a commit to YoYoGames/GameMaker-HTML5 that referenced this issue Oct 14, 2024
@rwkay rwkay self-assigned this Oct 14, 2024
@rwkay rwkay added this to the 2024.11 milestone Oct 14, 2024
@rwkay rwkay moved this from Triage to In Progress in Team Workload Oct 14, 2024
@rwkay
Copy link
Author

rwkay commented Oct 17, 2024

Added in 2024.11

@rwkay rwkay closed this as completed Oct 17, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Team Workload Oct 17, 2024
@YYBartT YYBartT added the documentation Improvements or additions to documentation are required by this issue label Oct 18, 2024
@YYBartT YYBartT self-assigned this Oct 21, 2024
@YYDan YYDan changed the title Allow script_execute and script_execute_ext to call constructors In-Game: Add support for script_execute()/script_execute_ext() to call constructors Oct 24, 2024
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Oct 29, 2024
…to call constructors

YoYoGames/GameMaker-Bugs#7995

* Documented the new behaviour of script_execute() and script_execute_ext() when passed a constructor in snippet
* Modified the note on the Structs & Constructors page
* Added two new code examples, one on the script_execute() page, on the script_execute_ext() page
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Oct 29, 2024
@YYBartT
Copy link

YYBartT commented Oct 29, 2024

Documented the new behaviour on the script_execute() and script_execute_ext() manual pages. Also added an additional code example on each page.

@YYBartT YYBartT moved this from Done to Ready for QA in Team Workload Oct 29, 2024
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Oct 29, 2024
…to call constructors

YoYoGames/GameMaker-Bugs#7995

* script_execute_ext() page code example: moved the increment to its own line for clarity
@scott-dunbar scott-dunbar self-assigned this Oct 30, 2024
@scott-dunbar
Copy link
Collaborator

Verified fixed in IDE v2024.1100.0.661 Runtime v2024.1100.0.687

Everything appears to be working as expected and documented in this ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation are required by this issue feature request New feature (or a request for one)
Projects
Status: Verified
Development

No branches or pull requests

3 participants