ID:142525
 
Code:
//This is a test world created by Nathaneil on 4/21.



mob
icon = 'person.dmi' //make it so all mobs will be created with the person icon
bug //new prototype
icon = 'bug.dmi' //override the parent's icon, which was 'person.dmi'
var
HP = 30 //define a new variable called HP, with a value of 30
proc
DeathCheck() //check for death with a proc
if (HP <= 0) //if HP of defender is 0 or lower...
world << "[src] dies!" //do the death message
Login()
icon_state = gender //when a player logs in, make their icon's state
..() //the gender of their key. Then call the parent!
verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable between 1-10
world << "[damage] damage!" //tell the damage to the world
M.HP -= damage //take away the damage from M
say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
emote(msg as text)
world << "*[usr] [msg]*"


turf
grass //defines a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //and has an icon named 'grass.dmi'. In single quotes!

world //we set one of our world's characteristics:
turf = /turf/grass //its default turf is the grass turf.


Problem description:
Thats my whole code, but the problem is that when I run it, it shows a stick figure, like its supposed to, and then the turf is all black... please help (additional info needed? just ask for more... lol)

Btw... this isnt a real game, its just for me to learn coding, im using a guide, but I guess they didnt encounter this problem
You never set the grass's icon_state, though you may not need to.

Also make sure that grass.dmi exists and try a clean compile (Build > Clean Compile)
In response to Nickr5
I used the clean compile, still happend, plus, I dont know all of this, but it only has one diferent state... like, in the icon stage, its only 1 picture, so I dont think I have to set the state, but I'll try...


lol, I have no clue how to do that, heres what I did...


turf
grass //defines a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //and has an icon named 'grass.dmi'. In single quotes!
icon_state = grass


but that didnt work, the errors:
loading Testworld.dme
Testworld.dm:34:error:grass:undefined var
Testworld.dm:34:error::empty type name (indentation error?)

came up
In response to Nathaneil
when you set an icon state, it needs to be in double quotes, and when your specifying the icon file (the .dmi) it needs to be in the single quotes like so
turf
grass
icon = 'grass.dmi'
icon_state = "grass"
/*remember to only tab over if it belongs to whats above it,
in this it's saying that the turf grass's, icon is 'grass.dmi' and the icon state is grass and if it was like what is below,
it would be saying "the icon of the turf grass is 'grass.dmi'.
the icon state of 'grass.dmi' is "grass", witch is bad :P
*/

turf
grass
icon = 'grass.dmi'
icon_state = "grass"

i went a little in depth, but i see your using Zilal's tutorial, witch is good, after you read his tutorial try reading Dm Guide, it goes in depth of all the things you learned in zilal's tutorial, and more
^_^
-RanEsu
In response to RanEsu
GRASS!!! Thanks so much RanEsu, and you too Nikr5! Finnaly I have turf! Wahoo! lol, yes, I'm using that guide, now to finish the project that has been on hold for a week or so, lol. Thank goodness I found out that Byond had forums... lol
In response to Nathaneil
lol no prob, read the DM Guide, Then the Reference, if you want to learn as much about coding as you possibly can
You're not gonna learn much - if anything at all - from copying code and not screwing around with it at all.
In response to Darkmag1c1an11
actually, I have screwed around A LOT, in fact, I figured out how to make emotes for my game by myself just by toying with the "say" verb. But reading guides isnt really good for me, I keep encountering problems that no matter what I do, wont get fixed without help, or even with help, and just annoy me.
In response to Nathaneil
Nathaneil wrote:
actually, I have screwed around A LOT, in fact, I figured out how to make emotes for my game by myself just by toying with the "say" verb.

Sorry but, uh, an 'emote' verb is the same as a say verb. The hardest thing you'd need to do to change a Say() into Emote() is to change the color of the text. If this is the best you've managed through pasting together code, then the value in it is self-explanatory.

But reading guides isnt really good for me, I keep encountering problems [...]

Whatever the case, that's how life simply is in a lot of things - no pain, no gain. Even if you don't like guides, invest time into learning so you can get better. You're not going to get far by just pasting together code. Who said the code you're using is even proper; frequently you learn very bad coding techniques or habits from various sources, and this does include some demos and libraries among other things. You're certainly not going to be able to make your own code from scratch like this at any case..