ID:177991
 
Welcome To ShadowSiientx's Byond Lessions.



All coders put this at the end of there code: //message.

Why? because you don't want to forget how something works!

Heres an example of a login code..Don't rush and put this in your Testgame.I want to tell you what each part means!



mob/Login() //When someone logs in
. = ..() //don't go to a blackscreen!
world <<"> [usr] Joins" //Tell everyone in the game that the guy/girl Loged in!


mob/Logout() //When someone logs out
world << "> [usr] Leaves" //Tell everyone he/she is gone
del src //delete there Left over icon on the map!

Theres an example code :) Read the Comments on the side.



Next,Do you want your people to talk?

mob/verb/say(T as text) //Tell the game that T is text that the user inputs!
world <<"[usr] Says: [T]" //Tell the word who said it and What he/she wrote!

Easy?Well thats just simple stuff.

And i have seen a lot of people use demos cramed together in their games.Don't do that!

i did it and its not the best idea.

But anyway Lets move on to making some pretty ^_^ grass and leting the user have a icon?

go here: file/new/icon file/and name it "grass"

Click the Painting Tool and draw some pretty grass or just Flood the icon plate with green.

And add this:

turf //Only put this here.tells the byond maker to make a new list of turfs!
grass //Name of turf
icon = 'grass.dmi' //Icon, Also you notice i put no spaces! So it makes it the "Default" turf. =P

ok now do this: file/new/icon/name it wall

Then draw a nice Little wall.

and place this on your turf list. so your turflist looks like this:

turf //Only put this here.tells the byond maker to make a new list of turfs!
grass //Name of turf
icon = 'grass.dmi' //Icon, Also you notice i put no spaces! So it makes it the "Default" turf. =P
wall //Name of turf
icon = 'wall.dmi' //Icon, Also you notice i put spaces! So its not the default turf!
density = 1 //You are not a ghost so add this piece so they can't go through the wall!

Good, Now go to file/new/icon/name it mob

Draw a nice stick figure or smiley!

The add this code.

mob/icon = 'mob' //Default icon!

You made a maze And it only took you 5 mins..(Takes me 5 seconds,)



- More parts of this lession coming soon! -











thx alot , it helped me alot, coz iam a n00b and i need all the help i can get. i can't wait for the next lessions to come out. good job
Not a bad set of lessons when taken in context (most are just common sense tips that newbie programmers tend to forget), but I thought 'lessions' are something you get when you have a disease. Please proof read before posting! You'll be amazed at the positive feedback you will get...

(oh, and don't tell me your english is bad - if you have access to the 'net there is absolutely no excuse for consistently bad spelling, grammer, and punctuation - the 'net abounds with dictionaries for nearly every language...) (not saying I'm perfect by any stretch of the imagination, but I try to proof my comments before I post dem, err.. them)
In response to Unrealt15
Sorry..I am sleepy.
I've never had any truck with the term "noob", which implies the person using it equates being a newbie with being a loser, or at least that they take "leet" too seriously (that is, at all).

But that aside, couldn't you have posted to the correct forum? This isn't rocket science, "DoOd".

Lummox JR
"NoOb LeSsIoNz"...

Did you break your shift key?
Looks like you need some lessions yourself:


1) NEVER EVER EVER use 'usr' in Login() it can cause alot of problems.

2) . = ..() really does nothing in your code ..() will do just fine.

3) What the beans is mob/icon = 'mob'? Makes no sense

4) You indentation is screwy.
In response to Nadrew
Nadrew wrote:
2) . = ..() really does nothing in your code ..() will do just fine.

If the default proc has a return value, ". = ..()" will pass that return value through this proc.

I only use it when the new function depends on the output of the default proc, like expanding on the Move() proc.

mob/Move()
. = ..() // move like normal, and store the return result in "."
if(.) // if the default Move() worked...
// do something nifty here

/* this is the end of the proc. Whatever is stored in
"." automatically passes back as the return value.*/
In response to Shadowdarke
Yes but it did nothing in his code as I noted.
In response to Nadrew
Nadrew wrote:
1) NEVER EVER EVER use 'usr' in Login() it can cause alot of problems.

Supposedly usr is Login()-safe, but I don't trust it, myself.

2) . = ..() really does nothing in your code ..() will do just fine.

This actually does do something; it's the equivalent of calling return ..(), but puts off the return until later.

Lummox JR
In response to Lummox JR
I was sleepy..=P

ITS lessons..and in the mob part its spose to be 'mob.dmi'

ehe.

And i found that login code in the ref. =/
In response to Lummox JR
There's nothing wrong with using "usr" in Login(). I've never had any trouble with it as long as I've been fiddling with code. Although, now I'm in the habit of using src instead of usr for most everything anyway, unless I specifically need usr.
In response to ShadowSiientx
ShadowSiientx wrote:
I was sleepy..=P

Then do yourself and the community a favor - re-release your lessons when you've had a chance to proof-read them and correct any mistakes found... preferrably when you are awake! :)

It's bad enough the noobs -- err, I mean the newbies are confused enough *now*... it serves no purpose by screwing them up even more...