MUSHCode for TinyTIM Coding Workshop - Class 4 - Flags

Yes, it's time again for a TIM Coding Workshop, this time part of the "MasterTrack" series (you know coding and want to really nail it down) on Flags. Come on in, just sit in the back if you want, or dive in with the fun. Tonight's Lecturer: Sketch. Beginner courses will continue to be held on Thursday evenings.

Kahlua says "Sketch, if you care, your sign doesn't actually mention where the class is tonight"

Kahlua says "Ho Br'fin, and Patreek."

Sketch would hope people know where now.

Kahlua says "Cool. :)"

Squeaky says "You can get very lost on TIM. A whole lotta rooms."

Kahlua says "Is Pretty Printer feeling better?"

Mara has arrived.

Sketch has had no time to spend on pretty printer.

Kahlua nods.

Sketch will do so, one of these days.

Kahlua hugs Mara. Howdy. :)

Mara hugs kah. evnin

Reo says "By the way, does anyone know a web site they find to be designed particularly well? Efficient?"

Sketch shouts "Coding Class is starting."

Empedocles has arrived.

Sketch shouts "Can't find it, page me."

Br'fin waves

Squeaky gets out the pencil and log-amajig

Zahira has arrived.

Sketch bows to Zahira.

Zahira says "hello :)"

Biff the Wonder Parrot staggers for a moment, hacking and wheezing. After a brief struggle, he coughs up a hairball. He looks confused for a moment, then shrugs and returns to Kahlua's shoulder.

Mara has left.

Biff the Wonder Parrot goes home.

Biff the Wonder Parrot has left.

Sketch gives Biff a new lease on life.

Sketch says "OK!"

Sketch says "Tonight, we're going to try for a slightly shorter class, trying to focus on getting out the info and generally making it so people aren't fighting fatigue and deciding to "wait for it to come out on log"."

Sketch says "We're doing FLAGS. How to use flags to the fullest."

Sketch says "You all understand flags, I believe? Page or whisper if you need a bracer."

Farward(#77523PZc) understands flags in general.

Sketch says "OK, so Flags. Those great things on the end of our database numbers and the database numbers of our things."

Sketch says "We've all figured out by know that they all have meaning in some fashion or another. For example, the P is Player, and you can't change that."

Sketch says "Actually, wizards can't do that on TIM, either. I'm told that some versions of MUSH could let you set someone !P. That's mean."

Sketch says "There's also c, which on Players means "Connected"."

Sketch says "People often want to know information about a room, but don't always know how to get it easily."

Sketch says "There's horrible things you can do with the WHO() function, to figure out players, but that's a big pain in the ass."

Sketch says "Luckily, R'nice added some cool features to the LIST() function."

Sketch says "Specifically, you can list everything with a certain flag. Example."

Sketch says "There you go. NAMELIST is OK, but the problem with it is that if someone has a two word name (and in the case of players, you're safe, of course), then you're going to have a hell of a time making sure that you're not missing something."

Br'fin ponders what he can do with his not-here function to work better :)

Sketch says "For example, as an aside, I believe you'd have to do it like this: SAY DOLIST(NAMELIST(LIST(CON(HERE),+Pc),[edit(##,spaces(1),_)])"

Sketch says "And THAT, is ass."

Sydney says "Does that put spaces in multi-word names?"

Reo says "That's totally child molester."

Sketch says "Yes."

Sketch says "Well, actually, it puts in the _ character in spaces in multi-word names."

Kahlua says "Function (DOLIST) expects exactly 2 argument(s)"

Sketch says "For later removal."

Squeaky says "I got that, too"

Kahlua says "Well. Hmm."

Sketch probably missed a ... Oh, there we go.

Kahlua says "Oh, I think I see."

Sketch says "For example, as an aside, I believe you'd have to do it like this: SAY DOLIST(NAMELIST(CON(HERE),+Pc),[edit(##,spaces(1),_)])"

Sketch says "Sorry, put in LIST after NAMELIST."

Squeaky says "Nope"

Sketch says "Common mistake."

Sketch says "Worked for me."

Kahlua says "That works for me"

Sydney says "Missing a parenthesis."

Squeaky says "I got Edit, edit"

Sketch says "Now, the Flags Function, is useful as well."

Sketch says "If you SAY FLAGS(ME), you'll get your flags listed."

Reo says "Plec"

Squeaky says "Pc"

Sketch says "However, we run into the problem that some of the flags are case sensitive, and then you have to use... THE GREP FUNCTION."

Sketch says "The Grep Function is a real bear. Some time ago, R'nice ported "Grep" into TinyTIM."

Sketch says "This resulted in @grep and grep()."

Br'fin aiees :)

Sketch says "Does everyone here get the concept of 'Grep'? Or should I explain that quickly?"

Br'fin says "Or in other words, the only way to even consider trying to exec myself"

Sydney knows of its existence.

Sydney does not actually know what it does.

Kahlua says "Go ahead and explain quickly, please"

Reo says "It's exactly what I need to understand to fix the logs, I think. :)"

Zahira has left.

Sketch says "Basicaly, to grep something is to look for a specific "regular expression" inside a load of text."

Sketch says "What THAT says is "Tell me everything in my @FIND that has a P as the first letter."

Coolman has disconnected.

Sydney can't get the help on @grep or grep().

Squeaky says "Help grep"

Sketch says "For those of us who are more UNIX-oriented, I would like to point out that the use of the curly brackets, is a TIMism and is required for proper parsing."

Sketch says "Try HELP GREPPING."

Sydney says "Thanks."

Sketch says "Reo, Regular expressions are amazing."

Sketch says "They also are way out of the scope of tonight's class on Flags. But they're worth your time."

Sketch says "Imagine being able to say "Tell me everything in the room that has vowels. {aeiou]}"

