ID:171509
 

obj
        grass
                icon='grass.dmi'
                grass1
                        icon_state="grass1"
                grass2
                        icon_state="grass2"
                grass3
                        icon_state="grass3"

                proc
                        grassgrow()
                                sleep(50)
                                new     /obj/grass/grass1 (src.loc = locate(rand(1,world.maxx),rand(1,world.maxy),1))
                                usr << "Grass created"
                                spawn()
                                        grassgrow()


                New()
                        spawn()
                                src.grassgrow()


mob
        login
                ..()


        verb
                add_grass()
                        new     /obj/grass/grass1(src.loc = locate(rand(1,world.maxx),rand(1,world.maxy),1))

turf
        soil
                icon='soil.dmi'
                soil1
                        icon_state="soil1"





Right, I don't get it. The run time error occurs - the game starts up, and I click the verb "add Grass". Then, one grass obj appears- and 5 seconds after that it says "Grass created" - but no new grass obj is created. Then it says "Grass created" twice- and so on- it seems that the grass is being created but not appearing...

(by the way, the game is supposed to simulate life- but right now I'm coding just the way grass grows).

Could anyone help?
Try not typing "src.loc = " in the paramiters for the 'new' keyword.
Theres a couple of realy realy bad problemes here, even if youo stop getting ruuntime errors

Kholint wrote:
obj
grass
icon='grass.dmi'
grass1
icon_state="grass1"
grass2
icon_state="grass2"
grass3
icon_state="grass3"

proc
grassgrow() everytime you make a new grass, this procedure will be called, so after you start, you will have 1 procedure waiting, then 5 seconds later, you will have 2, then 4, then 8 because each procedure doubles itself every 5 seconds and after a few minutes, your game will lag so bad you will become depressif
sleep(50)
new /obj/grass/grass1 (src.loc = locate(rand(1,world.maxx),rand(1,world.maxy),1))
usr << "Grass created"
this is a procedure, you dont have a usr in procedures, so this shouldnt exist
spawn()
grassgrow()


New()
spawn()
src.grassgrow()


mob
login
..()


verb
add_grass()
new /obj/grass/grass1(src.loc = locate(rand(1,world.maxx),rand(1,world.maxy),1))

turf
soil
icon='soil.dmi'
soil1
icon_state="soil1"




Right, I don't get it. The run time error occurs - the game starts up, and I click the verb "add Grass". Then, one grass obj appears- and 5 seconds after that it says "Grass created" - but no new grass obj is created. Then it says "Grass created" twice- and so on- it seems that the grass is being created but not appearing...

(by the way, the game is supposed to simulate life- but right now I'm coding just the way grass grows).

Could anyone help?

Also, the grass will appear anywhere in the map, on the first Z level, so thats probebly what happens