ID:1705594
 
(See the best response by Kaiochao.)
Code:


Problem description: Ive been trying to make it so I can click an image. This is so a player then click something others cant see. And i cant use invisibility. Is this possible?

I can click it obviously, but cant use the built in function Click() for is so it can do a specific action after clicking
Best response
You need to use an atom, then attach the image to it, and set the image's "override" variable to TRUE. Then output the image to the player like normal.

And voila, the object is clickable and selectively visible.
In response to Kaiochao
how do you set the override variable to true? Thank you!
In response to Anthonytyran
So you have an image:
var image/some_image = image(whatever)

And you want to set its "override" variable to TRUE:
some_image.override = TRUE
In response to Kaiochao
actually while we are at it how would i attach an image to an atom as well. I know how to output an image to a player. Or would i do something like var/obj=image()
In response to Anthonytyran
The loc of an image is what it's attached to. You set it in the image() proc when you create the image:
var image/some_image = image(icon, ->loc<-, icon_state, etc.)


and you can also set it afterwards as a regular variable:
some_image.loc = any atom
okay thank you!! this will help alot
In response to Kaiochao
Nope been testing and changin still not getting it
mob/verb/statTree(var/obj/items/equipable/e)
set hidden=1
if(client.eye!=locate(7,94,2))
client.eye = locate (7,94,2)
for(var/i=0;i<e.location.len;i++)
var/obj/talents/Box/I=image('hotkeys.dmi',e.location[i+1],"[e.perks[i+1]]")
I.override = TRUE
for(var/obj/talents/Box/o in e.location[i+1])
I.loc=o
usr<<I
else
client.eye=src
In response to Kaiochao
obj/talents
icon='hotkeys.dmi'
Box
icon_state="talentBox"
Click()
world<<src.icon_state
if(src.icon_state=="statDamage")
world<<"hello"

basically im looking for this last compare. Compare the images icon_state and then do something, for now its just printing a random message to see if it works and its not
In response to Kaiochao
Kaiochao wrote:
So you have an image:
> var image/some_image = image(whatever)
>

And you want to set its "override" variable to TRUE:
> some_image.override = TRUE
>


I have never seen or used 'override' before, but I swear I've used images and clicked on them. I did not know you could set an images loc var to place it on an atom either. I like that. :)
In response to Flick
Flick wrote:
I have never seen or used 'override' before, but I swear I've used images and clicked on them. I did not know you could set an images loc var to place it on an atom either. I like that. :)

Hey, don't feel bad. Presently, Flick will not affect an image.

edit: I was wrong about override. I actually thought that having an image with override = TRUE would make the object invisible to clients who aren't viewing the overriding image. What really happens is the image "overrides" the atom's appearance for clients viewing the image. If no image is seen over the atom, then the atom appears as normal.

Solution: set the atom's invisibility to 101.
In response to Kaiochao
Just for you guys, I made a demo showing off image.override. It even has a Halloween theme.