Click point on screen...possible?
Moderators: dorpond, trevor, Azhrei
Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
Click point on screen...possible?
I'm wondering if there is any way to pull this off, for a player to click on the screen and have the nearest intersection of the grid be returned? Something like, "Click on a macro button, this puts them into 'Select Grid' state, next click returns closest X/Y of grid"?
My guess is that if it is possible, someone has already done it!
My guess is that if it is possible, someone has already done it!
Re: Click point on screen...possible?
Nope, no event to return mouse position on screen. You can click a token and get where it is on grid. You can also figure out where your view port is with getViewCenter and getViewArea.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Click point on screen...possible?
Thanks AM, I will stop beating my head trying to figure out the impossible!
Re: Click point on screen...possible?
Not yet that I know of, but I can do this for you.xavram wrote: ↑Fri Jan 17, 2020 12:09 pmI'm wondering if there is any way to pull this off, for a player to click on the screen and have the nearest intersection of the grid be returned? Something like, "Click on a macro button, this puts them into 'Select Grid' state, next click returns closest X/Y of grid"?
My guess is that if it is possible, someone has already done it!
Take a look at the "Joe's Ugly Hacks" posts (I really gotta link that in my sig.!) in "User Creations".
I have already implemented most mouse events, so this is trivial. Simply hook into my (soon to be existing) "onMouseClick@lib:events" get the X/Y coords in pixels and then find nearest grid vertex.
(for a preview, check out the pre-release lib token I made for user FullBleed - otherwise, full event management system will be released this coming weekend)
How would you like it to work?
Generally, my approach is to scan "lib:" tokens for defined events (e.g. you make a "lib:" token and define a macro called "onMouseClick" on it, which receives x=arg(0), y=arg(1)) and then register those methods as callbacks.
As it stands, the simplest approach would be to add "onMouseClick" and then handle the "nearest vertex" logic yourself in your lib's callback.
If that's too much, I can implement an "onClosestGrid" (or something) which you can define and then just receives the x/y coords of the nearest vertex on every mouse click.
let me know
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"
Re: Click point on screen...possible?
it looks like you have a problem and already started thinking about one solution without analyzing alternatives to solve that problem. Perhaps you could start posting the problem first?xavram wrote: ↑Fri Jan 17, 2020 12:09 pmI'm wondering if there is any way to pull this off, for a player to click on the screen and have the nearest intersection of the grid be returned? Something like, "Click on a macro button, this puts them into 'Select Grid' state, next click returns closest X/Y of grid"?
My guess is that if it is possible, someone has already done it!
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Click point on screen...possible?
Obviously, its been some time since I originally posted this Wolph, but my thought process at the time was, "It would be nice if a player could say, "I'm casting Fireball HERE"" and click on the spot on the map where they wanted it to be and then have Maptool show the resulting AoE effect on that spot. My players have said, "it would be cool to have something like that, so we're not meta gaming the exact point, to just narrowly miss an ally". But I did not pursue it much after the initial responses of "No, there are no mouse click events".
Re: Click point on screen...possible?
Ah, well there definitely will be mouse events for maptool this weekend - most of them are already implemented so it's mostly polish, docs & creating demos I have left.xavram wrote: ↑Wed Apr 14, 2021 1:45 pmObviously, its been some time since I originally posted this Wolph, but my thought process at the time was, "It would be nice if a player could say, "I'm casting Fireball HERE"" and click on the spot on the map where they wanted it to be and then have Maptool show the resulting AoE effect on that spot. My players have said, "it would be cool to have something like that, so we're not meta gaming the exact point, to just narrowly miss an ally". But I did not pursue it much after the initial responses of "No, there are no mouse click events".
Given your described use case above though, I don't think a specific "onClosestGrid" (or something) event is necessary. You'll have "onMouseClick", "onMouseDown" and "onMouseUp" events in JUH alpha 2 out of the box, all of which will give you the Maptool map pixel coords where you clicked. Turning that into something like "the nearest top left cell corner location" is something probably best left to the implementation of whatever callback you hook to one of the above mouse events.
If that's something you don't think you can handle, I can whip up a quick one for you, but I'm not going to include it in the base JUH lib, it'll be like "here's a macro you can hook to JUH onMouseClick"
Regardless, everything you mention should be perfectly doable with the JUH alpha 2 macro libs.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"
Re: Click point on screen...possible?
On further consideration a single-shot "onClickLaunch" event could be very useful.
Just feed it a macro name and some args, then the next time the screen is clicked the macro is run with the saved args and screen coords, then the event deletes itself.
So for instance you create a canned JUH animation macro for your fireball, with accepts the screen coords and the caster token id.
Then you call "onClickLaunch@lib:events" and the next time the screen is clicked (only), the animation is started at the given location.
I will add this.
Just feed it a macro name and some args, then the next time the screen is clicked the macro is run with the saved args and screen coords, then the event deletes itself.
So for instance you create a canned JUH animation macro for your fireball, with accepts the screen coords and the caster token id.
Then you call "onClickLaunch@lib:events" and the next time the screen is clicked (only), the animation is started at the given location.
I will add this.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"
Re: Click point on screen...possible?
Being able to click a position on the map and get the x,y position of the map would be super handy. Ie, summon creature or dropping other tokens on to the map via macro frame.
I can imagine having a frame of images/tokens, dragging one from the frame on to the map. It would need to be apart of the same overlay though.
I can imagine having a frame of images/tokens, dragging one from the frame on to the map. It would need to be apart of the same overlay though.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Click point on screen...possible?
Already done.
You can see a preview of this in the one-off lib token I made for Full Bleed in the other thread. It uses the map X/Y to select objects on the object and hidden layer.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"
Re: Click point on screen...possible?
yes, just getting back the X/Y would be great...what version of Maptool do you think this will be in?
Re: Click point on screen...possible?
You don't need a Maptool release for this.
It's already available in the one-off I lib posted for FullBleed in the JUH v0.2a thread. You can take that and just change the registrations and callbacks to do whatever you like.
Otherwise, it will be generally available in the "lib:mouse" module with the full release of my JUH v0.2a drop-in macro libraries that I hope to make this evening.
I was planning to release it Monday night, but I found a bug I couldn't release and I don't have much free time weeknights so it's taken me a couple of days to fix
Anyways, the bug is fixed now, and I'm just building demos and tidying up docs, so it will be out either this evening or tomorrow night (at the latest).
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"
Re: Click point on screen...possible?
He said, and then died for months.
JUHa2 is out now, working on alpha 3
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"