MU Soapbox

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

    @lock help?

    MU Code
    4
    15
    4770
    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.
    • Taika
      Taika last edited by

      Hi! I'm having a bit of trouble wrapping my head around how to lock channels, bboards, and rooms to specific attributes or multiple things (a template attribute and a staff flag, specifically). To complicate this, it seems as though channels and bbs use a much different format than, say, an exit.

      I need to lock some channels and bbs to staff flag and a sheet attribute (be it template or status).

      Thanks!

      cityofshadowsmux.com:2860 // http://cityofshadowsmux.com/index.php/Main_Page

      1 Reply Last reply Reply Quote 0
      • ZekeTheG33k
        ZekeTheG33k last edited by

        What server type are you using? Rhost, Penn, Mux?

        Pay no attention to me. I'm old, jaded and generally unfriendly. I am prone to fits of stupidity, but I am still unique, just like everyone else. ~~ Current President of the Anti-Faraday fan club.

        1 Reply Last reply Reply Quote 0
        • Taika
          Taika last edited by

          Sorry! TinyMUX, Chime's 'Hey Kevin' version.

          cityofshadowsmux.com:2860 // http://cityofshadowsmux.com/index.php/Main_Page

          1 Reply Last reply Reply Quote 0
          • ZekeTheG33k
            ZekeTheG33k last edited by

            If you're using Myrr's BBS. Locks are relatively simple.

            &canread <board>=[u(#DBRef/lockattr,%0)]
            &canwrite <board>=[u(#DBREF/lockattr,%0)]

            For a staff flag lock you can use:
            &lock.staff #123=[orflags(%0,WZ)]
            &lock.staff #123=[gte([match([get(#123/list.staff)],%0)],1)]

            Just basically rinse and repeat for anything you need to check. I hope that helps at least.

            Locks on channels work somewhat similar IIRC. But don't quote me, it's been forever since I've used mux.

            Pay no attention to me. I'm old, jaded and generally unfriendly. I am prone to fits of stupidity, but I am still unique, just like everyone else. ~~ Current President of the Anti-Faraday fan club.

            1 Reply Last reply Reply Quote 0
            • Taika
              Taika last edited by Taika

              so it would be (cause I am slow), &canread (Board object)=[u(board dbref/how X attribute is set on the sheet,%0)] ?

              ETA: a quick bit of help hunting gave me this:

              The join lock for a channel is a normal @lock on the channel object.
              The transmit lock for a channel is a use @lock on the channel object.
              The receive lock for a channel is an enter @lock on the channel object.
              The description of a channel is the @desc of the channel object.

              cityofshadowsmux.com:2860 // http://cityofshadowsmux.com/index.php/Main_Page

              1 Reply Last reply Reply Quote 0
              • ZekeTheG33k
                ZekeTheG33k last edited by ZekeTheG33k

                Ok, let's say this:

                Global Lock Object(#100) - This is a wizard object that you have set inherit to wizard powers and is used to store your generic locks on that are used by a lot of systems.

                Staff: General Discussions(#123) - This is your board object in question.
                Channel Object: Staff (#125) - The channel object for the staff channel.

                &lock.staff #100=[orflags(%0,WZ)]

                &canread #123=[u(#100/lock.staff,%0)]
                &canwrite #123=[u(#100/lock.staff,%0)]

                RE: Channels.
                &canuse #125=[u(#100/lock.staff,%#)]
                @lock #125=canuse/1
                @lock/use #125=canuse/1
                @lock/enter #125=canuse/1

                NOW! This is to say I'm not sure if the @lock can handle @lock #125=#100/lock.staff/1 (I don't think it can, but been a while with mux, they have made a few changes.) So I always referenced "Canuse" on the object and reference the global lock storage object, but this is just my style. You can always keep the locks directly on the object that you want to lock. It's your choice.

                Chargen/Stat Based locks.

                Whatever stat system you're using I would need to know to give you an example, but if you have something like a getstat() function or whatever, you would just slap that into the lock setup I showed above and it should work.

                Pay no attention to me. I'm old, jaded and generally unfriendly. I am prone to fits of stupidity, but I am still unique, just like everyone else. ~~ Current President of the Anti-Faraday fan club.

                skew 1 Reply Last reply Reply Quote 2
                • skew
                  skew last edited by

                  Just another angle to look at this from... This is about BBS, since I think @Seamus nailed the channel locks better than I could have...

                  CANREAD: [or(isstaff(%0),strmatch( get( %0/_bio.posse ), Test ))]
                  CANWRITE: [or(isstaff(%0),strmatch( get( %0/_bio.posse ), Test ))]

                  To break that out, since they're the same... or() is a simple command that's set up like or(thing 1, thing2). If either of those return "1" or "True" it will allow you to read and/or write.

                  Next comes isstaff() ... this is a function that's on the MUX I play on. I'm not sure if it's everywhere, but basically it's a simple test to see if the bit/value/etc is staff or not. In this case, '%0' is the user attempting access. If you are staff, it will return 1 and allow access. If not, it will return 0.

                  Next, strmatch() is a comparison between two string values. strmatch( Thing 1, Thing 2). If they match, it will return 1, if they do not, it will return 0.

                  Next, we have get(), which basically queries an object for the value of a particular attribute. Again, %0 is the one attempting access, and the "/_bio.posse" is something specific to this game. Posses are play groups. So, the get command says "What posse is this person in?" and then that posse is compared against the second value in the strmatch(). If they match, it returns a 1, else 0.

                  I'm not sure it's the BEST way to do it, but it was very easy for me to piece through this all in my head.

                  Hope that helps!

                  1 Reply Last reply Reply Quote 1
                  • Taika
                    Taika last edited by Taika

                    Ah-hah! I had been turning the first set of locks sideways trying to figure a way to work isstaff() into them.

                    Thank you both for the help! I'll give both ways a try to see what will work best with what we've got. I really appreciate it.

                    cityofshadowsmux.com:2860 // http://cityofshadowsmux.com/index.php/Main_Page

                    skew 1 Reply Last reply Reply Quote 0
                    • skew
                      skew @Taika last edited by skew

                      @Taika Just a note on @Seamus' post above... &lock.staff #100=[orflags(%0,WZ)]

                      This is going to create a thingy (technical term) on the global lock object that allows you to call a function that checks to see if you are staff or not, and then let you call that function later to assess whether or not the person attempting to access something is staff. It's essentially what 'isstaff()' does.

                      Just know that this is checking for WZ flags, which I think means wizard. Depending on where you play, you may have different levels of staffers. I know on most of the WoD games it was pretty common to have staffers and then wizards, only giving out wizard status to a staffer who needed to use wizard commands. As such, you might have staff that are not wizards.

                      Edit: The WZ checks for Wizard or Royalty. Generally, staff is set to Royalty, if not given wizard status, so the code should work nicely to check for staff-ness 🙂

                      1 Reply Last reply Reply Quote 0
                      • skew
                        skew @ZekeTheG33k last edited by

                        @Seamus said in @lock help?:

                        RE: Channels.
                        &canuse #125=[u(#100/lock.staff,%#)]
                        @lock #125=canuse/1
                        @lock/use #125=canuse/1
                        @lock/enter #125=canuse/1

                        I'm having some trouble with this. I set &canuse to use [isstaff(%#)], since that should work just fine, and then set the lock, use lock, and enter lock. I can still add the com channel and talk on it.

                        I went a step further and set all the @locks to my own dbref, just to check, and still, it's not preventing my test bit from joining. Any further advice?

                        1 Reply Last reply Reply Quote 0
                        • Cobalt
                          Cobalt Tutorialist last edited by

                          you need to make sure the @cpflags and stuff are set correctly, if you're using MUX.

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

                            @Cobaltasaurus said in @lock help?:

                            you need to make sure the @cpflags and stuff are set correctly, if you're using MUX.

                            What should they be set to? The help file only says @cpflag is used to control if people can/cannot join, can/cannot transmit, and they supersede @lock.

                            1 Reply Last reply Reply Quote 0
                            • Cobalt
                              Cobalt Tutorialist last edited by

                              It's ... been a long time since I bothered locking a channel. So uh, I'm trying to remember.

                              I think you need to do: @cpflags channel=!join

                              skew 1 Reply Last reply Reply Quote 2
                              • skew
                                skew @Cobalt last edited by

                                @Cobaltasaurus That did it! Thanks!

                                @cpflags public=!transmit
                                @cpflags public=!join
                                @cpflags public=!receive
                                

                                And then the locks started to work.

                                1 Reply Last reply Reply Quote 0
                                • Cobalt
                                  Cobalt Tutorialist last edited by

                                  Excellent!

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