SOLVED script_get_name and asset_get_type are functioning strangely

descrubb

Member
IDE v2.3.0.529
Runtime v2.3.0.401

Setup:
Script1.gml // script file
fn1 // empty function in Script1.gml

GML:
// Create
script_name = script_get_name(Script1) // -> "<unknown>"
scriptfn_name = script_get_name(fn1) // - > "fn1"
script_type = asset_get_type(Script1) // -> asset_unknown
scriptfn_type = asset_get_type(fn1) // -> asset_unknown
script_tags = asset_get_tags("Script1") // -> [ ]
scriptfn_tags = asset_get_tags("fn1") // -> [ ]
seems a bit strange. I haven't tested in the beta yet...
 

descrubb

Member
if anyone wants to test the above in beta


GML:
// Draw GUI
var str_size = string_height(script_name)
draw_text(x, y, string(script_name))
draw_text(x, y + str_size, string(scriptfn_name))
if script_type == asset_script
draw_text(x, y + (str_size * 2), string(script_type))
else if script_type == asset_unknown
draw_text(x, y + (str_size * 2), "unknown asset type")
if scriptfn_type == asset_script
draw_text(x, y + (str_size * 3), string(scriptfn_type))
else if script_type == asset_unknown
draw_text(x, y + (str_size * 3), "unknown asset type")
draw_text(x, y + (str_size * 4), string(script_tags))
draw_text(x, y + (str_size * 5), string(scriptfn_tags))
 

FrostyCat

Redemption Seeker
All of that is expected behaviour starting with GMS 2.3.0.

GML:
script_name = script_get_name(Script1) // -> "<unknown>"
scriptfn_name = script_get_name(fn1) // - > "fn1"
This is expected because script resources are no longer one-to-one with script functions, it's now one-to-many.

GML:
script_type = asset_get_type(Script1) // -> asset_unknown
scriptfn_type = asset_get_type(fn1) // -> asset_unknown
This is also expected because asset_get_type takes resource names (e.g. "fn1"), not resource IDs (e.g. fn1).

GML:
script_tags = asset_get_tags("Script1") // -> [ ]
scriptfn_tags = asset_get_tags("fn1") // -> [ ]
This is also expected because you haven't attached any tags. Attach some to the script and you'll see them in script_tags.
 

descrubb

Member
All of that is expected behaviour starting with GMS 2.3.0.

GML:
script_name = script_get_name(Script1) // -> "<unknown>"
scriptfn_name = script_get_name(fn1) // - > "fn1"
This is expected because script resources are no longer one-to-one with script functions, it's now one-to-many.

GML:
script_type = asset_get_type(Script1) // -> asset_unknown
scriptfn_type = asset_get_type(fn1) // -> asset_unknown
This is also expected because asset_get_type takes resource names (e.g. "fn1"), not resource IDs (e.g. fn1).

GML:
script_tags = asset_get_tags("Script1") // -> [ ]
scriptfn_tags = asset_get_tags("fn1") // -> [ ]
This is also expected because you haven't attached any tags. Attach some to the script and you'll see them in script_tags.

Ahahaha I love being stupendously stupid.

Thank you! I should have used more brain power to comprehend the docs when I read them.

I tested using your suggestions and you're right everything is working soundly đź‘Ś
 
Top