ID:970126
 
(See the best response by NNAAAAHH.)
Code:
    Wooden_Floor
icon = 'turfs.dmi'
icon_state = "weakfloor"
var
health = 5
Click()
bounds_dist(usr, src)
if(usr.hand1 == "")
if(src.health > 0)
src.health -= 1
usr << "The [src]'s health is now [health]"
view() << "Bang!"
if(src.health == 0)
del(src)
usr << "Your broke [src]!"
view() << "[usr] has broken [src]!"


Problem description: I have no idea, even after looking at the reference, how I can make it so that if the user is within a few pixels of the floor, they can break it. But when I try to make the bounds_dist into a proc, it throws errors. So really, I need to know how to limit the Click range.

Thanks so much for all the help in advance, because I need it -_-

if(bounds_dist(usr,src))

I believe you have to use it in an IF statement. ^^
        Click()
if(bounds_dist(usr,src))
if(usr.hand1 == "")
if(src.health > 0)
src.health -= 1
usr << "The [src]'s health is now [health]"
view() << "Bang!"
if(src.health == 0)
del(src)
usr << "Your broke [src]!"
view() << "[usr] has broken [src]!"



Alright, now it makes it so that if I touch the border of the floor, it won't break, but far away or on it you can. Do I need
            if(bounds_dist(usr,src) == 10)
or something? Thanks again!
Best response
Wow! I never would have guessed that I would need the <=; thanks so much for the help!
In response to Jacob843
Not sure if sarcasm or ignorant to DM.

Also, I added a href to the <= in my previous post to the referance that explains the operator.
What? You really did help me...
In response to Jacob843
Lol, not a problem then. You probably should read up on DM, there's probably a lot you don't know about it that you could learn from the referance.
Well, I was looking at the reference, but for bounds_dist, it never said anything about the if statement. But otherwise, I have used the reference for mostly everything else
In response to Jacob843
When something returns a value, simply calling it doesn't give you that value.
var/a=testproc()//Make variable a equal the return value of proc testproc()
proc/testproc()
return 2//the return value is 2, variable a will now equal 2
if(testproc)//Checks if there is a return value for the proc testproc()
...//If the value isn't FALSE, 0, null, or "" then preform action
if(!testproc)//checks if the inverse of testproc is a valid value
...//ect
if(testproc==2)//checks if testproc()'s return value is equal to 2
...//if yes, preform action