Sketch says "Imagine being able to say "Tell me everything in the room that has vowels. {[aeiou]}"

Sketch missed a bracket.

Kahlua says "Ah, natural language commands."

Kahlua says "Cool."

Sketch says "Actually, it should really be {[AaEeIiOoUu]}"

Sydney sees some application for that sort of thing. :)

Empedocles says "Regular expressions are the subjects of whole classes in CS."

Sketch says "But I digress."

Reo says "CcOoOoLl."

Empedocles nods.

Sketch says "So, what's the general opinion on the MARKED Flag?"

Reo says "Never heard of it."

Sketch says "Completely useless flag."

Sydney doesn't really see the point of MARKED.

Sketch says "Doesn't change a thing. You can set it and unset it."

Sketch says "@SET ME = MARKED will not change a thing."

Sketch says "HOWEVER..."

Br'fin says "I've little opinion over the flags with no obious use, like Builder."

Kahlua was just about to set himself marked...

Farward says "You'd then be a marked man, Kahlua."

Sketch says "Imagine you want an easy way to track what things in the Room have been looked at, or which have been picked up and dropped, or have been given some sort of neat aspect in your adventure."

Reo says "Viola, you mark them."

Empedocles says "There is some research going on as to whether or not the MARKED flag causes cancer in rats..."

Sketch says "MARKED works pretty well with LIST(CON(HERE),-P,+M)"

Sketch says "(i.e., Everything not a player, but which is Marked.)"

Br'fin hsms.

Sydney says "But you'd have to set something up to MARK the things which are used in the ways you mentioned. Right?"

Sketch says "Yes. I think in most semi-complicated quests and adventures, you'll find there's a need for some sort of central accounting/setup/checking object/machine."

Br'fin nods "Right at which point why not an attribute used somewhere?

Sketch says "Something which kind of looks the whole place over and makes decisions, etc."

Sketch says "Although to a lesser extent, this can be done with the @DETAILS of the room."

Sketch could see arguments pro and con for the use of something like a DOLIST function to grab the attributes.

Sketch says "Let's try this weird ass one."

R'nice shouts "The Wiz Of Your Dreams is here."

Sketch says "If you set the details of the room to be: switch(list(con(here),-P,+M),0,The room is sad and devoid of treasure.,1,The room is lit somewhat from your treasure.,2,The room glitters from treasure.,3,The room shines from treasure!,The room is blindingly lit from treasure!)"

Sketch says "You have the ROOM doing the work of telling people that 1. Treasure should be brought here, and 2. That there's probably more and more treasure to find."

Reo says "I have a question!"

R'nice shouts "Well, they often call me Speedo, but my real name is Mr. Earl."

Sketch says "of course, anything over 4 pieces of treasure, and it gets to be monotonus, but you were only seeking the 5 sacred Nuts of Sack, anyway, so it's OK."

Sketch says "Sure."

Reo says "Would that detect only your marked objects, or anyone's? Say someone else dropped their marked piece of lint in the room. Would it still see it as 'treasure?'"

Br'fin mmms and nods at the details example

R'nice arrives in a flash of wizardly brilliance!

R'nice has arrived.

Patrick goes home.

Patrick hops into Flounder's car and zooms off to the Food King.

Patrick has left.

Sketch says "The answer is, it would detect all the objects as Marked regardless of owner."

R'nice says "So what are we doing tonight? I can't seem to get in the groove of remembeing the schedule for these things."

Kahlua says "Flags."

Kahlua says "Lots of Flags"

Sketch is using Flags as a jumping off point for lots of crazy stuff.

R'nice nods

Sketch says "But the fact is, Reo, that in a True Quest or Adventure, you would take some severe pains to add some DROP-TOs to the rooms to get rid of crap that isn't relevant to the adventure."

Sketch says "Because it can really be annoying to find out the Platinum Comb isn't actually a part of the way into the castle, no matter where you drop it or use it."

Sketch says "Then again, the insane and masterful art of building a Good Adventure is a whole class in itself, and will be covered in the future."

Sydney yays.

Sketch says "Know how long it took me to make the SNUHventure?"

R'nice says "Class? I think it should be the term project!"

