I have no clue how to IMPORT sound. I tryed doing new, then searching for it, but it didnt import it. Also I have the code for players 2 build and to remove player built stuff, but I don't know how to make it so only the admin or player who owns the wall or thing can delete it.
Could someone give a code example and explain it? I just stated and this is my first game. All that I've learned I've figured out or learned from tutorials. Also how would I do skills like fishing or mining? I wrote the code for skills but it doesn't work. Check out Code Problems fourm to see about that. Any help is appreciated!
ID:167038
May 10 2006, 12:23 pm
|
|
In response to Rockinawsome
|
|
thank you *slaps self in face*
anyone know how to do the building I was talking about above and the skills stuff? |
In response to FriesOfDoom
|
|
Well, rereading your first post you need to be aware of something: There is no "the code", and it's often the subject of many jokes from within any programming community. Code is as pliable and as particular as grammar is in language. Therefore you must understand all the parts of the code in order to actually use it effectivly. You could of course use code that you copied and pasted, but that doesn't get you very far unless you know how to change and adapt it to what you're working on. However, it isn't really fair to the author of the code to merely change a few details and call the code your own. The code needs to be reworked in a manner more suited to your level of understanding. The same can be said of the writing community. Someone might plaguarize a sentance or an idea and print it, but that singular line looks awkward and out of place because it exceeds their skill level (and it's plaguarism).
That said, if you look at the code I posted previously you see that the heirarchy of the mob (e.g. datum or data type, short for mobile) changes for the particular verb I posted. In BYOND we have the ability to specify what belongs to what with ease. /*Below is an upsidedown tree which shows what belongs to what. Since PC is below mob it belongs to it, and the same is true of "Admin".*/ The above tree is done this way so that multiple things can be written to belong to the same base datum. Rather than do this however, we can shorten what we've written by writing: mob/PC/Admin/verb/Destroy() or mob/PC/Admin It all means the same thing. And since Destroy() belongs to Admin, no other player can use Destroy() without first becoming an Admin. There are quite a few ways to give Admin priviledges in a game. However, I would suggest giving them to your key when you log in: mob/Login() I hope this suffices as an adequate explanation. |
In response to Rockinawsome
|
|
Thank you for your help! I understand what you are saying about writing code diffrent ways. But what I don't understand is how the code below works out and is so diffrent, can you explain plz. I'm as new to this as a 3 day old baby crawling. I know the basics, and stuff learned form tutorials and thats it. One of them is yours the other is from a tutorial, neither work(probly something I did)(no error message though).
mob Login() if(src.key=="FriesOfDoom") // Change this to your key usr.client.mob= new/mob/player/Admin and mob Login() if(usr.key=="XxMalificentxX") // Change this to your key usr.verbs += typesof(/mob/Admin/verb/) |
In response to FriesOfDoom
|
|
FriesOfDoom wrote:
Thank you for your help! I understand what you are saying about writing code diffrent ways. But what I don't understand is how the code below works out and is so diffrent, can you explain plz. I'm as new to this as a 3 day old baby crawling. I know the basics, and stuff learned form tutorials and thats it. One of them is yours the other is from a tutorial, neither work(probly something I did)(no error message though). What do you mean when you say, the code works out but is so different? Also, just because there are no error messages when you compile the game, does not mean that there are no errors. There are technically 3 types of errors. 1) Compile Time Errors, which are the ones you mentioned. 2) Run Time Errors, which will be shown to the host when the game is compiled in debug mode when something in the code that wasn't thought through fully by the coder that the compiler had no problems with. For example: obj Now, when you look at that code, you will notice that it will compile fine, correct? Now place that into a dm file on its own and compile and run the program. Click the verb, what happens? You get a runtime error saying: <font color=red>runtime error: Cannot read null.randomvar proc name: Blah (/mob/verb/Blah) usr: Satans Spawn (/mob) src: Satans Spawn (/mob) call stack: Satans Spawn (/mob): Blah()</font> What that means is that k was defined as an object, and does have that variable, but k does not exist so to speak. To fix that problem edit it to look like so: var/obj/k=new() Now, k will exist in the world rather than just being an empty variable and you won't get that runtime error any more. As a side note, most of the time when you get a run time error, it will give you a line number at which the error occured at, but not in all cases. The third isn't really an error so to speak, it is more just when you made a mistake in your code, and it doesn't really work as you expected it to. |
Of course, that code above is pretty raw with not much to it. But it'll do the job. You can't import mp3s but you can use .OGG,.WAV, and Midis.
For more functionality with sound use the sound() proc from the reference.