ID:2488037
 
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Right now text macros "\icon" and so on are hidden in BYOND's implementation - unless I'm missing something undocumented.

My answer to that is to request a new meta-proc that handles text macros. The average macro can therefore be translated from "\icon[obj]" into "[TextMacro("icon", obj)]". The reason this is necessary rather than just implementing them anyway is because BYOND calls a few of these internally. According to the BYOND documentation, "An object expression will display the object's name preceded by the text macro \the or \The if no other article has been specified. Capitalization of the article is inferred from context." This behaviour could only be suppressed by implicating the developer into how "\the" is sustained, or always using "[obj.name]". The weakest reason for implementing this, finally, is for the ability to fall back onto the default macros, rather than having `/proc/TextMacro(type, contents, propriety){return "\icon[contents]"} given that . = ..() is marginally faster.

/proc/TextMacro(var/type, var/contents, var/propriety)
if(type = "health")
return "[contents.health]"
if(type = "\icon" && istype(contents, /obj/ThingWithManyImportantOverlays))
return [\icon(GetFlatIcon(contents))] //If the overlays are needed, for example.
. = ..()


If "contents" is an object, the proc will be called on that object and trickle down through inheritance as needed. If it's a basic type, then the root one will be called as above, or default to the builtin version if not specified. This also allows suppressing the builtin version if needed, or even making new macros.

There remains, however, the case of "\proper" and "\improper". I've attempted to resolve this by adding a "propriety" variable that's either TRUE or FALSE depending on how BYOND would interpret it (capitalization if not specified, otherwise as specified, I believe it was). I believe that a builtin text proc "MakeProper(string, propriety)" could also be used to allow modifying string propriety at runtime, though I assume it would also be possible through the following inefficient snippet:

/proc/MakeProper(var/string, var/propriety)
if(propriety)
return "\proper[string]"
else
return "\improper[string]"


tl;dr please make it possible to define text macros or disable them.