ID:139220
 
Code:
obj
wood
icon = 'wood.dmi'
icon_state = "wood"
verb
make_wall()
set src in usr
src.Move(usr.loc)
icon = 'Buildables.dmi'
icon_state = "Wall"
density = 1
get()
set src in oview(1)
src.Move(usr)
make_floor()
set src in usr
src.Move(usr.loc)
icon = 'Buildables.dmi'
icon_state = "Floor"
make_door()
set src in usr
icon = 'Buildables.dmi'
icon_state = "Door"
drop()
set src in usr
src.Move(usr.loc)


Problem description::me again :/ im a newbie scripter and i have no idea hw to do this D: i want to make it do i can pick up wood right clikc it and turn it into a wall or door or floor ect ect


also im trying to make it so that when i click make axe with stone it deletes the stone AND wood and gives you a axe but i cant get it to delete the wood D: please revise my code and tell me what im doing wrong


obj
stone
icon = 'land.dmi'
icon_state = "stone"
verb
make_axe()
var/obj/wood = locate(/obj/wood) in usr.contents
if(wood)
set src in usr
view() << "[usr] makes a axe!"
new/obj/axe(usr)
del src
else
world << "you need wood for this!"
get()
set src in oview(1)
src.Move(usr)

No where in the make_axe proc is the wood variable deleted. And you also cannot delete the source before the wood (so insert that above del src); you can, but you'll have to set the src to null in order to keep the procedure from automatically ending.


Also what problem are you having with building? As far as I see, it works just fine.
In response to The Ending Cross
Nothing with building anymore i fixed it lol i made a noob mistake and made the wood change into a wall then drop you could pick up the wall XD i used new/wall(usr.loc)
seemed to work just fine
In response to The Ending Cross
other then that/the problem is i cant get the wood to delete D:
Ok, this code works:
obj
wood
icon = 'wood.dmi'
icon_state = "wood"
verb
make_wall()
set src in usr
var/obj/wall/W = new(usr.loc)
Dump+=W
Dump-=W
del(src)
get()
set src in oview(1)
src.Move(usr)
make_floor()
set src in usr
var/obj/floor/F = new(usr.loc)
Dump+=F
Dump-=F
del(src)
make_door()
set src in usr
var/obj/door/D = new(usr.loc)
Dump+=D
Dump-=D
del(src)
drop()
set src in usr
src.Move(usr.loc)

wall
icon = 'Buildables.dmi'
icon_state = "Wall"
floor
icon = 'Buildables.dmi'
icon_state = "Floor"
door
icon = 'Buildables.dmi'
icon_state = "Door"

var/Dump[0]

But is you want to know why did your code didn't work, it was because you didn't add "src" before icon states. Dream maked didn't know whose icons you wanted to change. Also, your walls could be picked up, but when making new object there wont be such bug. Also, to delete wood, you would need to use del(src) at the end of every build verb.

EDIT: Oh, it seems I was writing this for a while and didn't see new comments, but to delete wood, add "del(src)" at the end of every build verb. Now I will look at the other code.
In response to Shwb1
var/obj/wood = locate(/obj/wood) in usr.contents


should be

var/obj/wood = locate(/obj/wood) in usr


The wood should be removed then.