ID:1267291
 
Code:
obj
Buttons
NewGame
icon='NewGame.dmi'
MouseEntered()
var/image/i = new('NewGameOverlay.dmi')
overlays+=i
MouseExited()
var/image/i = new('NewGame.dmi')
overlays+=i


Problem description:Everyone on game can see it when someone moves their mouse over it. Other then themselves.

Try throwing a check in there for when MouseEntered to make sure that the usr = the players ckey maybe. Basically as it is right now everyone can see it because there is nothing telling it not to allow only that one usr to see it.

You could try:

MouseEntered(mob/m)
m.see_invisible = 50
var/I = /obj/Overlays/NewGameOverlay
for(var/obj/Buttons/NewGame/N in m.client.screen)
N.overlays +=I


Give that a try and see what it does. The next thing I could think of is the for loop because the obj is not getting deleted you are just removing it from the overlay so its still there just hidden. That could be why other's can see it when someone mouses over it as well. I am leaning more to the first thing tho.
In response to Akando5959
Akando5959 wrote:
Try throwing a check in there for when MouseEntered to make sure that the usr = the players ckey maybe. Basically as it is right now everyone can see it because there is nothing telling it not to allow only that one usr to see it.

You could try:

> MouseEntered(mob/m)
> m.see_invisible = 50
> var/I = /obj/Overlays/NewGameOverlay
> for(var/obj/Buttons/NewGame/N in m.client.screen)
> N.overlays +=I
>
>

Give that a try and see what it does. The next thing I could think of is the for loop because the obj is not getting deleted you are just removing it from the overlay so its still there just hidden. That could be why other's can see it when someone mouses over it as well. I am leaning more to the first thing tho.

MouseEntered(location,control,params)
In response to Neimo
Neimo wrote:
Akando5959 wrote:
Try throwing a check in there for when MouseEntered to make sure that the usr = the players ckey maybe. Basically as it is right now everyone can see it because there is nothing telling it not to allow only that one usr to see it.

You could try:

> > MouseEntered(mob/m)
> > m.see_invisible = 50
> > var/I = /obj/Overlays/NewGameOverlay
> > for(var/obj/Buttons/NewGame/N in m.client.screen)
> > N.overlays +=I
> >
> >

Give that a try and see what it does. The next thing I could think of is the for loop because the obj is not getting deleted you are just removing it from the overlay so its still there just hidden. That could be why other's can see it when someone mouses over it as well. I am leaning more to the first thing tho.

MouseEntered(location,control,params)



MouseEntered(object,location,control,params)

In response to Akando5959
"object: the object under the mouse pointer" Those arguments are regarding client/MouseEntered(), not atom/MouseEntered(). The OP isn't trying to call MouseEntered() on himself, but on a screen objects. Though, in any case, usr works fine here and creating references of themselves are redundant.

obj
path
MouseEntered()
for(var/obj/path/o in usr.client.screen)
o.overlays.Add(new/obj/path)
MouseExited()
for(var/obj/path/o in usr.client.screen)
o.overlays.Remove(/obj/path)
I re-coded it, Still same problem. Everyone can see it even if they don't move the mouse over it themselves.
In response to Marcus55
Use images.
Tried that at first, The overlay wouldn't show up at all.
In response to Marcus55
Because you're not outputting the image to the usr.
Do you ever delete the instance of the new button for each usr?
I did output it to the usr at first, But it changed the usr's icon. Not the obj for newgame.

I did it like this.

obj
Buttons
NewGame
icon='NewGame.dmi'
MouseEntered(obj/NewGameOverlay/Overlay)
usr.icon='NewGameOverlay.dmi'

What I did an hour or so ago.

@Akando, I think. Not sure.
In response to Marcus55
That's not how you do it, look up images in the reference.

var/image/i = new('file.dmi')
usr << i
Got the overlay to appear now. Still shows for everyone though.
Just make a button for each player instead of share one. It's not expensive or anything.

obj/Buttons
NewGame
var image/overlay = new ('NewGameOverlay.dmi')
MouseEntered() overlays += overlay
MouseExited() overlays -= overlay
It will work that way, because the original way they all were sharing the same overlay obj so anytime it was used everyone would see it. Thus, you never specified that only that usr should see it.
Still shows on everyone's screen Kaio.
In response to Marcus55
Did you make a separate button object for each person like I said, or did you just take the unnecessary snippet? An object in one client's screen won't be seen by anyone else unless you show them. How are you setting up the HUD?
I got it to work, Thanks Kaio.