Reo says "40 days and 40 nights?"

Sketch says "2 years."

Squeaky says "No..I got lost in there "

Sketch says "With some severe breaks, I should note."

Farward says "There must be some serious stuff behind the scenes, then?"

Br'fin umfs. "Got all the tech, but none of the scenariop for an adventure"

R'nice says "Well, except sex, of course."

Sketch says "Well, if sex is the project you're taking to fruition..."

Farward figures anything that looks so simple must have taken loads of effort to make look that way.

Kahlua says "Well, yeah, there's sex..."

Sketch says "LOCKS and FLAGS!"

Sketch says "Many flags are affected by the Locks of the objects with the flag, and the players/objects interacting with the thing with the flag."

Sketch says "A great example is DARK and LIGHT flags."

Sketch says "Set a room DARK, and nothing can be seen in it."

Sketch says "...unless something is set LIGHT."

Sketch says "Meanwhile, if you set the room DARK >AND< LIGHT, then the lock on the ROOM determines who can see or not see."

Sketch says "The classic use of this is the old "Need a lantern to see in the room" thing."

Sketch says "Now, a lot of that can be somewhat avoided by using @DETAILS, but the use of DARK and LIGHT and the right kind of lock can make a big difference."

Sketch says "I don't want to go into LOCKs this week (that's next week), but you should definitely be aware that locking a room to a lantern with the standard @LOCK HERE = is not the way to go. We have better locks than that for THAT sort of thing."

Sketch says "Another such flag is the NO_EMIT Flag. If the room is set NO_EMIT, then only those who pass the lock of the room can @EMIT."

Sketch says "KEY! We're so far away from Adventuring these days that we've forgotten KEY."

Sketch says "Simply put, something set KEY will stay in the same room if the person carrying it @TELEports away."

Sketch says "@TELEporting was never really a problem in the old games. This key helps fix that new problem."

Empedocles says "I think it also can't get picked up by puppets, or maybe that's not true anymore."

Br'fin says "IT can't go through some exits I recall"

Sketch says "Some of these Flags go way back, and were intended to stop the problems one would get with a multi-player game that had required objects to solve."

Sketch says "So, I'm sure questions are abounding."

Empedocles says "The desert adventure is a good example of a classic old-fashioned adventure, with *no* MUSH programming allowed."

Sydney says "You said a lot of things can be done with the @details of a room."

Sydney says "How would you use @details to do the 'need a lantern' thingy, for example?"

Sketch says "Well, the most basic idea behind the @details of a room is that it is an EVALUATED ATTRIBUTE."

Sketch says "What this means is, basically, that you could set the @details to be a FUNCTION and have that FUNCTION do work."

Sketch says "By doing this, people are given a description based on what the function things they should see."

Sydney nods.

Sketch says "For example. Type LOOK."

Squeaky nods.

Sketch says "Look at the line after "floor beneath the seats.""

Sydney hadn't noticed that. Neat.

Sketch added it just now.

Sketch says "Now, obviously, when people leave, it stays the same, right? Nope."

Sketch says "That is a function, that is making itself each time it is looked at."

Sketch just typed @details here={You look around and see and .}

Sketch just typed @details here={You look around and see [#69/listing(namelist(con(me),+P))]}

Sydney programmed her @details to show a random Midnight Oil lyric.

Sketch has to fight the parser sometimes. Apologies.

Br'fin says "Parser fighting will presumably be covered in a later class :)"

Sketch says "Parser fighting is a samurai art."

Sketch is going to make you cover it.

Sydney never remembers to double the percents when talking about them.

Sketch says "You have more scares than anyone."

Sketch says "Scars."

Br'fin says "Both are appropriate when referrign to the parser Sketch :)"

Sketch says "When you're building, or looking at your stuff, you often see the flags after your own creations. Useful for building, but not good if you want to get an idea what others will see. Enter NEARSIGHTED."

Sketch says "Setting yourself NEARSIGHTED will take them away when you LOOK."

Reo says "I had that set for months, and had almost forgotten about flags."

Br'fin giggles

Sydney says "Is con the concatenation function?"

Sketch says "No, that's the CONTENTS function."

Sketch says "The contents of a room, or object, or player. (Exits have no contents)"

Sketch is now going to leave the floor open to anything flag or otherwise.

Sketch says "I will say this one last thing: Each of the Flags we have often have different meanings in different situations. And it will behoove you to read the FLAGS literature/Help files, because it rates as the most complete information in the help system."

R'nice says "Note that the con() function doesn't exactly give you the contents, it gives you the *first*thing in the contents. To get the *whole* contents, you use one of the list functions, list or namelist"

Sketch says "Very true."

Sketch raps his ruler on the desk.

Sketch says "WELL then. :)"

Sketch says "Like I said, next week we do locks. Those are going to be something."

Squeaky blinks

R'nice blinks back

Farward says "Locks look like a whole language unto themselves."

R'nice says "They are, unfortunately."

R'nice says "The good news is that you can kind of bypass that and use the old language instead."