ID:146100
 
Code:
mob/verb
Test_Dust()
usr.Dust()

mob/proc
Dust()
src<<"Dust"
new/obj/dust/dust1(locate(src.x,src.y-1,src.z))
new/obj/dust/dust2(locate(src.x+1,src.y-1,src.z))
new/obj/dust/dust3(locate(src.x+1,src.y,src.z))
new/obj/dust/dust4(locate(src.x+1,src.y+1,src.z))
new/obj/dust/dust5(locate(src.x,src.y+1,src.z))
new/obj/dust/dust6(locate(src.x-1,src.y+1,src.z))
new/obj/dust/dust7(locate(src.x-1,src.y,src.z))
new/obj/dust/dust8(locate(src.x-1,src.y-1,src.z))
sleep(50)
src<<"No Dust"
del(/obj/dust/dust1 in oview(1))
del(/obj/dust/dust2 in oview(1))
del(/obj/dust/dust3 in oview(1))
del(/obj/dust/dust4 in oview(1))
del(/obj/dust/dust5 in oview(1))
del(/obj/dust/dust6 in oview(1))
del(/obj/dust/dust7 in oview(1))
del(/obj/dust/dust8 in oview(1))


Problem description:
runtime error: bad del
proc name: Dust (/mob/proc/Dust)
source file: trans.dm,18
usr: Jon (/mob/characters/male)
src: Jon (/mob/characters/male)
call stack:
Jon (/mob/characters/male): Dust()
Jon (/mob/characters/male): Test Dust()

I am totally stumped on why this will not work.
What I mean is, I want it to delete the dust. I get the dust to show but cannot get it to delete. Any suggestions?
I dont think you can use del() like that. try this

mob/verb
Test_Dust()
usr.Dust()

mob/proc
Dust()
src<<"Dust"
var/Dust1 = new/obj/dust/dust1(locate(src.x,src.y-1,src.z))
var/Dust2 = new/obj/dust/dust2(locate(src.x+1,src.y-1,src.z))
var/Dust3 = new/obj/dust/dust3(locate(src.x+1,src.y,src.z))
var/Dust4 = new/obj/dust/dust4(locate(src.x+1,src.y+1,src.z))
var/Dust5 = new/obj/dust/dust5(locate(src.x,src.y+1,src.z))
var/Dust6 = new/obj/dust/dust6(locate(src.x-1,src.y+1,src.z))
var/Dust7 = new/obj/dust/dust7(locate(src.x-1,src.y,src.z))
var/Dust8 = new/obj/dust/dust8(locate(src.x-1,src.y-1,src.z))
sleep(50)
src<<"No Dust"
del(Dust1)
del(Dust2)
del(Dust3)
del(Dust4)
del(Dust5)
del(Dust6)
del(Dust7)
del(Dust8)
In response to Turles9000
Thanks alot.
Try this:
for(var/obj/dust/d in oview(1,src))del(d)
In response to Ol' Yeller
but wont that delete other peoples Dust too?(But maybe he's trying to do that)
In response to Turles9000
I just wanted to delete the dust around the creator of the dust.
dust1, dust2, dust3 = design flaw. You should only have one type path to handle this dust; send it an additional argument when you create it to tell it how to display.

You should also be using get_step() instead of those bulky locate() procs.

Lummox JR
A nice way to do this is to send the direction the dust is from the player to an argument from New() (As Lummox JR said).

obj/dust
var/mob/O
New(location, owner, direc)
..()
src.O = owner // a reference to the owner, so we can just delete the owner's "dust"
src.icon_state = "[direc]" // you might need to change the icon_states, but it's a better way then creating new pathtypes

mob/proc/Dust()
for(var/turf/T in oview(1, src))
new /obj/dust (T, src, get_dir(src, T))
spawn(50)
for(var/obj/dust/D)
if(D.owner==src) del(D) // delete the dust after 5 seconds


This is a better way then just having a large block of code of creating objects.

~~> Dragon Lord
In response to Unknown Person
This aspiring programmer didnt even know how to locate objects he\she created,so DragonLords solution to this problem doesnt do him much good if he doesnt understand it
may I suggest DragonLord or someone elses explain it to him?
(I'd do it ofcourse,but its better to get the explanation from the person who knows what its supposed to do rather than from someone who is interpreting it.)
In response to Itanium
Alright, for you guys who don't understand, I'll break it up into chunks.

obj/dust
var/mob/O


We have our dust object here. It'd be a problem to find the dust object if we don't know who owned the object!

  New(location, owner, direc)
..()
src.O = owner
src.icon_state = "[direc]"


The New() proc is just like any normal proc. You call it with arguments. You can create your own, too. By default, the first argument for the New() proc is the location the object is created at, so we leave that with a variable we don't touch.

The second argument is the owner, which we pass down through below. The third argument we define ourselves is the direction from the owner of the dust, and where it was created. This is an easy way to prevent defining different types when we only need to change appearences.

mob/proc/Dust()
for(var/turf/T in oview(1, src))
new /obj/dust (T, src, get_dir(src, T))


Basically, we search every single turf around you, which is just one tile away. For every single turf around you, we create the new dust object. Since the new proc for the dust is just like any other proc, we send the data through the arguments. The second one being the owner, the third one being the direction from the owner to the turf.

  spawn(50)
for(var/obj/dust/D)
if(D.owner==src) del(D)


This part is pretty straightforward. We wait 5 seconds (50 milliseconds). Then for every dust object in the WORLD, we check if it was created by the person. If so, we delete it. We defined D in the for() proc so you don't need to this wacky locate() proc, which is incorrect in the first place anyway.

If you need more explaination in specific parts, or something, ask away.

~~> Dragon Lord