@lock help?

  • 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).


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

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

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

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

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

  • 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!

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

  • @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 :)

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

  • Tutorialist

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

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

  • Tutorialist

    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

  • @Cobaltasaurus That did it! Thanks!

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

    And then the locks started to work.

  • Tutorialist


Log in to reply