TinyMUX: @descformat and @parent
-
Summary: When you use @descformat on an object you're @parenting to, TinyMUX runs the space-compression algorithm.
After years of frustration on this, @Chime overhears my complaining and comes up with the solution that works:
&fn_roomcenter #5=[repeat( %%b, floor( fdiv( sub( %1, strlen( %0 )), 2 )))]%0 &fn_roomspace #5=repeat( %%b, %0 )
You're going to encounter this because you have a room parent that you want the game to look nice and pretty on, but sometimes you want to center things.
Thanks to her, now you can!
If you installed with SGP, your function object is #5. Throw the above two lines on it, @restart, and use those on rooms connected to a room parent and only those.
I do not know what would happen if you pass the description through more than one parent.
Explanation:
@descformat renders the code and passes it to the %0 for the special formatting. Apparently @parent is rendering it again. So if the space is escaped once, it will render on the second and come out properly.
Tab (
%t
) still processes correctly, for some reason. It's just multiple spaces that get crunched down to one. -
@thenomain said in TinyMUX: @descformat and @parent:
When you use @descformat on an object you're @parenting to, TinyMUX runs the space-compression algorithm.
While I am glad we got a fix for this, I .... also don't know what this means! What does this mean? How was it breaking? I assume this has something to do with it not centering things?
-
It means any more than one space gets compressed down to one, like if you typed:
think this is a test.
Would return ‘this is a test.’ That is space compression. So a room description containing:
center( Welcome to Night Vale, 80 )
Would, no matter what you wanted from it, return:
Welcome to Night Vale
No centering, just one leading space. The same thing happens with space() and %b but not, for some reason, %t, which must be passing the ASCII tab character to the client.
-
@derp To expand on that... you can use a
@descformat
in the parent room that the child rooms pulls. Which means, you set up "stuff" to appear in the parent room, it appears in all the child rooms.A quick example would be, say, you wanted to have "stats" for a grid square, which included... safety, resources, etc. You set it on the parent and it displays on each child. You don't need to add it to each child.
Just the same, for a player parent, you could set the descformat to include something like what Fate's Harvest had in
+glance
, with your height, weight, etc, to be in the descformat. Then a player sets their desc (description in long form), and when you looked at them, you'd see the descformat automatically, then the long form desc.Only, as Theno explains, it was eating all the spaces and so instead of
Eyes: Blue Hair: Brown
It would come out
Eyes: Blue Hair: Brown
Hope that helps.
-
Oh that! Ok. Thanks!