Blockland Forums > Modification Help
Getting a print name from ID? [Solved]
Slicksilver:
Alright, I found a way. A stuffty way, but a way nonetheless.
getPrintTexture(%id)
You can parse the file name into a variable name however you like, but I'm not sure how well it'll support custom add-ons.
Chrono:
Yeah I seen that function, tested it. It gives the full filepath.
But now looking back at the $PrintNameTable, it includes two parts of the filepath.
Letters/-space
Add-ons/Print_Letters_Default/prints/-space.png
1x2f/keyboard
Add-ons/Print_1x2f_Default/prints/keyboard.png
I could just snag those 2 parts and get it from there.
Chrono:
Easier than I imagined.
--- Code: ---function getPrintName(%id)
{
%texture = getPrintTexture(%id);
%package = getField(strreplace(%texture,"/","\t"),1);
%category = getField(strReplace(%package,"_","\t"),1);
%name = fileBase(%texture);
%return = %category @ "/" @ %name;
return %return;
}
--- End code ---