MUX: Openly writeable attribute?
-
This week's stupid needed thing: something that would allow someone to add a temporary desc to a room designated as 'off-grid' space, or redesc a rented room with some custom tweaks.
I have seen rooms that will allow this (on shang, for instance, one can add a new desc with a special command to rented apartments) and I recall TR's temproom RP area allowing someone to set a custom desc on the room while it was in use (I may be misremembering this?), so that's essentially what I'm looking for guidance on.
I know more or less nothing about code, so being pointed in a general direction re: where to begin would be a huge help. (If somebody has this handy and is willing to share it or is willing to tinker with some things to create something along these lines, hey, epic, you rule and I'll love you forever•, but not asking for that.)
Super general like 'look at permissions' is unfortunately not going to help me much; I've beaten my head against those walls and it doesn't sink in very well even with very good teachers attempting to explain, but a general direction on this one would be hugely helpful.
• Warning: this means I'll probably end up arguing with you more. Blame my crazy Italian relatives, they taught me this approach.
-
@desc here=[ifelse(hasattr(%!,temp-desc),[u(temp-desc)],[u(perm-desc)])]
&cmd`desc here=$+desc *:@pemit %#=You have set the temporary description.;&Temp-desc %L=%0
&cmd
desc
clear here=$+desc/clear:@pemit %#=You have cleared the temp desc.;&temp-desc %LNow this is a very basic code. But feel free.
-
Faraday's suite has this for PennMUSH for her TP Rooms that might be translatable.
-
Theno's temp rooms have this. Unsure if you could use it on more permanent rooms like hotel/motel/dorm/apartment sorta things.
-
The code above is generic and should work for MUX, though you'd want to set it on an object that can control the room in question so it can set the temp attribute since you can only set attrs on things you own/control.
-
@Seamus said in MUX: Openly writeable attribute?:
@desc here=[ifelse(hasattr(%!,temp-desc),[u(temp-desc)],[u(perm-desc)])]
&cmd`desc here=$+desc *:@pemit %#=You have set the temporary description.;&Temp-desc %L=%0
&cmd
desc
clear here=$+desc/clear:@pemit %#=You have cleared the temp desc.;&temp-desc %LNow this is a very basic code. But feel free.
I'd put in protection since not every codebase sets new attributes NO_COMMAND.
So like:
@desc here=[default(me/temp-desc,v(perm-desc))]
&CMD_DESC here=$+desc*:@pemit %#=You have [ifelse(gt(strlen(%0),0),set description '%0',cleared the description)];&TEMP-DESC me=%0;@set me/temp-desc=no_command -
I did say it was... basic But yeah, speaking to the permissions issue, the room can always set attributes on itself, so as long as the room is !NO_COMMAND the room will run the command. But like Ashen said, probably smart to put some protections in place. I just threw that together on the fly.
-
@Seamus
Cool. And yeah, protection is always good. I don't generally code for MUX so I wasn't sure about control of rooms and such. Thanks for the clarificaiton. -
@Ashen-Shugar Can you explain this? I'm not sure I understand.
If the new command only works "here", and checks that "here" is flagged as a temproom, what would the code you added... add?
-
@skew
Not AS, but... It's meant to be set on an individual room, regardless of whether or not it's a temproom or a normal room, rather than be used globally. You set it 'here' to set it on the room, where it's only usable when you're in that room.temp-desc is the attribute that the command would set. IF there is a temp-desc, the 'look' command displays the tempdesc (IE: a room that had a bomb go off, could have a tempdesc describing it) instead of the normal desc.
If it needs to be global and accessible from only certain rooms, it's tweakable.
-
If you can get your hands on Theno's +temproom code, it's about perfect. I wish it was on every game. It might take some twiddling if you wanted to use it for permanent rooms rather than temporary RP locations, but it still has everything you're looking for.
-
@Bobotron Got it. Yeah, I guess I'd just write a global command to work on rooms I had flagged as "temp".
@gasket We had a real, real hard time getting it working correctly on Fallen World MUX... and that required Thenomain himself to do it. And it's still not working 100% correctly. Note that I didn't install it from the get-go, so who knows what happened along the way, but it's definitely not easy peasy.
-
@skew said in MUX: Openly writeable attribute?:
@gasket We had a real, real hard time getting it working correctly on Fallen World MUX... and that required Thenomain himself to do it. And it's still not working 100% correctly. Note that I didn't install it from the get-go, so who knows what happened along the way, but it's definitely not easy peasy.
Damn. That's really too bad. From a player POV, it was ideal. Obviously the new solution is for Theno to find another six hours in every day and make it work cross-platform out of the box.
-
I know it's been forever since I asked about this, but I finally got this all set up and working and wanted to pass along a thank you to @Seamus and @Ashen-Shugar for their help.
I was able to tweak it just a teensy bit and work a title change for the room in to adjust how it displays on +where and in the room list, too, which I'm hoping will also be helpful.
Thank you again, this was enormously helpful.