ID:137327
 
Is it possible to have it run a proc, when you click an image? If not, this would be really useful for my first demo. I think all you guys will enjoy it, excluding the good coders that can make it in 5 seconds (spuzzum,deadron, etc :)


-Rcet
Rcet wrote:
Is it possible to have it run a proc, when you click an image? If not, this would be really useful for my first demo. I think all you guys will enjoy it, excluding the good coders that can make it in 5 seconds (spuzzum,deadron, etc :)

This is indeed possible.
What you need to do is to attach the image to an obj that has no icon and is used for nothing else, then put the Click() proc in the obj:
obj/buttonholder
var/img
// notice no icon is set here

New(l,mob/M)
..()
img=image(loc=src,icon='button.dmi')
M << img

Del()
if(img) del(img)

Click()
usr << "You've clicked a button that only you can see."

I'm using a more elaborate version of this in my new project so that players can have a clickable interface right on the map.

Lummox JR
In response to Lummox JR
Ok I got it to work, but when i click the obj, it does nothing, even though I have the Click() under the obj.

-Rcet
In response to Rcet
Rcet wrote:
Ok I got it to work, but when i click the obj, it does nothing, even though I have the Click() under the obj.

If I can see your source code, that might help. I think this thread is more appropriate for Code Problems now, so if you post there I'll take a look.

Lummox JR