ID:1474708
 
(See the best response by Ter13.)
Code:
Click()
if(src in obounds(usr,4))
usr.contents+=src


Problem description:

Now, this works and all, but a slight problem arises. For some reason, if the player is 32 pixels or so to the right of the object, (s)he can pick it up. If they're the same distance to the left, however, they cannot. I can only wonder why. I've tried everything, from adjusting the bounding boxes, etc, but in truth, I'm not quite sure how they should work.
Make sure the bounding boxes of the items are set up properly.

This will check for any bounding boxes within range of:

px+usr.bound_x-4
py+usr.bound_y-4
px+usr.bound_x+usr.bound_width+4
py+usr.bound_y+usr.bound_height+4

Where px = (usr.x-1) * TILE_WIDTH + usr.step_x
Where py = (usr.y-1) * TILE_HEIGHT + usr.step_y

If even a single pixel of the bounding box of an item is in that distance, it will return the object.
By TILE_WIDTH and TILE_HEIGHT, are you referring to the tile that the user is standing on or the user itself?
No, I'm referring to the icon_size of the world.

What I'm saying is, that obounds() in the format you are using will check within those ranges for objects that have a bounding box overlapping the square you are defining in obounds().

if you are seeing inconsistencies, that can only mean that the bounding data of the items you are trying to pick up are set up incorrectly.
Alright, then. I'll try to adjust them properly.

Currently, however, the bounding data of the mobs and objects are set to default. Perhaps I should use obounds() in a different manner?
You are using it right. The only thing that could be wrong is something else you are doing, your understanding of what's happening, or the bounding areas of the items.
Best response
There is one other option, and this would make things a bit faster:

This will get rid of the costly "in bounds()" call you are making, and instead directly compare the distance of the two objects' bounding boxes.

This will be much faster, and much more elegant.

obj
item
Click()
if(bounds_dist(src,usr)<=4)
usr.contents += src
Works like a charm. I've found the problem as well. Somewhere along the lines, I set all of the objects pixel_x and y's into -16. Everything else was being processed properly. Thanks for your help, by the way.