Mouse events. Yay? in Developer Help
|
|
I'm trying to make a drag 'n drop inventory placement system (which in retrospect seemed simple at the time), but of course I'm having problems, or I wouldn't be pleading for help, no?
Pogga icon = 'Cards.dmi' icon_state = "card" cardname = "Pogga" suffix = "Rare" mouse_drag_pointer = 'carddrag.dmi' MouseDrop(src) return MouseDrop(obj/Cards/Card_Box) var/obj/Cards/Card_Box/B src.loc = B B.icon_state = "fullbox" B.numcards++ B.suffix = "[B.numcards] card(s)"
|
|
I will assume you are trying to drag a card onto the Card_Box object and have it moved there. If so, there are a few problems with that code.
1) The MouseDrop(src)return is not what you want. That may actually hinder your attempts as it returns before your other MouseDrop code is called.
2) You have an extra Card_Box reference variable, you only need the parameter one.
3) The parameter variable mentioned in 2 is not a variable of type /obj/Cards/Card_Box, it is a variable of type /obj/Cards and the variable is called Card_Box, at least when done that way.
Solution...
Take out the first version of MouseDrop.
Delete this line:
var/obj/Cards/Card_Box/BAnd change this line:
To this:
So then you have...
Poggaicon = 'Cards.dmi'
icon_state = "card"
cardname = "Pogga"
suffix = "Rare"
mouse_drag_pointer = 'carddrag.dmi'
MouseDrop(obj/Cards/Card_Box/B)
src.loc = B
B.icon_state = "fullbox"
B.numcards++
B.suffix = "[B.numcards] card(s)"