ID:159643
 
I've finally learned how to make HUDs so now im working on a HUD that you can move things around simply by clicking and dragging, and i've made this...

obj
MouseDrag(over_object,src_location,over_location)
var/turf/a = over_location
var/mob/b = over_location
var/obj/c = over_location
src.screen_loc = "[a.x],[a.y]"
src.screen_loc = "[b.x],[b.y]"
src.screen_loc = "[c.x],[c.y]"

The problem is that takes the turf, mob, or objs loc and make it its on the screen, i'll work on making it only work for the HUD later but what i need to move it around is finding the mouses location on the screen. How would I do that? maybe sumthing like var/client/a = mouse.loc?
You don't need MouseDrag(), what you want is MouseDrop().

And the argument you want is over_location.
In response to Andre-g1
kk i know about mousedrop i messed with that also anyway
what do you mean by "And the argument you want is over_location."
In response to IrunoHatake
i still haven't fixed it :P can u tell me what u meant by that plz? or show me what u mean?
In response to IrunoHatake
When you drop something(MOUSEDROP()), the over_location argument has the location of the Mouse.

However, if you're using MouseDrop() on an interface control, the argument you want is over_control.
In response to Andre-g1
the thing is when i set it to src.screen_loc = over_location
the obj dissapears, i mean its still there but u can't see it
In response to IrunoHatake
Probably because of the layer var ? Have you increased it on the obj ?
In response to Andre-g1
nope this is what the code is

obj
MouseDrop(over_object,src_location,over_location)
src.screen_loc = over_location
In response to IrunoHatake
Hmm.......
I didn't comply or anything, But this sounds like it'll work:
HUD
parent_type = /obj/
icon = 'You know, that one icon thing'
MouseDrop(what,where)
if(src in usr.client.screen)
src.loc = where
else
return

Hope it works!
In response to World Build
it didn't do anything but it may be since i changed somethings

this is what it is now

HUD
parent_type = /obj/
icon='meter3_02.dmi'
icon_state="0"
New(client/c)
screen_loc="6,11"
c.screen+=src
MouseDrop(what,where)
if(src in usr.client.screen)
src.loc = where
else
return
In response to IrunoHatake
Does it drag now?
If not, Give up and use Crispy's HUD moving demo.