fodonut

a little bird says, "Hi, and welcome to the third installment of our programming series. In this lesson, We will be discussion such impressive words as 'Permissions', 'Parents', and 'Fertility'." a little bird says, "This lesson assumes you know NAAATHING except for the information you gleaned from Lessons one and two. This lesson requires you to have a donut, with the :eat and :bake verbs on it, so if you check your 'inv' and don't see one, quickly re-run through the first two parts and whip one up." a little bird says, "Ok. Party on! I'm shure you have been the talk of the MOO, impressing all your friend with your witty box o donuts with those fancy verbs on them. I'll bet a few of them even went, 'Man, I wish I had a box of donuts for my very own'. Well, by the end of this lesson, You will be able to show your friends how to make their own box, with a simple '@create', and let them benefit off of your POWER-PROGRAMMING-SKILLZ!" a little bird says, "OK. We have a few general topics we need to talk about before we can just run off and start a codin'. TOPIC NUMBER ONE: Parents. In our first lesson, we explained that when you '@create $thing' the MOO makes a 'copy' of a $thing, for you to play with. Lets talk about what REALLY happens. a little bird says," We are going to look at the MOO as a country. There are a ton of different people, places, and things all of which, are different, yet..strangely the same. Everything on the moo has a parent. What does that mean? That means that anything you look at, it will be 'descended' from something else, inheriting all of its characteristics (verbs and properties, for those of you in rosilita) from its 'parent'. Now, That concept is easy enough...but did it strike you that a parent can also have a parent? This inheriting business is cumulative. So if you have a small rock, who has the parent of a rock, which has a parent of a $thing, which has the parent of a #1, then not only is your small rock going to have the verbs and properties from rock, but also from $thing and #1 (btw #1 is the 'root class' everything's is a descendant of it)." Ragabash says, "So, in essence, when you create an object, it has access to all the verbs and properties that are associated with all of its parent objects. To get an idea of this, type @parent me. It will list a bunch of object numbers and names. The first one is your parent object, the next is that object's parent object, and so on. Since your character is a 'descendant' of all of these objects, you have built in access to all of the verbs on all of the listed objects! The effect is having all the verbs on these objects, without the oogy mess of programming them yourself! That is how the moo concept of parenting works--you are considered a child of all of your parent object's parent objects. The idea is like a real family. You are not only related to your parents, but to your grandparents, great grandparents and so on. That is how you wound up with great granma's bizarre nose, so deal with it. But on a moo, it is beneficial." Ragabash says, "The next concept we will discuss is Permissions. You learned before that information is stored on objects in properties like a filing cabinet. Permissions are also stored on an object, but their purpose is different. Permissions define who can use an object or verb. When you create an object, the owner of that object is you. You may name it anything you like, describe it in any way you please, no matter how twisted and disgusting. Also, no other player (besides a Wizard) may change these things. This is ensured by permissions. If you have already created an object, type @show . If you have not created one, review the section on creating objects and then type @show. This is a useful utility, because it tells you the object number, parent object, location, owner, permissions, verbs and properties for any moo object. Ragabash says, "When you @show your object, look at the area called "Flags". This is the string of "permission bits" for that object. In plain English, each letter you see represents a different type of permission. For objects, you may see the following letters in the "Flags" area: "r" -- means that the object is readable. Any programmer may read the verbs and properties on this object. "w" -- means that the object is writable. Any programmer may add or remove verbs and properties on this object. Keep in mind that "r" and "w" only apply to OTHER programmers--the owner of the object may read and write to the object regardless of these permissions. "f" -- means that the object is fertile. This indicates that the object can be copied using @create, which passes its verbs on to the child object as discussed above. Ragabash says, "If you do not see all these letters in the flags area of @show, don't worry. That is how the system tells you whether or not these permissions are in place for the object. If you do not see one of the letters, then that permission is not enabled. For instance, if you do not see the "f" in flags, then the object is not fertile, and copies cannot be made of it using @create. Likewise, if "w" or "r" is not there, then the object is not publicly readable or writable, respectively. the breadman says, "Ok. Lets play a little bit with that permission knowledge we just dropped on ya. Since our box o donuts is such a TOP-PRIORITY-TECHO-SECRET, we are going to lock it down, lest some other programmer try to steal your verbs you worked so hard to write!. Type '@verbs box' (assuming you named your box of donuts 'box'). This is going to show you a list of the verbs on the object." the breadman says, "Ok. Now, we are going to remove the R(eadable) bit from the verbs, so that others cannot steal them. First, type '@show box:bake'. Notice the R bit is enabled. Type '@chmod box:bake -r'. Repeat that process for all the verbs you have created on your box. This removes the R bit from the verb. Now that you have done that '@show box:bake' and confirm that you removed the bit." the breadman says, "When other people type '@verbs box' they will see 'E_PERM' instead of 'bake'. E_PERM is the MOOs way of saying 'ERROR_PERMISSION_DENIED'." the breadman says, "OK. Lets look at some of the other permission bits. 'W' is one we will talk about.. but I want you to understand that W IS A BAD THING. Sometimes, it is the only way to do something, like letting your friend work on a verb your having trouble with... But, you have to remember that not only can your friend write to it, but also any other shmuck who wants to." the breadman says, "OK. Now, we are going to talk about F(ertile) bit. Since there is so much demand for such a keen toy like your box of donuts.. we want to make it so that your friends can create their own copy of the box, without having to borrow yours. type '@chmod box +f'." the breadman says, "Now... people can '@create #box called DaDonuts'. *BUT*.. there is a little thing that your donuts do, that is going to cause problems for other people. Lets take a look at what's going to happen:" the breadman says, "Your 'bake' and 'eat' verbs both modify box.kinds. This property, on YOUR box, is owned by you, so you are able to write to it with your verbs. When people @create their own, however, that property will be owned by them, and consequently, your verbs will not be able to modify them. what's that you say? 'That's stupid?' Well, for our box of donuts, yes, it is. But for.. say your .description, its good (so you are able to change it). SO. What do we do to fix this? type '@show box.kinds'" the breadman says, "See the 'c' bit? That stands for Change ownership. When a property has the 'c' bit set, when a child of it is @created, the property on the copy is owned by the creator of the new thing, not by the owner of the parent object. SO.. see if you can guess what we need to do to your box of donuts before we go telling our friends to @create them?" the breadman says, "That's right, we are going to '@chmod box.kinds -c'. This will make it so that when your friends create their own boxes of donuts, you will still own the property, so that you verbs are able to modify it. If you haven't already, please @chmod it now." the breadman says, "Welp. That's about it for Permissions. Hope you enjoy'd it. See you in the next lesson!"