Log edited with Logedit 2.7.0pl on Mon May 28 09:41:50 CDT 2007 Editing out: @admin pages Regexp stripping: Logged by Sketch Word-wrapping at 76 ----------------------------------------------------------------------- Sketch @create Tomato Blocker Tokeli flings Potatoes. Viila says, "I'm on 8M and grumble when I have to use the "only" 512k my parents have." Sketch @create * Blocker Tokeli runs up there and steals them both. Tokeli throws them at Sketch. Walker flings No Tomato. Sketch blocks No Tomato, so he gets hit by Tomato. Tokeli HAs. Two ways to beat the system. :O Sketch says, "Okay. Unlike a lot of the lectures, mine is rather ill-prepared. Thankfully, it's a *discussion*, not so much a lecture. Although I'll still be talking quite a bit. I'll shout if I make glaring errors..hopefully Walker and Viila will too. :)" Blue_Guest takes a seat in the Left Second Row. Walker takes a seat on the ceiling. Viila says, "No, no, we're here to correct your glaring errors. ;>" Blue_Guest says, "Nice way to defy gravity." Molikai waits for the MUSH t ocrash, like it did last time. Viila says, "We're of course perfect in every way and never make mistakes..." Walker says, "2+2 is 5." Walker says, "And don't let anyone tell you otherwise." Viila says, "In softcode anyway. Walker makes plenty of mistakes in hardcode. ;>" Walker says, "Keep the faith! 2+2=5!" Sketch says, "Okay. First off... This is a lecture called "String Theory: Coding with Style". The "style" doesn't refer to any degree of awesomeness, but the "style" in style/syntax, which will be discussed later... If I confuse any of you, raise a hand and I'll try to answer any questions that come up. :)" Walker snifles at V. Molikai says, "So noted." Kidney Stoned Time says, ".." Walker completes coding an object, then does a double backflip, shoots the zombie, and finishes with a pirouette. He gets the "Stylish!" score in "Coder May Cry". Viila says, "Will this be logged?" Blue_Guest says, "There are four lights! And there is no spoon!" Molikai is logging. Sketch says, "I'm logging it too. :)" Sketch waves to Time. Lecture here. :) Viila says, "Ok, good. Then I don't have to bother..." Sketch says, "First off, I think it's important to know what 'coding' can be, in terms of MUSHes... There's two categories that encompass most anything you'll do. Hardcode and Softcode. aaaand..." Molikai says, "Sure you do. Redundancy is a virtue. Scripts?" Viila says, "(and regexps.)" Sketch says, "Basics! Basics! ;) (Basics! Ballmer!)" I've been asked this a lot, not so much lately, but a lot in the past. 'What's the difference between hardcode and softcode?' Not knowing this isn't necessarily a BAD thing. Frankly, the majority of MUSHers don't need to know about hardcode. There are much more productive things you can be doing--such as roleplaying, art, and brainstorming--than messing with hardcode. Sketch says, "Ah.. THat was an @emit. Stupid me. :)" Sketch says, "Anyway. In my opinion, the best analogies for"Hardcode" and "softcode" are "hardware" and "software"." Sketch says, "Hardware is the clunky stuff in your computer: The actual plastic box, metal, curcuits. It provides the backbone, interface, and processing power to the programs you run on your computer." Sketch says, "Software is...well, the stuff you run on your computer. Word, Excel, GNU compiler, your IM clients, Internet Explorer, Firefox, Safari, etc... And if you're lucky, a MU Client. ;)" Blue_Guest is reminded.. Matrix says, "And EVE Online, if you're patient enough to play it." Sketch says, "Hmm? Blue?" You will no longer hear messages on channel . Sketch continues... "Most people will never NEED to mess with their hardware--okay, maybe that's not true, but I like to think so. Aside from turning on the power switch (and possibly 'reset'), and plugging in shiny new things, there's very little interaction. You shouldn't have to dive into your case and rewire components every time you want to change your desktop color, for instance." Blue_Guest headshakes. its nothing. Just reminded to look for an SDRAM DDR2 card for the new tower he built last December. And to bugcheck his @descer elsemu*. Sketch says, "Likewise, people never really "NEED" to mess with hardcode--okay, same as last time, this isn't true either. Aside from the occasional (and not-so-occasional) bootup problem, people don't need to go poking around with PennMUSH itself to get their own MUSH running." Tokeli prods Blue. Shaddup. :p Molikai coughs. "SAme is true for TinyMUX, dunno about Rhost or TinyMUSH. Sketch says, "I imagine they're the same. :)" Walker says, "(Unless they're me, and enjoy frustrating M*U*S*Hers by inadvertently causing crashes.)" Sketch says, "As in, you don't need to code your own iter(), or your own attribute-storing system or (god forbid) your own parser. In fact, not many of US know how Talek wrote the parser. .... Anyway." Sketch says, "(The parser is the stuff that evaluates code, BTW)" Sketch says, "Heavy, big thing." Sketch says, "So in short, hardcode is the C code that actually makes PennMUSH what it is. When you type 'say', it's the stuff that parses and shoots that message to everyone in the room. When you use ansi(), it's the code that puts the color there. Most importantly, hardcode is the code that makes softcode run!" Viila says, "(And everything else too. Even poses and such which you do and probably don't think of as code. But they are.)" Sketch nods to Viila. :) Sketch says, "Have I lost anyone yet? If I have, PLEASE say something." SAVE: Snort it. Sketch says, "Or if you just need time to read it... Still alive out there, folks? ;)" Jules says, "braaaaains" Viila directs Jules to Walker. "No wait, no brains there." <-Clock-> HOURLY: Sat Apr 28 16:00:01 2007 <-Clock-> HOUR16: Sat Apr 28 16:00:01 2007 [MECH control box->Sketch] Morning <-Clock-> FOURHOURLY: Sat Apr 28 16:00:01 2007 Sketch pulls out a shotgun and fires at Jules in a fashion that could only be classified as "overdramatic" and "in-jokey". Walker just has tinker toys working in his head. Orange_Guest says, "No problems here. o.o" Sketch says, "For those of you from RP mus, there's no OOC here.. Just speak! :D" Blue_Guest facepalms. "We're all just zeros and ones in here. The matrix has you." Sketch 2 Molikai says, "Green 2? 2 gren? Huh?" Matrix says, "The Matrix is too tired to hold you." Viila says, "I am not a number! I am a free man!" Walker types --> say If you say so, [num(viila)] Walker says, "If you say so, #5530" Viila pouts. Sketch throws away his script. "Okay... We're beyond what I've written previously now." Molikai chuckles. Sketch says, "This could use clarification. What IS code? How can people DO it? I'm not talking about the magic psychocoding, just... code at *all*. :)" Viila says, "Yeah, leave it to the players to ruin the GM's script... *whistle*" Sketch says, "It's really simple, actually." Viila says, "We've demonstrated some nice examples already. Ansi, poses, emits and lots of "say"s." Sketch says, "For the MOST part, code is stored in attributes. Attributes? Things like @desc are attributes. @sex is an attribute, &email is an attribute (&email me=bobdylan@bobdylan.com)" Sketch says, "If you've ever put ansi() in a @desc, that'd be a little bit of coding. :)" Sketch says, "This, too, might also confuse people... Isn't @desc a command?! No, not really. The reason @desc, @sex, @success, @failure, etc. have a '@' in front of them? They're part of the 'attribute table' that defines any particular MUSH's 'special attributes'. So, say, if you were a wizard on a Furry MU (gasp!) you might be able to do something like @species me=Crab." Viila says, "(Incidentally, you can set them with the & method too. Just be sure to not accidentally set a &DESC attribute, the actual name is &DESCRIBE)" Sketch nods to Viila. :) Sketch says, "Anyway. Attributes are nothing but stored strings. I could just as easily have my @desc display the +who to anyone that looked at me. :) Thus the title of this lecture: ALL code in PennMUSH is, in essence, strings." Sketch says, "Questions? Comments? Requests for popcorn?" Tokeli raises his hand. Viila says, "(take note though that +who is a command and when you look at someone, the @desc is only evaluated for functions())" Molikai wishes Girl scout flavour cookies. And I think Boris wants to know the difference between Functions & Commands... Sketch says, "Ah.. I may point out that I couldn't run the *command* +who from my @desc. Only something that would display a +who-like OUTPUT. Yes, Tokeli?" Tokeli says, "Popcorn please." Walker says, "(But it *is* possible to @set your describe attr to !no_command, and use +who off of that." Viila says, "Incidentally, Walker's description here is a changing one. Look at him couple times to see the effect." Sketch says, "You have your own butler, Tokeli. :)" Blue_Guest remembers his softcoding experiences. He didn't know a lot, but what he made did work, though Jules kept saying it was 'bigger' than it had to be. 'Inefficient' or something. o_o Ahem! "Got any cotton candy? Or a soda?" Tokeli does? Sketch says, "Last I checked. :)" Sketch says, "Boris's lecture. Anyway." Tokeli points to Walker. "Get me some popcorn." Then shuts up. Sketch chucks a Shock at Blue. Sketch says, "Yeah, there are ways to make softcoding short and fast, but... That isn't in the scope of this lecture. :)" Sketch says, "Anyway. Here's how to code any command." Viila says, "There are some legitimate concerns about efficiency. But in general, as long as the code doesn't actually run against CPU time limits of invocation limits, it's fine. Some, like Jules, are just over eager in efficiency ;>" Sketch says, "me too. ;)" Sketch coughs. Viila says, "There are some points about readability that are tangential. Code with lots of unneeded [] is unreadable to many, and slightly less efficient than code without." Sketch says, "& =$:" Sketch says, "For any command, that's it. The <> brackets are the names of what go there. An actual example of code might be..." Sketch says, "&dostuff sketch=$do:@pemit %#=HAPPENING!" Tokeli wonders if he accidentally walked into a Coding for Newbies lecture. <.< Sketch says, "Nah. I'm pretty sure you were here on purpose? :)" Tokeli, pwned. Sketch says, "That would @pemit (send a message) to me whenever I typed 'do' into the MUSH. :) Woo." Sketch says, "Do I see any hands? ;)" Orange_Guest says, "Erm, are we supposed to be able to understand that code? I...kinda understand it, but I doubt I'd remember it well enough." Orange_Guest says, "or is it more for example? ^^;" Sketch says, "Well, it would be beneficial for me to explain it. Here's the run-down..." Sketch says, "&dostuff sketch= <-- this sets an attribute on me (Sketch) with the name 'dostuff'. Just like how @desc me= Would change my @desc." Blue_Guest says, "I know what it means." Sketch says, "Or rather, my 'Describe' attribute." Orange_Guest says, "Alright...following so far." Sketch says, "If you wanted to store a URL and forget about it later, you could do something like &rememberme me=http://wwww.youforgotaboutthis.com/" Orange_Guest says, "so the and symbol creates a new attribute?" Sketch says, "It's part of the 'phrase' that makes a new attribute. & =" Orange_Guest says, "okay, I'm following a bit better now. o.o" Sketch says, "Wizards can specify anything for , like, say, other players. Mortals (like most players) have to use items they own--or themselves. :)" Sketch says, "(That's an oversimplification, but the other methods of setting stuff get rather crazy)" Sketch says, "So! The 'dostuff' attribute on me now has the string '$do:@pemit %#=HAPPENING!' in it." Sketch says, "Strings in attributes that start with $ are special. THey're user-defined commands." Sketch says, "The 'pattern' in this command is 'do'. So if I type 'do', the part of the string after the : will execute! --Keep in mind, however, that it executes as a COMMAND. That'll be important, later. @pemit is a command that sends a message to a given object...." Orange_Guest says, "alright, thank you" Blue_Guest ^^ Sketch says, "%# is `the player that triggered the use of this command`. That would be the one that typed 'do'. He or she would then see the message 'HAPPENING!' appear on their screen. Snazzy. Follow? :)" Orange_Guest says, "sorry, mispage" Orange_Guest says, "Yeah, I am. o.o" Sketch says, "Great!" Sketch says, "Note that code won't execute if it's on an object that has the 'NO_COMMAND' flag set on it. Players are 'NO_COMMAND' by default, for reasons of efficiency. You can easily remove it with '@set me=!NO_COMMAND'. Good ol' @set command. :)" Sketch says, "Note: @set me=ANSI is the same command. @set. @set me= will turn that flag on. @set me=! will turn it off." Orange_Guest says, "what does the ! represent usually? o.o" Molikai says, "REmove rather than add." Orange_Guest says, "nevermind" Orange_Guest says, "yeah, just saw the last one. ^^;" Sketch says, "In @set, it means 'not'. :) In a lot of computer languages it means 'not', in fact. Not ALL of them, but enough to make it well-known." Sketch says, "I won't get into the dozens of other symbols. That's not the focus here.. :D Haha.." Sketch says, "Symbols in languages. Not in @set. Okay, tangent.. sorry.. *coughs*" Orange_Guest says, "ah. I've actually never REALLY learned to code before, so I'll be a bit slow. If it becomes apparent this is too advanced for me, just tell me. ^^;" Orange_Guest says, "like, in any language" Orange_Guest says, "...save for HTML, but.." William says, "Swahilli?" Tokeli can code C in Spanish. Sketch says, "Well, I can judge your code, but.. I can't judge your actual skill with learning. If I'm going too fast, tell me to stop! :D" 0xDEADBEEFBAADF00D Time idly wonders if Walker knows where to get Ruby for Windows Blue_Guest can't code in C, VB, of whatever. Except for certain parts, its all nonsensical gibberish. Tokeli says, "ruby.org?" Sketch says, "I wouldn't recommend learning with VB. Won't give you a solid foundation." Sketch says, "Anyhoooow.." Sketch says, "&dostuff me=$do *:@pemit %#=%0" Sketch says, "Don't worry. It's simple. Same code as last time. Our pattern is 'do *'. Match the word 'do', then a space, then anything else. %0 is then set to the value grabbed by that '*'." Sketch types --> &dostuff me=$do *:@emit %0 Sketch types --> do 12345 12345 Orange_Guest says, "the means a variable I'm guessing?" Ari says, "http://rubyinstaller.rubyforge.org/" Orange_Guest says, "...er, the percent 0" Tokeli types --> say The %%0. Tokeli says, "The %0." Blue_Guest says, "In other words: "Heym he typed 'do'! Ooh, it has 'cookies' after it! We'll just say 'cookies' right back!" Sketch says, "As you can see, the %0 evaluated to nothing. You didn't run a command, so the %0 had no value! :)" Matrix kicks his OS around. Tokeli -> &dostuff me=$do *:@emit I like %0 === do Pies! === I like Pies! Sketch says, "Anything with a % is a %-sub. A percent-substitution." Sketch types --> say %p Sketch says, "his" Blue_Guest says, "I like pizza. So? :p" Blue_Guest says, "its" Tokeli says, "help %" Sketch types --> :throws %p hat to the crowd. Sketch throws his hat to the crowd. Blue_Guest catches and chews on it. Sketch says, "'%p' is the 'possessive'." 0xDEADBEEFBAADF00D Time ahems as he was askign WALKER 0xDEADBEEFBAADF00D Time :) Sketch says, "%# is the 'enactor'. --> #9862" Sketch says, "That's my DBREf. Woo. :)" Tokeli says, "Walker doesn't care." Matrix falls out of his chair, asleep. Sketch says, "DBRef = Database reference number. Every object on the game has their own. It's more specific than a name... A lot of code won't even *work* with names--you HAVE to use a dbref. So you'd need to use %# for @pemits, %L for @remits (like in +ooc)" Sketch says, "That, also, is oversimplifying things. You don't HAVE to use %# and %L in the @*emit commands. In fact, you can't make very good code that way. But this is the basics. :)" Sketch says, "Okay... Good->Complex. And Complex doesn't necessarily mean 'good'. Sorry about that." Sketch says, "Everyone? Anyone? Following? :)" 0xDEADBEEFBAADF00D Time says, "Figures" Tokeli runs around the room trying to catch a butterfly. "Wuh?" Trinsec opens an eye. Molikai says, "Most are following, but I suspect the more advanced coders are losing interset..." Orange_Guest says, ":nods" Orange_Guest says, "er..." Tokeli lost interest before Sketch started talking. >.> Sketch says, "It'll ramp up." Orange_Guest nods Sketch says, "Oookay. There's the basics of coding commands. :)" Sketch says, "and now... Words on how NOT to code. :D" Sketch says, "~~~~~~~~" Blue_Guest prepares for spam. And thrown bricks. Sketch says, "That's also invalid. But it was meant to be a paragraph separator. :p" Sketch says, "Okay. @pemit has a functional equivalent called pemit(). Pemit() can be used IN code like...." Sketch says, "Actually, I'm going to use @remit. Which is room-emit. @emit --> @pemit (personal @emit) and @remit (room @emit) and...others." Blue_Guest says, "In fact.. pemit() is more useful in softcode than @pemit." Sketch says, "That's debatable. ;) And I'm going to cover things regarding that." Sketch types --> think if(strmatch(%#,#9862),remit(%l,Boo!)) Boo! Sketch says, "IF ( My DBRef matches '#9862 ) Remit (to this room: Boo!)" Sketch says, "In a sense, @remit and remit() do exactly the same thing. Which has lead to: 1) Confusion. and 2) Badness." Sketch types --> &do2 me=$do2:[remit(%l,boo!)] Sketch types --> &do3 me=$do3:think [remit(%l,boo!)] Sketch says, "The function and command form of @remit do exactly the same thing. So, of course, you might expect both of those to work correctly, and exactly like.." Sketch types --> &do me=$do:@remit %l=boo! Sketch says, "In fact, only that last one is valid." Sketch says, "Historically, all THREE of those have worked. Due to recent changes in the Penn hardcode, only the last two work. The reason for the first breaking is... SYNTAX. I mentioned that earlier. User-defined commands, by nature, define commands. You CAN define functions, and I'll show you how soon, but... << You can't run functions as commands >>" Sketch types --> [ansi(hr,blah)] No command found in code by #9862 - don't start code with functions. Blue_Guest says, "ooh. #-1 PERMISSION DENIED!" Sketch aaah, "The guests can't do it.. Hmm.." :) Viila types --> [emit(foo!)] Sketch says, "Yeah, do that. :)" Sketch says, "That's even better, in fact." Viila says, "It should give you "No command found in code by #5530 - don't start code with functions."" Viila says, "And emit nothing, as you saw from me." Sketch says, "Commands are commands, functions are functions, and they aren't interchangable. Side-effect functions kinda ruin that distinction, and I don't want to argue the difference of commands and functions up here in front of everyone... For now, just... 'believe me'. Sorry for that. It's rather the cop-out. If you're interested on the reasoning, I'll spill my thoughts on it after we're done..." Sketch says, "I may have lost people. Orange, Blue, you still there?" Orange_Guest says, "I'm...very confused, to be honest. I think this is a few dozen steps beyond me. @.@" Orange_Guest says, "I apologize. :(" SAVE: Stick your tongue to it. Sketch says, "Aah. Well, in short..." Sketch types --> &do2 me=$do2:[remit(%l,boo!)] Blue_Guest yawns. Sketch says, "That's invalid by PennMUSH syntax. remit() is a function, and you can't use a function as a command. :)" <-Clock-> HOURLY: Sat Apr 28 17:00:01 2007 <-Clock-> HOUR17: Sat Apr 28 17:00:01 2007 Sketch types --> do2 No command found in code by #9862 - don't start code with functions. [MECH control box->Sketch] Noon Sketch says, "Nothing. I get a warning message to not DO code like that when I try to run it. O:)" Orange_Guest says, "I see. That I got. But what's the difference between a function and a command?" Sketch says, "'do2' is the pattern to match. '[remit(%l,boo!)]' is the would-be command..." Orange_Guest says, "if you covered that already, I apologize. x.x;" Orange_Guest says, "oh wait" Orange_Guest says, "just saw that you don't want to get into it" Orange_Guest says, "my fault. ><" Molikai says, "Commands /deliver/ data to someone: Functions /alter/ data." Sketch says, "Well, that's actually a often-argued point. To be honest, I don't know for sure. It's a little bit vague, honestly." Viila says, "You can spot a function in that it generally has () in it. remit(), pemit(), etc. The technical distinction is more complex." Orange_Guest says, "ah" Viila says, "Anything else is a command." Sketch says, "Well, there's attrib_set(), pemit(), Molikai.. :)" Molikai says, "Special cases! Exceptions! :)" Sketch says, "No, it's different. I'll explain at the end." Molikai says, "And besides. It could be argued they alter data on a higher tier." Sketch sshhh. :) Sketch says, "Okay! Example 2..." Sketch types --> &do3 me=$do3:think [remit(%l,boo!)] Sketch says, "That one." Sketch types --> do3 boo! Orange_Guest says, "since you used think, it allows you, because think is a command, right?" Sketch says, "It works! Yippie! Well, it's a bit devious, though. It isn't 'invalid', but it's just a tad 'yucky'. Exactly, Orange! :)" Viila says, "Correct, Orange Guest." Orange_Guest says, "Yay! Maybe there's some VERY VERY tiny glimmer of hope for me after all. X)" Sketch says, "Thing is... That's not really proper 'style'. 'Style' is the 'how do we DO things?' of programming. In this, there are two points I'd like to make." tramp emerges from the Linux Lobby. tramp has arrived. Sketch says, " 1) 'think Orange_Guest says, "Is number 2 sort of like that general rule to just slightly alter code that people have already put into place while you're abeginner? (referring to HTML and Java)" Sketch says, "It's more a rule of thumb. Usually, you *do not want* to start commands with 'think'. But you *can*, and don't forget that once you're doing something that could possibly warrant it. :)" tibek has to flee. :P Sketch waves. :) tibek waves and runs! Sketch also waves to tramp. :) Orange_Guest says, "hrm, alright" Tokeli has a very hard decision to make... Star Fox 64, or Zelda: Ocarina of Time. Sketch says, "Did that help, or just shoot aside the point, Orange? I have a feeling I didn't answer that one.." Orange_Guest says, "It's helped a bit. I'm not even sure where I was headed with that question, so everything's dandy. ^^;" Tokeli says, "Someone help me decide. :p" Sketch says, "There are a few more things about style that I'd like to cover." Sketch says, "These are more 'concepts' than actual style, though." Trinsec says, "mario carts" Time says, "Cool" Sketch says, "I know a LOT of people (myself included) that want to do things 'THEIR WAY!!!!! FOR THE WIN!!!!!', which is cool and all. Uniqueness is something to show off. However, there is a limit.. It's a tradeoff, really. uniqueness/staying sane." Time says, "Makes me go looking for my N64 emu" Time says, "I prefer: Conquer's Bad Fur Day" Tokeli bahs. Mario Cart isn't worth buying. Time says, "OH! You meant BUY :)" Time goes to cut the grass Jules says, "I thought Time just grew grass, not cut it." Sholevi says, "SF64 was too easy to beat." Sholevi says, "I can finish that gamein 30 minutes." Sketch says, "Recently, a question was asked on the softcode channel here on M*U*S*H, regarding... I believe it was an off-site SQL database, used for a bulletein board system, tied with PHP. Great! However, the person was asking about how to syncronize the systems without using any SQL functions, since they 'lagged the MUSH', and they wanted fast syncronization between the two displays (the website, and the MUSH). I may be mis-remembering this story, but it can still serve as the example..." Orange_Guest says, "Huh. o.o" Sketch says, "The HASSLE created by trying to re-code all the SQL-related functions into a MUSH-and-Website tied script was enough to warrant his asking for help. Had he just, however, used SQL how it was designed to be used, and the built-in functions on the MUSH, it would be a lot easier. Basically...don't re-invent wheels. ...Well, not TOO often, and not for anything 'heavy'. :)" Orange_Guest says, "hee" Sketch says, "An often-practiced design mistake is trying to code something that aligns text in the center of the screen. I've seen globs of math-related code that only manage to hack together three pieces of equally-spaced text in the center of the screen.... But PennMUSH--and TinyMUX, and Rhost, I assume--have a center() function that does *exactly that*." Tokeli prods Sketch. "You went from too simple to too advanced." :p Sketch says, "Aah, I might have. :) My mistake.." Sketch says, "WEll, center()?" Sketch says, "Anyone lost? It's not as bad as it sounds, I promise. ;)" Orange_Guest says, "fair enough. I kinda got it. ^^;" Blue_Guest says, "#-1 FUNCTION (CENTER) EXPECTS BETWEEN 2 AND 4 ARGUMENTS BUT GOT 1" Blue_Guest falls over. :p Sketch types --> say center(abc,78) Sketch says, " abc " Sketch says, "I might as well continue from here. The final mistake is persisting in other mistakes. Two quotes I keep in mind: 'Nothing is more trouble than it's worth to a sufficiently pigheaded coder.'--Don't overcomplicate things. If there's a function that *kinda* does what you want, don't code something to replace it. Code around *that* function--or something related. <-- And keep in mind this is advice, not rules. By all means, be creative and wild, but don't shoot yourself in the foot with work." Viila says, "(help is your friend when you get that error message, BG. ;>)" Viila says, "("help center()")" Sketch says, "And 2: `Why are you using a screwdriver to dig that hole in your yard?` `I LIKE SCREWDRIVERS!`. Pretty much the same idea, here. MUSHcode is a *highly* functional language. You can start with simple stuff, like left(), right(), mid(), pemit()... But if you're going to do complicated things, DO look into more powerful functions." Sketch says, "I'll pause here for a moment. Questions? Comments? Complaints from the front row...? ;)" Viila says, "Snide remarks from the back row? *whistle*" Orange_Guest says, "nope" Orange_Guest says, "not here anyway" Molikai says, "De nada." Tokeli looks up from digging a hole in his chair with a screwdriver. Blue_Guest hasn't done code in like.. years. o_O Blue_Guest was using a car key to do the same as Tokeli. Sketch says, "Okay. This is the intermission, then. I'd like to say one thing, then we'll start *actually coding something*. Or rather, learning how. There are plenty of tutorials online... I'd rather teach something that hasn't been done before..." Tokeli says, "Code a cow." Sketch says, "Sorry. Wrong Sketch. :)" Molikai says, "Attribute trees? @hook? Grep? :)" Sketch says, "Soon, Molikai. :)" Molikai looks hopeful. Tokeli says, "Combat systems? Space systems? :o" Orange_Guest says, "Well, I'd better read those tutorials first...then come here" Sketch says, "Nono, Orange. :)" Orange_Guest says, "hrm?" Blue_Guest says, "Space is.. A pain. Case in point: ATS." Sketch is hoping to make them all more readable, by proxy of this lecture. Orange_Guest says, "oh, k" Tokeli notes the tutorials usually aren't as good as real peoplez. Sketch says, "I hear this, and I hear it *A LOT*. `I CAN'T READ THE HELP FILES!!!`. Woah, people... Take a chill. Okay, there have been multiple reasons cited for this, most commonly: 1) I'm not a coder. 2) They're written weirdly/don't make sense. 3) They don't provide detailed examples." Sketch says, "The help file on READING the help files is 'help newbie'. we should probably move that. :P" Sketch says, "Here's the short of it. For help files on functions and commands, you'll see the name of the command, its syntax, and its description." Sketch says, "The fields (arguments to a function) are surrounded by pointed brackets: . They'll be a good enough hint most of the time... or maybe that's my experience talking. OPTIONAL arguments will be surrounded with square brackets. []." Sketch types --> help center() CENTER() center(, [, [, ]]) This function will center within a field characters wide, using the string for padding on the left side of the string, and for padding on the right side. defaults to the mirror-image of if not specified. defaults to a space if neither nor are specified. If divides into uneven portions, the left side will be one character shorter than the right side. Examples: > say center(X,5,-) You say, "--X--" > say center(X,5,-=) You say, "-=X=-" > say center(.NEAT.,15,-,=) You say, "----.NEAT.=====" > say center(hello,16,12345) You say, "12345hello543215" See also: align(), ljust(), rjust() Tokeli says, "Sketch: Change it to help help" Tokeli :p Sketch says, "That's all I have to say on HOW to read help files, honestly. I admit, they ARE confusing to most non-coders. So..why don't we change that?! Well, there are reasons. I hope they're good reasons." Trinsec thinks 'help newbie' is very aptly named, don't move it. Viila says, "Alias "HELP!" to help newbie ;>" Sketch says, "I'm going to paraphrase something Taladan said recently. Give me a minute to type it all up... :)" Tokeli used to spend -hours- figuring out the help files. :p Okay.. not hours.. more like 20 minutes. Blue_Guest usually got 'buh?' when trying to read ome files. Orange_Guest says, "I get some of 'em fairly quickly, but others...erk" Sketch says, "Remember most help files are written BY coders, FOR coders...but there's a reason behind that too." Sketch says, "To properly address any given topic, you have to know the correct lingo to use in addressing it." Sketch says, "If the help files were written as directed towards those who have never coded before, then:" Sketch says, "1) They'd be long. Potentially, REALLY long. And complex functions like sql() and regmatch() would have books devoted to them. (Actually, regmatch() DOES, but that just proves the point... :) )" Sketch says, "2) They would not describe specifically what the function does. More often than not, in order to address a non-coder audience, they would need to give specific instances to use them in... Which, as I'll be discussing later, is most certainly not the best thing that could happen to MUSHcode." Sketch says, "3) They wouldn't be as useful to people that DID understand them. It's a language to its own. Native English speakers here, imagine if you got placed into a Conversational English course... How much would you take from it? Not a lot. On the other hand, imagine if you were placed into an intensive study of English Grammar. Likewise, the code help files need to be directed towards the code-minded, so that they can pick up on nuances that might otherwise be overlooked...rendering a function useless." Tokeli says, "Skeeetch, it's hard to read everything you're saaaying." Sketch says, "This isn't to say, of course, that non-coders should dive into this. However, the help files might not be the best place to look. The help files are a *reference*--not a collection of tutorials." Sketch says, "Er." Sketch says, "`that non-coders should NOT dive into this`--by all means, discover whatever your heart desires. :)" Sketch will pause here. ;) Molikai can read everything Sketch is saying - but then, I'm british. Orange_Guest says, "What exactly is that supposed to mean? O_o" Molikai just grins. Sketch says, "Wow. I've been here for two hours?!" Orange_Guest says, "more or less. o.o" Sketch says, "When everyone is caught up, nominate someone to raise a hand..." Viila nominates Sketch to raise a hand. Sketch grins. Sketch says, "Okay, NOW we'll start learning... Code stuff. Or rather, a few tricks to know." Molikai nominates Walker. Sketch says, "If you don't know, just guess (or look up) what functions do. Right(), left(), mid(), elements()... first(), rest(), last(), idle()... :) Like I said, Penn has *a lot* of functions.." Sketch says, "But functions represent functionality. Don't try to remember one-for-one what each function does (unless you're good at that), just think 'Oh, I want to chop off all but the first three letters in a string--that's left(,3)' :)" Sketch uses the help files a lot, himself. They're there, so..! SAVE: Dry ice, Coca Cola and Pop Rocks! Sketch says, "Anyway. I mentioned before that everything in Penn is a string. You can see this by doing something rather simple." Sketch types --> say add(1,1) Sketch says, "2" <-Clock-> HOURLY: Sat Apr 28 18:00:01 2007 <-Clock-> HOUR18: Sat Apr 28 18:00:01 2007 [MECH control box->Sketch] Afternoon <-Clock-> QUARTERLY: Sat Apr 28 18:00:01 2007 Sketch says, "Instead of a byte with the second bit set, Penn spat out a 2." Sketch types --> ord(2) Huh? (Type "help" for help.) Sketch says, "Oops. Function as a command. :)" Sketch types --> SAY ord(2) Sketch says, "50" Sketch says, "the character '2' is the ASCII code '50'. All the alphabetic/numberic keys on your keyboard have numbers assigned to them, that's all that means." Sketch says, "Anyway." Sketch types --> say add(1,1) 1+1 Sketch says, "2 1+1" Sketch says, "Penn only evaluates things as functions. (Oops. THat's a blatant lie! Forgive me... But I'd rather not make things confusing yet.)" Viila says, "(Too late! You're talking about softcode... ;>)" Sketch says, "I'll give you something useful to munch on. On a lot of `+who`s, you can see how long players have been idle, in seconds/minutes/hours/days(in the case of M*U*S*H, potentially years...)" Sketch says, "The function that does that is timestring(). Timestring() takes a number (assumed to be seconds) and spits out how many days/hours/minutes/seconds that represents. However, most will only spit out the most significant *two*. After all... If you've been idle for hours, seconds are nothing. If you've been idle for days, what's one more hour?" Sketch says, "er.. day/minute. :)" Orange_Guest says, "I apologize, but I have to leave Sketch. Brother's being a nuisance. :/" Sketch says, "Aaaah. :) Okay." Sketch says, "If it's alright then, I may go a little faster, in order to get to grep() and other higher functions! Cue angel chorus." Molikai says, "You could stay logged on Orange, if you want to look at the results later?" Molikai glares at the Angels until they start singing. Chuck Norris decends from the sky. Orange_Guest says, "sure" Sketch says, "Anyway... THe best way to do this (that I can think of) would be:" Sketch types --> say extract(timestring(12312),1,2) Sketch says, "3h 25m" Sketch says, "Where..." Sketch types --> say timestring(12312) Sketch says, " 3h 25m 12s" Sketch says, "Here's an even more non-obvious example of 'everything is a string'. Given a number, we want to (for some odd reason), figure out the highest-valued number IN that number. That is, the number in the ten's place, hundred's place..." Sholevi is sad that the devs never adopted his convtimestring() function. Sketch says, "I think they did something like that? But with a shorter name. I could be wrong though." Sketch types --> &number me=61233443 Sketch types --> say left(v(number),1) Sketch says, "6" Sketch says, "6 holds the most value. It's the '6' in 60000000." Sketch says, "Blah. I WAS hoping to get to the relations of strings and lists, but... :) I have no target audience for that." Sketch says, "So. @hooks, ne? :)" Sketch says, "~~~~~~~" Jules says, "OH SWEET MERCY A LONG WORM" Jules says, "Oh wait this isn't NetHack. Nevermind!" Viila says, "~~~~~~~W" Jules says, "A wraith with a tail? :)" Viila says, "~~~~~w" Jules says, "A crysknife-and-food-mobile! Yay! Seriously though- continue, Sketch." Sketch says, "Okay, I, personally, was afraid of @hooks the first time I read about them in the help file. Go, look. Be afraid. Who here wanted this topic covered, again? :) *grins*" Viila Viila says, "I've never needed hooks myself, so I haven't even read through the helpfile ;)" Sketch nods. Molikai wants. Sketch says, "Anyhow. There are four things @hook is designed to do. Note `designed`. Only rarely have I seen anyone use them in an obvious and straightforward manner, nowadays...Which is probably another source of confusion." Tokeli notes that hooks are fun. Tokeli @hooks all the commands to give huh. Walker loves them @hooks. Even @ties them to @fishinglines. Sketch says, "In all cases, this is what @hook does. @hook is applied to a command. Either a built-in, or a @command that's been added (most popularly, +ooc). For that command, it checks a specific attribute, on a specific object, and can do one of four things:" Caiti has arrived. Tokeli says, "You're... late!" Molikai says, "For a very important date!" Caiti says, "I sure am! :D" Tokeli wonders which would be better.. Hardcoded OOC, or softcoded. Sketch says, "Softcoded." Sketch says, "There is nothing you can't softcode into OOC that wouldn't be a pain in the butt in hardcode." g++ Viila says, "Everything is better softcoded. ;>" Sketch says, "1) Evaluate the attribute BEFORE the command runs, and don't interrupt. This can do a lot of things.. You can set attributes with it, non-interruptingly counting uses of a command, for instance. 2) Evaluate the attribute AFTER the command is run. This is pretty much the same. They could be used to provide borders to a 'look', perhaps. Or.. Other things. :) Be creative." g++ Viila says, "And more future proof. You don't have to worry about merging custom hardcode hacks when you upgrade the server." Sketch says, "3) Evaluate the attribute before the command runs, and DO interrupt. The built-in command will be ignored if the function in your attribute returns a false value, allowing for snatching up specific cases of commands like... @chat, I suppose. This is often used poorly by those who don't understand it. I cannot, in fact, think of any immediate obvious use for it. Someone? Walker? ;)" Viila croaks like a frog. Sketch says, "1/2/3 are (/before) (/after) and (/ignore), respectively." Orange_Guest goes home. Sketch says, "4) Most often, people want this. (/override). This treats the attribute given to @hook as a *command*. If it matches the command-pattern, then the given object's code is used instead of Penn's hardcode. Or, in the case of @command/adding +ooc, this would be the only way +ooc could possibly run. Penn doesn't have an +ooc command in its hardcode..." Sketch says, "Keep in mind there's a lot of ways to get confused here. :P" Jules's hands stop glowing red. Jules looks confused. Molikai says, "Elucidate on that last one, please?" Sketch says, "Any particular point? :)" Molikai says, "Normally, I write a +ooc, I dump it in the master room, job done." Sketch says, "That's an acceptable way to do it." Jules says, "..and I beat yours with my local copy that I carry on my person." Tokeli says, "Aaand.. you have to redo the @command with every shutdown, don't you?" Sketch says, "Yep." Tokeli says, "Bleh, then it's a crappy way. :o" Sketch says, "I accept your opinion, and will continue with my lecture regarding @hooks. :)" Viila says, "That's why we have @startups ;>" Sketch says, "Molikai: If you didn't want +ooc to evaluate any code, you'd @command/add/noeval +ooc, then @hook/override that to the +ooc object/command you made." ST: Foundation's qa'toq says, "a hardcoded OOC command would be hideous" Tokeli says, "Make one for us, qa'toq. Show us how hideous." ST: Foundation's qa'toq says, "i tried it once, it was not the easiest thing to code, and by the time i had finished, the softcoded version had less code and had more features" Molikai nods, having just read the help file for @command. :) Sketch says, "As I said. There's a lot of ways to get confused with this... :P" Sketch says, "@desc is not a command. You can't @hook on it. Likewise, +public is not a command--The @hook goes on @chat. However, if you check %c, it will still be +public. Yikes." Sketch types --> say In case you don't know, %%c is 'the stuff I typed to do this.' --> \[\[%c\]\] Sketch says, "In case you don't know, %c is 'the stuff I typed to do this.' --> [[teach say In case you don't know, %%c is 'the stuff I typed to do this.' --> \[\[%c\]\]]]" Sketch says, "In case you don't know, %c is 'the stuff I typed to do this.' --> [[say In case you don't know, %%c is 'the stuff I typed to do this.' --> \[\[%c\]\]]]" Sketch says, "Confused? Yeah." Sketch says, "Blah. say Blah. [ansi(r,%c)]" Sketch types --> say Blah. [ansi(r,%c)] Sketch says, "Blah. teach say Blah. [ansi(r,%c)]" Sketch says, "I typed 'blah.' %c evaluates to the whole string of what I typed. That shows up in red." Viila says, "Teacher! Sketch dropped a %c bomb on the room!" Sketch says, "Yeah. AVOID using %c for anything, if you can." Sketch rubs his head. "This is more confusing than thoughtful, so... I'll just drop it." :) Jules say Though I have had one good use for %c. Jules d'oh Jules says, "But that one use it probably all it's good for. XD" Sketch says, "Depends on your definition of 'good'... :D" Sketch says, "Anyway!" Don't ask Jules says, "Why was %c ever put in, anyway? Who thought it would be useful? Hell, who /used/ it? :>" g++ Viila has used it. Tokeli says, "People use it?" ST: Foundation's qa'toq has used it Sketch says, "I think it's in TinyMUD?" Don't ask Jules says, "For...?" Sketch says, "Or I could be lying." g++ Viila says, "My @lock/interact." Don't ask Jules says, "Ah, the ansi-channel-block?" g++ Viila says, "Yeah." Sketch says, "Anyone have questions on @hook? I hope so. I know I haven't answered much..." Despair says, "How does that work?" ST: Foundation's qa'toq says, "%c gives you the original code before it was parsed by the parser" Don't ask Jules says, "Still can get around that, but it's good first-layer protection. qa'toq, what did you use %c for?" Don't ask Jules . o O ( %c for? c4 ?) ST: Foundation's qa'toq used it as a replacement for getting people to use 'lit()' around their code Don't ask Jules makes a 'huh?' face. Molikai says, "Can you give an example of use? :)" Sketch says, "Like in +ooc, just do rest(%c)" ST: Foundation's qa'toq says, "yeah" ST: Foundation's qa'toq says, "that way, you can do noeval stuff without doing the whole @command thing" Despair would like to ansi block channels.. How did you incorp that into @lock/interact? Sketch says, "Despair, clarify what you mean by 'ansi block'. Viila *removes* ansi..." ST: Foundation's qa'toq says, "i would imagine Viila grabbed what the person typed using %c and then stripped the ansi from it and sent it onto the channel" Sketch says, "Example of use..." Despair says, "Thats what I mean." Sketch says, "An obvious example is... @hook/override @chat=#11414/hook.chat. :)" HOOK.CHAT [#9862R]: $^@chat((?\:/\w+)*) (.+?)=(.*)$:@break eq(1,words(setr(c,elements(graball(channels(%#),%2*),lnum(1,mul(hasflag(%#,CHAN_UseFirstMatch),100))))))={@nscemit/noisy %qc=u(hook.chat_do,%0,%1,%2,%3)};@nspemit %#=switch(word(%qc),0,CHAT: No such channel.,CHAT: I don't know which channel you mean.%rCHAT: Partial matches are: %qc%rCHAT: You may wish to set the CHAN_USEFIRSTMATCH flag on yourself.) Despair only knows how to completely block out messages from people.. not change a message. g++ Viila says, "The lock/interact has a complex regexp to match all the ways you can chat on channel which it runs against %c to see first if the user is talking on a channel. If he is, the lock returns 0 and forbids me from seeing the message. Then it pemit()s me with a reconstruction from parsing the %c." ST: Foundation's qa'toq says, "soo, instead of using %0, grab the user input using %c and then use regedit to remove the crap you don't want" Sketch says, "If you meet criteria, it alters your speech on channels. We use this for special events, like Halloween, April Fools, and whenever a Pirates of the Carribian movie is released." Despair says, "Ohh..." Sketch can't spell. Sorry. :) Despair will have to experiment with that.. though my knowledge of regexp is still limited. Jules fondly recalls You're-Forced-To-Talk-Like-A-Pirate Day. Taladan says, "This looks suspiciously like a softcode discussion" Blue_Guest peers. Sketch says, "Note that +pub will be transformed into @chat pub= by the command parser, in a manner that is beyond the scope of my knowledge. :P" Viila says, "Arrrr. And ye be experrriencing it agin on Septemberrrrrrr 19th." Despair says, "You are correct my dear Watson." Molikai says, "Scottish pirates?" Tokeli arrrs. Hooray, matey. Sketch says, "Heya, Blue. :)" Sketch says, "Molikai, anything else?" Dr. heh Dr. Jeckle tries again:P Molikai says, "Not that I can think of at 1 am. I'l hit you u pwith questions in a day or so, probably." Sketch says, "Great! Let's see.. Next up is grep() and its family... These can be a bit confusing. Even to me. :P" Tokeli says, "Now it's right." Sketch isn't the best at remembering stuff, though. Sketch says, "Grep(), regrep(), and wildgrep() do this: Given a single object, and a pattern of attributes (ex: data`**)...Given a PATTERN, return a list of attributes that match." Sketch says, "grep() can be subtly frustrating at times... :P" Sketch types --> &attr`1 me=abc de 1 de1 Sketch types --> &attr`2 me=de1 1 Sketch types --> &attr`3 me=abcd Sketch types --> say grep(me,attr`*,d) Sketch says, "ATTR`1 ATTR`2 ATTR`3" Sketch says, "They all contain the letter 'd'! That may or may not have been what you wanted. It's more intuitive that you'd be searching for a single *word*, but grep() searches for a *string*." Sketch types --> say grep(me,attr`*,bc) Sketch says, "ATTR`1 ATTR`3" Sketch says, "And this has tripped ME up countless times." Sketch types --> say grep(me,attr`*,*d*) Sketch says, "" Sketch says, "There's no string '*d*' in ANY of my attributes. :)" Sketch types --> say wildgrep(me,attr`*,*d*) Sketch says, "ATTR`1 ATTR`2 ATTR`3" Caiti says, "" Sketch says, "Hopefully that covered most of the bases of -what- grep is... I'll try to demonstrate a potential use. Mostly, I see use for it in large database-style objects." Sketch says, "Actually, I don't have an example prepared. Blast. :/" Sketch says, "I can't easily demonstrate a use, either. We'd need another lecture for that... Heh." Sketch says, "I think it's also worth mentioning the @grep command. It's often-forgotten. Fantastic for searching out lost @descs or code fragments on yourself. :)" SAVE: The database gets its hands on a pound of dry ice. What mayhem can it wreck? Sketch scans the crowd for questions... If not, we'll move to attribute trees... <-Clock-> HOURLY: Sat Apr 28 19:00:01 2007 <-Clock-> HOUR19: Sat Apr 28 19:00:01 2007 [MECH control box->Sketch] Afternoon Sketch says, "Okay... Trees! An excellent and confusing construct, and we're still working on them... :) Anything in particular that anyone would like to know?" Molikai says, "What are they?" Sketch says, "I constructed a tree earlier, actually. I have an attribute tree called 'attr' on me. Attribute trees are just attributes with other attributes 'branched' under them. Like folders on a file system." Sketch types --> say lattr(me/attr) Sketch says, "ATTR" Sketch types --> say lattr(me/attr`) Sketch says, "ATTR`1 ATTR`2 ATTR`3" Sketch says, "The forward-quote character is a 'branch' character in an attribute name. :)" Sketch says, "It's on the tilde key on most (English?) keyboards." Tokeli says, "This one. `" Molikai can't see it on his. Closest I can find is ' Tokeli says, "Above tab." Molikai says, "Ah-hah `" Sketch says, "Yep." Molikai's Tilde key is /waay/ over on the other side of the keyboard, as is typical in this country. Ide goes home. Ide has left. Sketch says, "Attribute trees are *entirely* for organization purposes. They have a number of properties that might boggle those unfamiliar with them. For instance, only the root of a given tree will appear if you do an lattr(/*)." Sketch says, "Just like typing 'dir', looking at a folder in explorer, typing 'ls' on a Linux console..." Sketch says, "You only see your current level. :D" Sketch says, "Well, I shouldn't say that. You only see the level you *ask for*. Which could be multiple levels. attr` or attr`* will show you all attributes branching off another. So wildcards aren't 'match EVERYTHING!!' anymore. In other news, '**' is our new 'match EVERYTHING!!' sequence, for attributes..." Molikai says, "so what is * now, then?" Sketch says, "It will do a wildcard-match in the given boundries. Between ` `s, you might say..." Tokeli omgs. He forgot how to examine an attribute on an object. ;; Tokeli frowns. Either he forgot, or exa `* doesn't work anymore. Walker says, "You need your /" Tokeli d'ohs. Tokeli feels incredibly stupid. Tokeli yays. Tokeli has never forgotten that, in 3 years. :/ Sketch says, "Given this: a`1 a`2 a`3r a`3r`quit a`3r`quirky" Sketch says, "--> lattr(a`*) will return: A`1 A`2 A`3R" Sketch says, "(Warning: Invalid use of lattr()... )" Sketch says, "Requires an object. :) Sorry." Sketch listens to crickets. Yikes. Tokeli says, "You lost us." Tokeli says, "We require money and fireworks to be brought back." Sketch says, "Previously, lattr(me/a`*) would have returned a`3r`quit and a`3r`quirky, as well." Jules says, "C++. Is it possible to store structures that haves strings in a binary random-access file?" Sketch says, "Structures can't have strings." Jules says, "Or should I just spring for char[] ?" Jules says, "Say what? I've put strings in a structure before and it works fine. o_O" Sketch says, "Really? Hmm." Jules says, "(Which confuses me, but hey.)" Sketch says, "Answer: Yes, but not without extra work." Scheming Viila says, "Don't store structures on disk." Sketch is not explaining this very well. Hmm. :P Jules says, "Binary file? Shouldn't I be okay?" Scheming Viila says, "As for contain strings, there's no problem to have any kind of datatypes in a struct. Even other structs." Scheming Viila says, "No. Don't store structs on disk." Molikai suggests: Create an object we can look at with an attribute tree on it, set it visual, toss commands at us and tell us to experiment. Scheming Viila says, "1. all the pointers will become stale. 2. the binary data depends on your code and compile options. If ei'ther changes, the data will be corrupt when you read it back." Jules says, "It's part of the assignment. There aren't pointers, and my compile options are the only that will ever be used. This is just homework, not real-life stuff. It's good to know that I wouldn't normally do this, though. :)" Scheming Viila says, "Write a function that stores and reads the struct in known format as plain datatypes. Ints, bytes... Or since you're using C++, download Boost library and use the serialization which does all the magic for you." Sketch nods. You feel a great relief as you may leave the stage. Sketch comes down the few steps from the stage. Debian Hall(#2548RaJ) / /^\/^\/^\ \ |"""""""""""""""""""""""""|~~~~~~~~~~~~~~~|"""""""""""""""""""""""""| | LECTURER |~~)~~~~~~~~~(~~| TOPIC | | |~~) (~~| | | None |~~) ___ (~~| None | | | |~~) Y (~~| | | | |_________________________|\___ | ___/|_________________________| | |/ (_ (_ (_ (_ (_ \|==\_____/==|/ _) _) _) _) _) \| \ (_ (_ (_ (_ (* \|___|/ *) _) _) _) _) / (_ (_ (_ (* (* _) _) _) _) _) (_ (_ (_ (_ A _) _) _) _) (_ (_ (_ / \ _) _) _) (_ (_ / \ _) _) (_ / \ _) / \ do: -help lecture Present: Caiti, Tramp, Sholevi, Trinsec, Jules, Walker, Blue_Guest, Molikai, Viila, Tokeli [[ Debian Hall(#2548) owned by 101ZMP(#1119) ]] Created: Object #11536. Scheming Viila says, "Incidentally, an extension is "don't send structs over network". ;>" Sketch types --> &root tree=stuff goes in here. Sketch types --> &root`1 tree=Item one... Sketch types --> &root`2 tree=Item two... Sketch types --> &root`3 tree=Item five... WAIT THREE Scheming Viila says, "Same caveats apply as stuffing them into files." You drop Tree. Tree - VISUAL set. Sketch says, "Okay. :)" Scheming Viila says, "Are the strings stl::string or char arrays, BTW? I haven't tried, but I imagine stl::string (containing lots of pointers inside ;>) will not take kindly to being written to disk." Scheming Viila says, "Really, what you should be doing is writing a function that saves and loads the struct, or using a library that does it for you automatically." Tree(#11536TVn) Type: THING Flags: VISUAL NO_COMMAND Owner: Sketch(#9862POWweAC"c~) Zone: *NOTHING* Ducats: 10 Parent: *NOTHING* Powers: Warnings checked: Created: Sat Apr 28 19:24:45 2007 Last Modification: Sat Apr 28 19:27:28 2007 FUN [#9862`]: Functions go under here ROOT [#9862`]: stuff goes in here. Home: Debian Hall(#2548RaJ) Location: Debian Hall(#2548RaJ) Faceless Walker says, "Also, nethack is in C, not C++." Scheming Viila says, "bool save_me(file,struct) {cout << struct.my_int << struct.my_char << etc; }" Scheming Viila says, "You shouldn't be saving structs in C either. That's why NetHack breaks horribly ;>" Sketch says, "Another notable characteristic of trees is that all restrictive attribute flags travel downward through the tree. So if the top is no_command, all the attributes below it are too--you can't do anything about that. This is great for consolidating a bunch of non-changing IC attributes on players for RP MU*s. &IC`UNALTERABLE`, and @attribute/restrict/retroactive ic`unalterable=wizard" Sketch says, "My primary use, however, is doing something like this:" Sketch types --> &data`seriously`<4000 attributes under here> I can't see that here. Sketch says, "&data object=Don't look at this!" Sketch says, "&data`seriously object=No, really, there are *4000* attributes under here..." [Blue_Guest:] Blue_Guest says, "I'd say "for the sake of your sanity, don't look at this. It's full of spammy crap." o_o" Sketch says, "and then if they actually examine all the 'leaf' attributes on that, they do so at their own risk. Instead of, say, having an object called 'database' which would spambomb anyone that accidentally 'ex'd the object--or looked at it expecting to see just the code." [Molikai:] Molikai examines it. Understands * and ** and '. Looks fine t ome. [Molikai:] Molikai says, "And the tree doesn't appear to have any leaves." Sketch says, "'leaf' is just the term for the lowest node of a tree... I suppose, then, normal objects would mostly be 'leaves'. But then we're just making confusing terminology. :P" Sketch says, "Or *I* am." Sketch says, "Only trees have leaves. If it's just an attribute, it's just an attribute. XD" Sketch says, "Anything else? :)" [Molikai:] Molikai says, "How will gre pinteract with trees?" [Molikai:] Molikai says, "Grep." Sketch says, "The first two arguments of grep() and its family are an lattr(). :)" [Molikai:] Molikai says, "Point. :_" Sketch awkwardly stands here.. :D Sketch says, "I guess that wraps up the discussion, then! Woo... I've kept you for enough time. THanks for coming!" [Molikai:] Molikai grins, then kills the log in 3 and 2 and 1.. [Molikai:] The log is a corpse. [Viila:] Viila chuckles. [Sholevi:] Sholevi assassinates Sketch from the balcony as soon as the cameras go off.