Mouse position
Mouse position
I've searched around but can't find an answer, is it possible to get mouse/cursor data (position, mouse click events, etc.) from the interface?
Re: Mouse position
No it is not, what some of us are using, is creating an "tool" item, without colision box, and placeable anywhere, to register the clicks using onentityplaced event, and automatically removing the entity when it is created, you can see a "example code" in my mod or in the test mode mod (read the testmode mod better because my mod doesnt use the pos of the entity createdCerus wrote:I've searched around but can't find an answer, is it possible to get mouse/cursor data (position, mouse click events, etc.) from the interface?
Last edited by ficolas on Mon Jun 24, 2013 9:33 pm, edited 1 time in total.
Re: Mouse position
"some of os".. I though you are talking about operating systems for a while..
Re: Mouse position
tipibslg fasy in thr mobie phone is hahndMF- wrote:"some of os".. I though you are talking about operating systems for a while..
just kidding xD
typing fast in the mobile phone is hard
Re: Mouse position
Interesting workaround, thanks!
Re: Mouse position
Just to have idea what would be useful to have in the future for the modding.
Would some kind of usable/usable on position method of item be useful?
You would select the item with number from quickbar, and it would be either used or it would ask for position (special cursor) to click.
After that, function specified in the prototype would be fired.
Working directly with mouse cursor is something I would like to avoid.
Would some kind of usable/usable on position method of item be useful?
You would select the item with number from quickbar, and it would be either used or it would ask for position (special cursor) to click.
After that, function specified in the prototype would be fired.
Working directly with mouse cursor is something I would like to avoid.
Re: Mouse position
Yes, it would be the same we have now, but less ugly, also in the prototype it could be specified if it gets used or not.kovarex wrote:Just to have idea what would be useful to have in the future for the modding.
Would some kind of usable/usable on position method of item be useful?
You would select the item with number from quickbar, and it would be either used or it would ask for position (special cursor) to click.
After that, function specified in the prototype would be fired.
Working directly with mouse cursor is something I would like to avoid.
-
- Filter Inserter
- Posts: 559
- Joined: Mon Mar 04, 2013 9:23 am
- Contact:
Re: Mouse position
You are right, especially if every mouse move would execute some LUA script as you can get great performance usage with this.kovarex wrote:Working directly with mouse cursor is something I would like to avoid.
As a workaround you could save mouse position at certain intervals (twice per second) into some variable and make that variable readable by LUA scripts to be used by moodders.
But I would ask the mooders first to see why they need this as it is posible they are trying to achieve something that could be better done on native level rather than with using scripts. Somehow I have a feeling that they might want something more out of the ingame GUI
Re: Mouse position
hmm why not expand the onputitem-event?
So atm it is called only if you right-click with a placable-item, why not raise the event everytime you right-click (with an item in your hand)?
So atm it is called only if you right-click with a placable-item, why not raise the event everytime you right-click (with an item in your hand)?
Re: Mouse position
If you were curious why I wanted this functionality I'm toying with a "needs" mod that implements a hunger/thirst/fatigue simulation, part of the survival package is the ability to fish, which I wanted to have some level of interactivity and so I needed a way to detect where the mouse was so I could create the lure at that location.
Edit: So basically yeah, a "usable at position" item would be perfect for this.
Edit: So basically yeah, a "usable at position" item would be perfect for this.
Re: Mouse position
an event raised when clicking a entity could also be really usefullCerus wrote:If you were curious why I wanted this functionality I'm toying with a "needs" mod that implements a hunger/thirst/fatigue simulation, part of the survival package is the ability to fish, which I wanted to have some level of interactivity and so I needed a way to detect where the mouse was so I could create the lure at that location.
Edit: So basically yeah, a "usable at position" item would be perfect for this.
Re: Mouse position
this could also be included in the expanded onpuitem-event.ficolas wrote:an event raised when clicking a entity could also be really usefull
The event would return the cursor-position on map and a pointer to the clicked entity(if there is one of course).