MU Soapbox

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Muxify
    • Mustard

    TinyMUX: @descformat and @parent

    How-Tos
    tinymux
    3
    5
    637
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Thenomain
      Thenomain last edited by Thenomain

      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.

      “If you wish to make an apple pie from scratch, you must first invent the universe.”
      ― Carl Sagan, Cosmos

      1 Reply Last reply Reply Quote 1
      • Derp
        Derp Admin last edited by

        @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?

        Racism isn't Tinkerbell. It doesn't need you to believe in it for it to exist.

        Thenomain skew 2 Replies Last reply Reply Quote 0
        • Thenomain
          Thenomain @Derp last edited by Thenomain

          @derp

          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.

          “If you wish to make an apple pie from scratch, you must first invent the universe.”
          ― Carl Sagan, Cosmos

          1 Reply Last reply Reply Quote 1
          • skew
            skew @Derp last edited by

            @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.

            1 Reply Last reply Reply Quote 1
            • Derp
              Derp Admin last edited by

              Oh that! Ok. Thanks! 🙂

              Racism isn't Tinkerbell. It doesn't need you to believe in it for it to exist.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post