Skip to content

Make paths return as an asset ref rather than an index - #344

Open
emiyl wants to merge 2 commits into
ButterscotchRunner:mainfrom
emiyl:path-as-ref
Open

Make paths return as an asset ref rather than an index#344
emiyl wants to merge 2 commits into
ButterscotchRunner:mainfrom
emiyl:path-as-ref

Conversation

@emiyl

@emiyl emiyl commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This is more in line with what GameMaker actually expects, as running string(p) on a new path returns "ref path __newpathX", where X is the index, rather than just an index which Butterscotch currently does. This was tested in GameMaker Runtime 2026.0.0.23.

This PR adds a new value to the union in RValue of "assetIndex" which refers to the AssetRefType enum. It also changes the default name of paths from "" to "__newpathX", where X is the index.

Finally this also adds a switch case to RValue_toString, which works, however I it repeats itself slightly by putting in "__newpathX" again rather than just grabbing it from the asset itself. From what I can tell you can't rename assets in GameMaker anyway so this should be fine (and maybe faster?) but I would prefer it if it didn't do that.

If this works nicely, it should be extended to other assets like sprites and such.

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.

2 participants