Not logged inOpenClonk Forum
Up Topic General / Help and Questions / Making an object stict to the mouse cursor when selected
- - By Pyrit Date 2015-05-07 23:32
I'm trying to make an object that, when selected, creates a floating previewer object wich should stick to the mouse cursor of the player.

First, are there any callbacks to the object, when the item slot in wich the object lies gets selected?
I couldn't find such a thing, so I added an effect that checks via Contained() -> GetHandPos(). Is there a better way to do it?

Secondly, when I have created the previewer, how can I reposition the previewer every frame according to mouse position? I created an effect with "*control*" in it's name:

AddEffect("PreviewControl", this, 100, 1, this);

But how do I get the x and y coordinates of the mouse cursor now?
Parent - - By Anonymous [de] Date 2015-05-08 08:35
The best way is obviously to add the callbacks for hand selection and deselection. Remember these should be made last after all updates to prevent null pointers or errors if the callback changes selection or deletes objects.
Reply
Parent - By Pyrit Date 2015-05-14 23:10
Where do I find the script that's responsible for it? In the clonk, in the HUD, in the controls?
Parent - - By Anonymous [de] Date 2015-05-08 08:36
For the mouse cursor checj the aim control. I think you can activate it and hook in there somehow.
Reply
Parent - By Pyrit Date 2015-05-14 14:31
Ok thanks, I think I found the error, the effect target must be the clonk, not the object that he's holding. (y)
Up Topic General / Help and Questions / Making an object stict to the mouse cursor when selected

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill