Joshua shouts "The MPI class will be starting in five minutes! To join us, do 'luge S2 W1', then 'run MB, MB, hallway, 2'." (Public-shout) Niny'ah has arrived. Niny'ah pants from running. You say, "Hello, Niny'ah." Niny'ah damnit *facepalm* "I completely forgot about the homework Xor has arrived. Xor pants from running. Joshua pats Xor. You say, "That's all right, I've only come up with an idea today, and it was a dead end." Xor sprawls. Niny'ah deer!s Xor Garrison has arrived. Joshua starts to wonder if anyone actually did their homework. >.> You say, "BH did." Joshua oos. Niny'ah's been focused on Kerbal Space Program <.< Joshua ruffs, "The what?" Xor 04. You say, "At least your excuse is better than mine." Xor returns, "I was doing homework just before I arrived!" Xor returns, "...just not for this class." BunnyHugger has arrived. Chitter has arrived. BunnyHugger enters, with a nonanthro Eastern gray squirrel (Chitter) [Chitter(#5713XZ)] walking along next to her. BunnyHugger bounces. Joshua will take it! Claude waves! Joshua waves. BunnyHugger says, "I have my homework!!" Xor returns, "Well, okay!" Niny'ah shows https://dl.dropbox.com/u/33593534/images/KSP/018/HD/Screenshot23.png as her homework excuse pass Garrison waves as he pulls BunnyHugger out of his hat :)" Xor dumps a bunch of polemics about environmentalism on Joshua. BunnyHugger says, "Thanks Garrison." BunnyHugger says, "Also:" Joshua pretends he cares, and gives Xor a C or whatever. BunnyHugger says, "I DID MY HOMEWORK!!" Joshua ruffs, "Yay!" Garrison's homework project was focused on Skyler's deer form...then he went and got himself rebunnied last night... You say, "It's still finished and working." Joshua ruffs, "Does it still work?" Joshua ruffs, "Then it's acceptable!" BunnyHugger waves her Sternlooker. BunnyHugger says, "My first MUF homework also became my first MPI homework." BunnyHugger's Sternlooker looks worse for wear. Joshua smirks, "A reimplimentation is a good way to practice a language, yes." Beltrami has arrived. BunnyHugger says, "Although as a side note, I discovered a funny and rare bug in Sternlook.muf that I'll tell you about after class." Beltrami waves hello! BunnyHugger waves! Joshua oos. "I'd love to hear of it." Beltrami smiles to hte Lord Mayor and Deputy! Joshua ruffs, "Alright, I know BunnyHugger and Garrison have their homework. Am I missing anyone?" BunnyHugger says, "Oh! I also discovered that @mpi is a global! It replaces the MUCK's native '@mpi' command that tells you MPI stats if you're a wizard. Which I didn't realize until I tried to use it on HuggerMUCK." Beltrami waves a hand! Joshua ruffs, "That's correct, BH. It executes MPI with the parseMPI command." BunnyHugger says, "So it won't work on, e.g., FM, you'll get 'That's a wizard only command' or something." Joshua ruffs, "Or prim, rather." BunnyHugger says, "Right... I just didn't realize it wasn't going to be on all MUCKs until I tried it elsewhere." BunnyHugger says, "Sorry, I'm bubbling with excitement about class but I'll be good now." Joshua ruffs, "I can use @mpi on FurryMUCK." Chitter pulls BunnyHugger into a seat. BunnyHugger says, "Oh! Austin told me you couldn't." BunnyHugger says, "He must have been thinking of somewhere else." BunnyHugger says, "I know I can't use it on HuggerMUCK, or rather I can but it does something else." Joshua ruffs, "You can also use @muf on SD. Though I like ProtoMUCK's implementation better." BunnyHugger says, "Right, he told me about @muf." Garrison learned @mpi on FM. BunnyHugger says, "I was surprised by that one. He said he uses it to do calculations on the fly, as a fancy calculator." Austin steps off of the floating disk that carried him up. Austin has arrived. BunnyHugger says, "Yay!" Claude waves. Austin says, "Hi, all. Sorry, was showering and such." Garrison waves to austin. [Beltrami just looked in your direction! (female Balloon Dragon)] Beltrami nodnods. Joshua ruffs, "Ok, so Beltrami got her homework done too. Austin, did you do your homework? Not sure if you're just auditing. I know you know MPI :)" Claude waves to Beltrami! Austin says, "I'm afraid I didn't. I forgot that MPI doesn't do floating point arithmetic so the cute gimmick I meant to devise I couldn't. I'm sorry." Joshua ruffs, "That's ok." Joshua ruffs, "Claude had the same problem." Austin says, "I was thinking of a little Julia set type iterator and if you don't have decimal points there's not much point to doing that." You say, "That would have been too complicated anyway. :P" You say, "MPI just isn't designed for that kind of code." Joshua ruffs, "You have the ability, Austin, to augment MPI here with floating point arithmatic, and you wouldn't even have to recode the C for it." Austin says, "We have?" Joshua nods! "We'll get into how to do that today, in fact. I imagine it's something you know how to do but never thought to apply that way. Joshua ruffs, "Let's start by presenting the homework that did get completed, however. Let's go with the order Beltrami, BunnyHugger, and Garrison. Alphabetical, see. :)" Joshua ruffs, "Garrison has requested we hold off until a certain deer dependency problem is resolved." Joshua ruffs, "At least, for his presentation" Joshua ruffs, "The rest of you can go :)" BunnyHugger looks to Beltrami. Garrison nods "I don't want to hold up the class." Joshua ruffs, "Go and present. Class isn't dismissed. I see you there!" Xor sits back down. Joshua >.> Beltrami nodnods. She walks forward and sets down her homework. Beltrami drops Enlouder. Joshua learns Brian Blessed saw a AUGMENTED CANID! He last saw a BALLOON DRAGON. Claude peeks! Beltrami's tail bounces. Type (en) to learn what Brian Blessed has seen! Joshua learns Brian Blessed saw a AUGMENTED CANID! He last saw a AUGMENTED CANID. BunnyHugger learns Brian Blessed saw a DEVILBUNNY IN FOX-HUNTING ATTIRE! He last saw a AUGMENTED CANID. BunnyHugger says, "Aha." Claude learns Brian Blessed saw a LOLCAT! He last saw a DEVILBUNNY IN FOX-HUNTING ATTIRE. Garrison learns Brian Blessed saw a SCOTTISH FOLD SKUNK! He last saw a LOLCAT. Garrison grins. You say, "Fun!" Beltrami touches her chin. Xor grins. Joshua smiles, "Beltrami, can you show us the code?" BunnyHugger says, "Also now everyone knows I just changed clothes. Thanks Brian." Garrison grins Beltrami nodnods. Beltrami opens up the 3D-BB Joshua's alt, were he still alive, would probably confront BunnyHugger about the ethics of her attire! {null:{with:species,{prop:species,me},{otell:learns Brian Blessed saw a {toupper:{v:species}}! He last saw a {prop:data/lastspecies,en}.,here,#-1}{store:{toupper:{v:species}},data/lastspecies,en}}} Joshua smiles. "Excellent work!" His tail wags. "Alright. BunnyHugger?" Beltrami touches her chin. Beltrami sits down. Garrison applauds Bel, polietly. BunnyHugger applauds. Claude applauds too. Poof poof poof! BunnyHugger says, "Oh, mine... hrm..." BunnyHugger says, "I forgot to make it so everyone could use it. It's actually attached to myself. n.n" BunnyHugger says, "I'll just use it and let you know what it does." BunnyHugger casts a stern moral look at Austin. The stern look is completely ignored! BunnyHugger casts a stern moral look at Beltrami. The stern look is completely ignored! BunnyHugger casts a stern moral look at Chitter. The stern look hits squarely! BunnyHugger says, "Sorry." Chitter sighs. Garrison chuckles "Poor Chitter. :)" Austin sniffs. Beltrami blinks? Garrison whispers, "By the way, I'm back-up logging" to you. You whisper, "Thank you!" to Garrison. Joshua chuckles. BunnyHugger says, "So it's an add-on to my 'sternlook' command. I tweaked the sternlook.muf so that it leaves a property on the action that says whether the last round hit successfully (just a 1 or 0) and then the DBREF, in a string form, of the person it last hit." BunnyHugger says, "So then I incorporated the MUF into an MPI that gives this result:" You cast a stern moral look at Beltrami. The stern look is completely ignored! Your last successful stern look was given to Austin. You cast a stern moral look at Chitter. The stern look hits squarely! You have successfully given stern looks to 4 people since December 8, 2012. BunnyHugger says, "The top two were the time I failed to hit Beltrami, the second two the time I hit Chitter." BunnyHugger says, "And the second line of each one is the MPI working." BunnyHugger says, "Here's the code:" {muf:#21661,{&arg}}{if:{prop:sternlook/lastresult,this},You have successfully given stern looks to {store:{add:{prop:sternlook/counter,this},1},sternlook/counter,this} people since December 8\, 2012.,{if:{prop:sternlook/lasthit,this},Your last successful stern look was given to {name:#{prop:sternlook/lasthit,this}}.,You have not successfully looked at anyone sternly yet.}} Claude nodnods. Somewhere on the muck, Maxia has disconnected. BunnyHugger says, "'sternlook' on me used to just link to the MUF. Now it links to $nothing and the @success calls the MUF via MPI, to ensure the stuff happens in the right order. n.n" Garrison nods Joshua ruffs, "Nifty!" BunnyHugger bows. Beltrami nodnods. Garrison applauds the fox hunting bunny. Claude applauds BunnyHugger too. Xor has connected. Xor has disconnected. BunnyHugger says, "Oh, I found something that seems wrong in the docs, though, as I wrote it." Beltrami nods? BunnyHugger says, "It seems to say 'name' requires that the target be controlled by the owner of the trigger object, and that's not true." BunnyHugger says, "I can run it on any random DBREF I like and see what it is. I had fun doing '@mpi {name:#}' for a while. >:)" Joshua ruffs, "Rule number three of MPI and MUF documentation: It doesn't do that unless you've seen it with your own eyes." BunnyHugger chuckles. BunnyHugger says, "I was shocked because MUF won't let you do that until you get to M2." Joshua ruffs, "I'd tell you what rule #1 and #2 are, but they're undocumented." BunnyHugger laughs. Austin nods. "I'd thought it was a quirk of the @mpi command's permissions but that doesn't seem to be the case." Claude ha ha! BunnyHugger says, "@mpi {name:#10000} is a fun one." Garrison hehs. Joshua ruffs, "I believe that happened when someone realized that number was coming up." BunnyHugger says, "Yeah, see, I theorized it was because the trigger object is '@mpi' which the wizards own. But if I use my own trigger object to do it, it still works." Kona has arrived. BunnyHugger says, "Yeah, there are a few the wizards caught and did like that." Joshua ruffs, "Speaking of which, if you've never used the @stats command, it's fun." You say, "Hello, Kona." Kona's just sneaking in the shadows, shh. Beltrami smiles. BunnyHugger says, "Anyway, that's it for my presentation. Thanks!" Joshua ruffs, "Sorry, the 'stats' command. @stats isn't as fun." Beltrami touches her chin. -- Object Ownership Status for ***** -- Owned: Muck Total: Rooms: 64 Rooms: 5005 Exits: 140 Exits: 14297 Things: 39 Things: 4045 Programs: 7 Programs: 602 Players: 553 Garbage: 97 Total: 251 Total: 24599 Done. Joshua ruffs, "A certain alt of mine owns over 1% of the DB." Austin says, "Shush, Skyler." Joshua ruffs, "When did Skyler get in?" Austin looks innocent. BunnyHugger says, "He's speculating about your alt." Joshua looks around. Does not see? Joshua blinks. Joshua laughs. Joshua ruffs, "No." Austin says, "That's not a certain alt, that's you. 251 things is more than one percent." Joshua ruffs, "Anyway!" Joshua ruffs, "This character only owns 65 items. The alt owns 251." BunnyHugger says, "I have 457 things!" ( Jimmy_Stewart says, "How do you like that Skyler? It's like they can't even see you! ) BunnyHugger says, "Mostly exits." Joshua assures you he is not Skyler :) Kona has 22 things. BunnyHugger says, "Maybe he meant me." Joshua is confused. BUt it's time to move on to the MPI! Garrison peeers at Joshua. Joshua ruffs, "Did we go over for loops last week?" Garrison gets out his bote book and pencils. BunnyHugger says, "I don't think so." You say, "You started to, I think." Garrison note book, even. "I don't think so, Professor.' Beltrami blinks and frowns? BunnyHugger says, "In that case, I just don't remember." Joshua ruffs, "For loops are a bit more complicated of a control structure. They create a variable when you run them, and they're a bit opaque. The example in the documentation is:" {null:{for:i,10,1,-1,{tell:{&i}}}} Joshua ruffs, "Does anyone know, off-paw, what all that means?" BunnyHugger raises her paw. Claude raises a paw. Joshua points to Claude. You say, "That code runs through the numbers from 10 to 1 and prints every one in turn." Niny'ah has 55 total Joshua ruffs, "Right. BunnyHugger, do you have anything to add to this?" BunnyHugger says, "I guess just that 'i' must be a variable it creates as it starts." Joshua ruffs, "Yes. Let's look a bit further at the components." Joshua ruffs, "We have i, which is the variable it creates, and then we have '10' and '1'. The 10 here is what the variable 'i' starts at. When the counter hits '1', it knows it is on the loop's last run." Garrison nods Joshua ruffs, "The '-1' means 'what number to add each time the loop runs'. Since a negative number is specified, we actually subtract." Niny'ah no can has brain today Joshua ruffs, "There is one more thing to note-- the loop is put in a null command. This is because the last iteration of the loop's result is what is returned, and you usually don't need that." BunnyHugger nods. Joshua ruffs, "Try changing around the numbers and see what happens." Joshua ruffs, "Usually, when invoking the for loop, you want to iterate over something in particular. Most commonly, you'll be using 'count'" Joshua ruffs, "You'll start from 1, end with {count:somelist} and increment by 1 each time." BunnyHugger says, "Interesting..." BunnyHugger says, "I tried to cause an infinite loop and it just returned a null string at me. >:)" Chitter pokes BunnyHugger! Beltrami pats herself and holds up two fingers. Joshua ruffs, "Yes. It detects when that might happen and avoids running. Other programming languages don't always do this." BunnyHugger says, "What? I knew it wouldn't do any damage." BunnyHugger nods. BunnyHugger says, "I've caused infinite loops in MUFs on HuggerMUCK that, because I'm a wizard there and so have a really high maxint, actually caused my computer to heat up and get really unhapy." Joshua ruffs, "I think MUF may not even do it, but I don't recall ever having tried." BunnyHugger says, "The infinite loops I caused on MUF weren't quite as obvious, though. I don't know if it might do some basic checking or not." Joshua ruffs, "Let's go with one more loop type, and then we'll get into functions and macros :)" BunnyHugger says, "OK." Beltrami nods. Joshua ruffs, "The next type of loop is the 'while' loop." Joshua ruffs, "Type 'mpi while'" {while:check,expr} This is a looping structure. It evaluates the 'check' argument, and if it evaluates true, then it evaluates the expr argument, and repeats the process. If 'check' evaluates false, then the loop is exited. This returns the result of the last evaluation of expr. Joshua ruffs, "The while loop takes /two/ pieces of code. One which is used to create a true or false value, and one to be executed if the first one returns true." BunnyHugger nods. Garrison nods BunnyHugger says, "I've written these kinds of loops a lot. >:) But not in MPI." Joshua ruffs, "While loops are great in that you can be very flexible in your conditions for the loop to stop. They are bad in that it's very easy to make a function that always returns true by accident." Garrison nods BunnyHugger nods. Joshua ruffs, "It should be noted that there are no 'break' or 'continue' commands like there are in MUF or other languages." You say, "I can see why." Joshua ruffs, "Unless I'm missing something. But anyway, you're supposed to find an alternative way to handle things then. One way you could force a loop to break is to change i's value to be the max value." Joshua ruffs, "But MPI's structure can easily be written to avoid needing 'continue'." Joshua ruffs, "Force a for loop, that is. If you want the while loop to be false, you can handle that in the condition expression. :)" Joshua ruffs, "Ok. Quick detour before we get into functions to explain what 'false' values are in MPI." Joshua ruffs, "As you may need to know this in several situations for if statements, loops, and functions." Claude earperks. BunnyHugger bounces. BunnyHugger says, "I learned this myself writing my program!" Joshua ruffs, "Three values are false. A value that contains only spaces, or has nothing in it is false. A 0 is false. And a \r on its own is false. Who can tell me what's up with that last one?" Austin grins. Claude raises a paw. Joshua points to Claude. You say, "It's also just whitespace." BunnyHugger hrms. "Oh, I didn't know the \r one." Kona mumbles, "Teacher's pet!" Joshua ruffs, "Yes, but \n doesn't work." Joshua ruffs, "What's special about \r that isn't special about \n?" Claude boofs Kona's nose with his tail. BunnyHugger says, "I don't know what they are..." BunnyHugger says, "Isn't \r a new line or something? But what's \n?" Kona says, "\r is a list separator, so an empty item doesn't count as a value." Joshua ruffs, "\r is the escape sequence for a 'carriage return'. \n is the symbol for a 'new line'." Joshua ruffs, "Kona, that's right!" Austin says, "What's the difference between them, Joshua?" Kona sticks out hir tongue at Claude. Nyah. BunnyHugger says, "That sounds the same to me." Niny'ah says, "nope" Joshua ruffs, "There is a distinct difference that goes way back into the old days of computing. Who here knows what a teletype is?" Claude grins. Niny'ah says, "\r would be break - new entry. \n is tantamount to a soft linewrap" You say, "Youngsters these days. :P" Joshua ruffs, "Seems so, Claude. :)" Garrison chuckles Niny'ah gets THOROUGHLY annoyed when people manually linebreak descs, because it's either too long or too short. "I have my screen set to wrap at 84 chars (for puppet compatibility) and some folks have theirs cut at 100 chars Joshua ruffs, "A teletype was one of the earliest computer output devices. It was essentially a typewriter that would type whatever data the computer sent it." Garrison nods. testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing Garrison says, "I always knew watching those old Mary Tyler Moore episodes would come in handy some day :)" Joshua ruffs, "When the teletype needed to push out a bit more paper to make a 'new line', it would use the character \n." Niny'ah says, "each of those ^ is 100 chars long, and I get two "testing" softwrapped to a newline" BunnyHugger sighs. Joshua ruffs, "Let's try to focus, class :)" BunnyHugger says, "This all seems unnecessarily complicated. -.-" Niny'ah says, "sorry" Garrison sorries, "That was how I knew what the device was." Austin says, "Oh, yes, please, Joshua." Joshua ruffs, "When the teletype needed to put it's striker back to the beginning, it used 'carriage return'. So, \n would push out new paper, \r would prepare the device to start typing at the beginning of the new line." Joshua ruffs, "However, in modern times, this distinction is often silly." You say, "Things you do manually on a typewriter." Niny'ah says, "so Line and Break are two different actions" Niny'ah says, " so \n\r would be Line, break" Kona says, "Is this on the test or just a history lesson? o.o;" Joshua ruffs, "While some applications do still use it for different functions, in many places, they do the same thing. In other places, you have to use one or the other arbitrarily." Niny'ah says, "yes" Joshua ruffs, "Just a history lesson, Kona." Joshua ruffs, "One last note on this:" BunnyHugger pricks her ears. Garrison nods Beltrami nods? Joshua ruffs, "Windows machines use both \r\n at the end of each line to make a new line. They are effectively emulating the entire typewriter sequence for new lines. UNIX (and by extension, Mac) machines just use \n. When you get a text file on your windows machine that you /know/ should have multiple lines, but instead is all on one line with the occasional little box character, this is why. It came from a UNIX or Mac machine and wasn't converted." Joshua ruffs, "Anyway, \r is the separator for list items. If all you have in a string is an \r, it's an empty list." Garrison ooohs "Good to know.' Joshua ruffs, "So! Let's get to functions." Niny'ah says, "only if you actually USE notepad, Joshua. (Notepad++ handles those correctly)" Niny'ah thinks Notepad should DIAF Joshua ruffs, "Correct, Niny'ah. It does." You say, "And it should. :P" Joshua ruffs, "One of the most important things about any effective higher-level programming language is the ability to define functions. Most of you are familiar with functions. They allow you to make keywords in a programming language that behave much like the built-in primitives do, but which perform custom actions you specify." Garrison nods Claude earperks. Joshua ruffs, "Let's take a moment to examine the design goals of MPI and reveal something to ourselves about the nature of the language we're dealing with." Joshua ruffs, "MPI needed to be:" Joshua ruffs, "1. Safe for nearly anyone to run." Joshua ruffs, "2. Unable to do much damage if something went really wrong." Joshua ruffs, "3. Easy enough for someone to learn. (The standard for this has changed since its invention. :)" Claude chuckles. Garrison hehs Garrison says, "1 and 2 seem to go hand in hand.' Niny'ah snorts amusement Joshua ruffs, "Real, full programming languages can give you access to something like the computer's memory addresses, or its file system, or its hardware. MPI does not do this. In fact, MPI is a language centered around a collection of commands that have been thoroughly vetted and which provide a layer of separation from the gamers to the system itself." Joshua ruffs, "When you use 'tell', for instance, tell handles putting the string in memory, sending it to the required players, and making sure you have permission to actually tell an object something, and all of that for you. You just worry about 'tell'." Claude nodnods. Joshua ruffs, "These are called 'black box functions'. You know what goes in, and you know what comes out, but you don't know how they handle things underneath, and you don't need to know either. If you had to know, it would distract you from the task at hand." Garrison nods Joshua ruffs, "However, you occasionally run into a problem: Either you want to make your own black box functions that combine the powers of several of the other ones, or you want a new black box function which has power beyond what MPI can normally do." Joshua ruffs, "For the first item, we have functions and macros. For the second item, we have functions that can call MUF, or we can edit the server's source code." Joshua ruffs, "Well, functions or macros that can call MUF, I mean." Claude wrinkles his nose at the mention of editing the server code. Joshua ruffs, "If Austin wants to give MUF the ability to handle Floating point numbers, either he can edit the C to support them, or he can create a series of alternative functions that handle floating point numbers by calling a MUF program or two." Joshua ers, if he wants to give MPI the ability Austin nods. Garrison nods Joshua ruffs, "MPI functions are defined in your code. MPI macros are just like MPI functions, but they have a specific storage place, and they become instantly available to any place up the environment tree." Garrison nods. Joshua ruffs, "Let's look at macros first. You've used them more often than you realize. Austin, could you fetch {looknotify+} for us?" Niny'ah orly Claude earperks. The MPI manual mentions that. Austin says, "Oh, yes, just a second." Kona says, "Wow didn't even know that one.." _msgmacs/looknotify+:{null:{tell:[{name:me}{if:{ne:{name:me},{pronouns:%n,me}}, (a.k.a. {pronouns:%n,me})} just looked in your direction! ({prop:sex,me} {prop:species,me})],this}} Joshua ruffs, "That property is set on #0, which is at the root of the environment tree. This way, it can be used anywhere by anyone." You say, "You likely have it in your desc, Kona. :)" Joshua ruffs, "Most people do. Editplayer here slips it right in. Type 'ex me' and check the line under your 'Type' and 'Flags' listing to see what your description is." Joshua ruffs, "It's likely calling MPI, and looknotify+ is probably in front of it." Kona likes that example. Kona says, "Is there a way to see all the programs in #0?" Joshua ruffs, "Only with a wizard's help." Joshua ruffs, "Wizards can check that propdir, _msgmacs/ on #0 directly." Austin says, "msgmacs lists all the MPI macros, although it doesn't show the code behind them." Garrison nods Joshua ruffs, "Ah, ok. I was also about to say 'some MUCKs have a program for listing them, but I don't know what it's called'. The fact it's called msgmacs is very sensible :)" Kona likes seeing programs like that to see how the MUCK really works. Garrison nods to Kona "It is facinating in its way." Joshua nodnods, "You should read up on the MUF class when you get a chance, Kona. In it, we dissected a database entry." Kona nodnods. Joshua ruffs, "This macro takes no arguments. It's just {looknotify+}" Joshua ruffs, "But often, we'll want to design a macro that takes arguments." Claude nodnods! Joshua ruffs, "To create a macro that takes arguments, you can slip markers for where the arguments should be in the code. {:1} would be the first argument. {:2} wouldbe the second, and so on." You say, "Cool!" Joshua ruffs, "An interesting inconsistency in the documentation states that {:1} through {:9} can be used on a macro. But a function may only have seven arguments. You may wish to experiment later and see if functions and macros really /do/ have different numbers of arguments, or if the docs are wrong." Garrison nods Joshua ruffs, "So, if we wanted to create a function that would combine two strings, making the first string all uppercase, and the second all lowercase, we could do:" @set some_environment_room=_msgmacs/stair_name:{upper:{:1}}{lower:{:2}} Joshua ruffs, "Then, we would just call the function in our MPI as:" Joshua ruffs, "Er, the macro, rather" Joshua ruffs, "As:" {stair_name:Joshua,coyote} Joshua ruffs, "And we would get:" JOSHUAcoyote Joshua ruffs, "Any questions on this or anything else we've discussed so far?" BunnyHugger shakes her head. You say, "Nope.." Garrison shakes his head. Xor has disconnected. Beltrami shakes no. Garrison chuckles at Xor's 'response'. Joshua ruffs, "According to the documentation, a function is handled exactly the same as a macro internally (which is why the argument number question I mentioned earlier is especially interesting)." Joshua ruffs, "You define a function as a matter of course in your normal MPI. It doesn't affect all MPI in the environment, just any script that runs it." Joshua ruffs, "So, if we wanted to do the same thing, but with a function, we would do:" Claude leans forward. {func:stair_name,first,last,{upper:{:1}}{lower:{:2}}}{stair_name:Joshua,Coyote} Joshua ruffs, "trying that shows me I forgot it's toupper." Joshua ruffs, "And tolower. So.." {func:stair_name,first,last,{toupper:{:1}}{tolower:{:2}}}{stair_name:Joshua,Coyote} Joshua ruffs, "There we go." You say, "Amazing. func simply isn't in the MUCK Manual." Joshua ruffs, "Who notices a particular difference?" Joshua ruffs, "Func is there." Joshua ruffs, "mpi func" You say, "I mean the online manual." {func:name,vars...,def} This effectively defines a function in MPI, with the given name, that takes the given named variables. The function is not immediately evaluated, so it needs to be invoked later, to do anything. Here's an example: {func:sqr,val,{mult:{&val},{&val}}} This defines the function 'sqr', that takes a single argument. That argument is stored in the 'val' variable. The function will multiply the value of the number passed to it, by itself, returning the result. It's invoked like: {sqr:10} Effectively, the above {func} declaration is the same as the following macro, and in fact, it's internally handled the same way: _msgmacs/sqr:{with:val,{:1},{mult:{&val},{&val}}} You can define a function that takes more than one argument, but the maximum number of args you can pass to the function is seven. Example of multiple arguments: {func:names,list,numsp,flagsp, {parse:v,{&list}, {name:{&v}} {if:{or:{&numsp},{&flagsp}}, {lit:(} {if:{&numsp},{ref:{&v}}} {if:{&flagsp},{flags:{&v}}} {lit:)} } } } {names:{contents:here},1,1} Joshua ruffs, "The one at rdwarf?" Niny'ah is getting more and more lost You say, "Yes." Joshua ruffs, "Huh. Interesting." Joshua ruffs, "Niny'ah, where are you confused?" Niny'ah says, "not your teaching, I'm just not braining good today" Joshua ruffs, "That's ok, but I'd like to help you grasp a concept if I can. I can take a different approach if a particular concept isn't clear." Kona says, "I'm sort of getting it but I'm having trouble knowing when to use what features.. are there any working MPI programs to study that might use for or func?" Niny'ah headshakes, "I'll read over the logs tomorrow, but i"m just kindalistening without grasping a lot at the moment Joshua nods, "Alright, Niny'ah. You let me know if you have any particular questions later, then. And you can hop on WO as a guest if I'm not on here. I'm often on there. Joshua ruffs, "Kona, sure, there may be. Austin, can you look over the msgmacs and see if you can pluck a good example for us, please? :)" Kona says, "Maybe I can ask Chanspot for the games in the casino.. those seem like they should have some MPI in there" Joshua ruffs, "The 'names' function might be best." Claude hms. {func} might just solve his problem. Joshua ruffs, "I imagine that names has a for loop in it. As for what programs use 'func', I don't think I've personally looked through enough MPI programs to know one off-paw. But I know where one is likely to be found. And I know you could use it to create a sort of MPI library if you wanted to without polluting the environment tree." Garrison nods BunnyHugger says, "So, if you use func... it will affect any MPI that's in the same place... like, if it's on the @succ, it affects any other MPI in the @succ? Is that correct?" You say, "Too bad you can only use {func} in the same list where you intend to call it." Joshua ruffs, "Yes, BunnyHugger." BunnyHugger says, "Got it." BunnyHugger says, "I see how this is the same as stuff one does in MUF." Joshua ruffs, "Here's an example of something you could do. You could create a list that has an MPI macro on each line, and before doing anything, exec this list. That would run the function commands, which would make them available." BunnyHugger says, "Like a lib!" Joshua ruffs, "Er, rather,an MPI function on each line." Joshua ruffs, "Precisely like a lib." You say, "Now, that's smart." Garrison nods. BunnyHugger says, "Neat." Austin says, "Hi ... oh, I'm sorry, I was off making lunch." Joshua ruffs, "Ah, good to have you back, Austin. :)" BunnyHugger was making coffee herself. Austin says, "I'm afraid there aren't any msgmacs macros which use func, though." Garrison chuckles "Did you bring enough for the whole class, Austin?" Joshua ruffs, "Austin, does 'names' use 'for', at least?" Austin says, "Nope. names is a simple little {parse:ref,{:1},{name:{&ref}}} instead." Beltrami blinks. Joshua hmms. Austin says, "Oh, I see why that would work." Joshua ruffs, "Yep. Parse is a pretty cool MPI command that I now know since you just mentioned it >.>" Beltrami nods? You say, "It's (map), essentially." Joshua nods to Claude. BunnyHugger says, "I was thinking it's 'array_interpret'. >;)" BunnyHugger says, "Well, sort of." Joshua ruffs, "It's not, though. Parse is a function that works much like a for loop. Now, if I could find an example of a for loop..." Joshua thinks. "I'll probably just need to contrive one if we can't find one. BunnyHugger nods, looking it over. Joshua ruffs, "Try this:" Joshua ruffs, "Create an action named counter and place it on yourself. Then, link it to nothing and lock it me&!me (you should remember this from the building class :)" Joshua ruffs, "And then sets its fail message to this:" BunnyHugger grins. BunnyHugger says, "Building class!" @fail counter={for:number,1,{&arg},1,{tell:{&number}}} Joshua ruffs, "Then, type counter " Joshua ruffs, "Like counter 10" Joshua ruffs, "It will start from 1, and increase by one, telling you the result each time." Joshua ruffs, "Also, it will tell you the last number twice because the function always returns the last result." BunnyHugger giggles. Garrison nods 510 511 512 (@Fail) {FOR}: Iteration limit exceeded Austin says, "Ah, MPI. Don't ever change." BunnyHugger says, "512 is about what I'd expect. >;)" Joshua snuckers. Joshua snickers, too. BunnyHugger did '1000'. BunnyHugger says, "My log is now awesome." You say, "Hee!" Austin says, "I would too, but from fiddling with MPI as much as I have. 256 or 1024 would be where I'd guess the limits to be if I hadn't experimented." Joshua nods. Joshua ruffs, "Ok. Let's see what else we can cover." Claude shakeshakes. Garrison looks to Claude? Beltrami nods? Claude, sleepy cat. Garrison ahs. Joshua ruffs, "Another thing MPI can be used for is propqueues. Propqueues, for those who didn't take my MUF class and so may not remember, are special propdirs in which commands are run upon certain conditions. These can be used for MPI." Claude ya-a-awns. Joshua ruffs, "I think these will be the last thing we'll cover today. I'm not sure there's much to cover after this, really." Garrison nods BunnyHugger says, "Will there be an exam?" Chitter says, "Hugger loves taking exams, apparently." Joshua ruffs, "Fuzzball doesn't have easy to access documentation on propqueues. But ProtoMUCK does, so let me grab that." Chitter says this with an eyeroll. Joshua ruffs, "I'm sure I could probably come up with one, yes." Joshua ruffs, "Perhaps I'll do that next week to finish us up." Joshua ruffs, "Thank BunnyHugger for your new exam requirement :D" listen - Triggered by notification to the thing or room. alisten - Same as listen, but keeps the ANSI codes. connect - When a player connects. disconnect - When a player disconnects. arrive - When a player arrives. depart - When a player departs. idle - When a player idles. unidle - When a player unidles. look - When something is looked at. login - When a connection is made to the login screen. disclogin - When a connection drops from the login screen. _listen/ = Listen props are limited to a certain level of permissions, depending on an @tuned setting. Typically M3 due to the risks associated with listen props. These are triggered anytime anything is notified to object, be it an in-server message, a @succ, a NOTIFY_EXCLUDE, or even a NOTIFY directly to the object. The contents of the stack is whatever string was heard that triggered the program. The command @ for listen-prop called programs is "(_Listen)" _alisten/ = Exactly like the _listen/ propqueue, except that strings retain their Neon ANSI tags. _connect/ = Connect props are called when a player connects. They can be on the room the player connects in, or on the player itself. The program starts with "Connect" on the stack, the command @ is "Queued event." and the trigger @ is #-1. _disconnect/ = Works just like the connect props, except is run when a player disconnects. The starting arguement is "Disconnect", the rest is the same. BunnyHugger says, "I want a diploma! To go with my MUF one." Claude hmpf! Joshua ruffs, "Fair enough." Joshua ruffs, "Some of those propqueues don't exist on fuzzball. Namely, the ansi ones." Joshua ruffs, "And the idle ones." Beltrami grins. Joshua ruffs, "And probably the login ones, too, but I'm not sure on that." BunnyHugger says, "Wow, so can you put stuff on _listen?" Joshua ruffs, "Yes. I /think/ you may have to prefix your MPI with a & to have it run on a propqueue, however." Austin nods. "It's how the ambient noises and hurl work in the Rose Garden, for one." Joshua ruffs, "Well, those use MUF." BunnyHugger says, "Right, and MUF has to be a high level to use _listen I think." Austin says, "You do, Joshua. That's how the connection count report works. And the e-mail check, when we do fit those in." Joshua ruffs, "Ah, cool." BunnyHugger says, "So I'm pleased you can end-run around that by using MPI instead. >:)" Joshua ruffs, "So yes. If you want to do fun things when people arrive or leave, but don't want to bust out MUF (or don't have the ability to do so), MPI can be used." Kona says, "Wow.. I had no idea non-wizards could do so much stuff." Joshua ruffs, "Really, the only things left for you to learn about MPI are just reading over the primitives, trying them out, and building with them." Joshua nodnods! You say, "I'll try and finish my homework for next time." Kona says, "I want to make a board game with MPI." Joshua ruffs, "MUCKs were designed under the idea that everyone could contribute, and that wizards would help keep the system (and players) in check for the times things might go wrong." Joshua ruffs, "or when something far reaching needed to be made." Joshua ruffs, "Kona, you can do that :)" Joshua ruffs, "If you want to research MPI games..." Kona says, "I do!" Joshua ruffs, "There's a fellow named Algos on FurryMUCK. He's made the Titan's toybox, which is all MPI." Kona says, "I just don't know where to find a good MPI game to steal code from." Kona says, "Okay." Kona says, "Algos isn't on FM anymore. >.<" Joshua ruffs, "What, really?" Kona noses everybody's pockets for loose bits of MPI. Joshua ruffs, "Oh, sorry" Joshua ruffs, "Algus" Kona says, "Yay!" Claude giggles at Kona. "I've just started." Joshua ruffs, "On FM, you can warp to the toybox with 't tt'." Joshua ruffs, "That place is almost all MPI with a few MUF enhancements to bridge the gap (I think.)" Kona says, "Okay good to know." BunnyHugger says, "I heard a rumor that somewhere there's an entire MUCK (or similar) coded in MPI, within FurryMUCK. Didn't you tell me that rumor, Austin?" You say, "Heh." Austin says, "Yes, that's a massive construct I've heard of. I'm not sure whether it's still extant, but at least in the misty dawn of time there was, I'm told, an mpi-coded muck within the muck." BunnyHugger says, "Sweeeeeet." Austin says, "FurryMuck folks would go in and pretend to be humans." Joshua smirks. Joshua ruffs, "Well, you might ask Drew about it." You say, "Tee-hee!" BunnyHugger says, "Joshua, I recently created a character on a MUCK that turns out to be QUITE different from Fuzzball. I figured out that it's something called GlowMUCK. Are you familiar with that type of MUCK?" Xor has connected. Joshua ruffs, "Yes." BunnyHugger says, "It's so different it keeps tripping me." Joshua ruffs, "GlowMUCK is more closely related to ProtoMUCK than to Fuzzball." BunnyHugger says, "The flags are different, at least some of them... and there you have to have a bit to use MPI!" Joshua nods. BunnyHugger says, "I don't even understand how that works!!" Joshua ruffs, "Same with protoMUCK, if that feature is turned on." BunnyHugger says, "I have the bit set, so I don't know what happens if you don't." Beltrami blinks? Joshua ruffs, "It's a bit different:" BunnyHugger says, "The bit is 'M' and is called 'MEEPER.'" Joshua ruffs, "There's M, and M1." Kona didn't realize it was pronounced meepi. BunnyHugger says, "I don't think it necessarily is, but they probably wanted something to be analogous with 'MUCKER'." BunnyHugger says, "I say it like letters, anyways: M, P, I." Joshua thinks BunnyHugger is right on that one. You say, "Hackers like to play with words like that, Kona." You say, "Anyway, guess I can stop the log by now?" Joshua ruffs, "Yep!" BunnyHugger says, "So how does that work, then? If I haven't got a meeper bit, does that mean if I look at someone who has MPI in their desc, it won't run? Or does it mean that the MPI on *my* objects won't run for anyone?" BunnyHugger says, "Thanks Claude!" You say, "Least I can do!" Joshua ruffs, "MPI on your objects won't run, presumably. The goal isn't to break the game for you, just to keep you from changing it." Kona pouts "Life without MPI, how bleak" Niny'ah has disconnected. BunnyHugger nods. BunnyHugger says, "The MUCK I found that has GlowMUCK is Meadows MUCK." Joshua ruffs, "Oh, wow." Joshua ruffs, "No, it disables you entirely from using the MPI interpreter, be it on your stuff or otherwise." BunnyHugger says, "Jeeeeeez." Joshua ruffs, "I just tested it on WO. The description MPI was showing up in rooms the character didn't own." Kona says, "No more look notify!" Joshua ruffs, "And only half of look." Muon - Town Square {wodesc} Obvious Exits: (Na) Naraka Ward, (Sc) Scholars' Ward, (E) Eastside, (SE) Acre, (N) Plains of Bhuma Niny'ah has connected. Beltrami smiles to Niny'ah. Joshua ruffs, "Oh, wait." Joshua ruffs, "Looks like it may be more complicated than that." You say, "That's bound to mess stuff up." Joshua ruffs, "To make it work, I had to turn on the 'mpi_needsflag' tune variable." Garrison nods Joshua ruffs, "Once that was on, I removed the Meeper flag from a character and had him look. This showed what I pasted there, which is why I thought all MPI was disabled." Joshua ruffs, "But..." Joshua ruffs, "When I looked from my wizard character, the MPI was also disabled. And here's why:" (bool) mpi_needflag = no Setting this to yes will make it so that players and objects must have the MEEPER bit in order to parse MPI. When a player has been given a MEEPER bit, they can then set the MEEPER bit on things they own, thus enabling those objects to active MPI parsing as well. Joshua ruffs, "And people who don't have the Meeper bit will still be able to see other MPI, so long as those objects are set up with Meeper bits." BunnyHugger says, "But they can't set meeper bits, is that the trouble?" [Connection froze here.] Garrison whispers, "Don't worry, I'm on it :)" to you. You say, "Okay..." You whisper, "Eh..." to Garrison. Joshua ruffs, "They can set them." Joshua ruffs, "But only if they have one." Garrison nods Joshua ruffs, "And if they lose it, the meeper bits they've set on things should be ignored (though I've not tested this, it fits with how the behavior works for other similar flags)" Joshua ruffs, "Alright. Any other questions you guys have?" You say, "Nope..." Joshua ruffs, "Your homework is just to practice MPI in preparation for the exam however you need to. If you want suggestions on things to build in order to learn, I could give you that." Garrison nods Beltrami nods? Joshua ruffs, "The exam should be challenging, but if you paid attention, you should do fine." Joshua ruffs, "Ah, you want a suggestion, Beltrami?" Kona built a shape-shifting plushie! Joshua ruffs, "That's something like I would suggest, yes. A shape-shifting plushie would do fine. YOu might even have it change its shape whenever it changes rooms." Beltrami nodnods. Garrison nods. Kona will try to think of things with for loops. Joshua ruffs, "Thank you all for coming. I hope you've enjoyed the class, and I look forward to seeing you at the exam." Beltrami touches her chin.