Joe's Ugly Hacks 'Drop-in' macro libraries - Feature Requests/Changes

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by wolph42 »

JoeDuncan wrote:
Mon Apr 12, 2021 10:28 am
We just held each event for half a second before execution. If a new one came in before that last one was executed we just replaced the old event with the new one and waited another half second. Worked great. I bet the same technique would work just fine for "onChangeFacing".
if i make an observation. Given that this functionality will be used for coding and the usage may wildy vary I would say that the time out is something ideally set by the coder in the function itself. Some light function would benefit from fast update when the viewport changes, while other more heavy function might require some optimization by delaying the execution, perhaps even to longer than 0.5s. You can obviously set the default to .5.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by RPTroll »

This is very nice work. Thank you for sharing your expertise.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

wolph42 wrote:
Tue Apr 13, 2021 6:47 am
I would say that the time out is something ideally set by the coder in the function itself. Some light function would benefit from fast update when the viewport changes, while other more heavy function might require some optimization by delaying the execution, perhaps even to longer than 0.5s. You can obviously set the default to .5.
My plan is to eventually provide configuration settings for most of the "magic numbers" in JUH.

Currently I have that work slated for JUH Alpha 4, as it requires the key/value session state storage that's the key feature of JUH Alpha 3 first.

So it's going to be a month or so until I get around to implementing config & settings.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

RPTroll wrote:
Tue Apr 13, 2021 8:40 am
This is very nice work. Thank you for sharing your expertise.
Thank you! I'm happy I can give back!

I hope people find some good use in it.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"


User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

JoeDuncan wrote:
Tue Apr 13, 2021 12:19 pm
wolph42 wrote:
Tue Apr 13, 2021 6:47 am
I would say that the time out is something ideally set by the coder in the function itself.
My plan is to eventually provide configuration settings for most of the "magic numbers" in JUH.
On second glance, config settings would not solve this.

I'll make it an optional override parameter when defining the event, default to something reasonable, but can be set to whatever you like if you want.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

wolph42 wrote:
Tue Apr 13, 2021 12:29 pm
for the onViewPortChange this is the token Blackwing created. You can use it for testing purposes
I'll give it a shot when I'm done work. What does it do?
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

wolph42 wrote:
Tue Apr 13, 2021 12:29 pm
for the onViewPortChange this is the token Blackwing created. You can use it for testing purposes
Couldn't resist, so I took a look. Sadly, I solved that yesterday :(

I'm doing the same thing (but the other way around) in my mouse event handler to go from viewport to map coords:

mapX = startX + (viewportX / zoomFactor)
mapY = startY + (viewportY / zoomFactor)
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by wolph42 »

JoeDuncan wrote:
Tue Apr 13, 2021 1:39 pm
wolph42 wrote:
Tue Apr 13, 2021 12:29 pm
for the onViewPortChange this is the token Blackwing created. You can use it for testing purposes
Couldn't resist, so I took a look. Sadly, I solved that yesterday :(

I'm doing the same thing (but the other way around) in my mouse event handler to go from viewport to map coords:

mapX = startX + (viewportX / zoomFactor)
mapY = startY + (viewportY / zoomFactor)
ah well, was worth a shot

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by wolph42 »

JoeDuncan wrote:
Tue Apr 13, 2021 12:19 pm
My plan is to eventually provide configuration settings for most of the "magic numbers" in JUH.
I thought so much, and that was more or less my point which apparently did not come accross: if you want to use multiple but different overlay effects which can vary from light to heavy you might want to be able to set the 'refresh rate' per function. Im not sure how realistic nor how feasible that is, but it allows for a greater variance in usage and application. Putting it in a config is a bit moot as I can also just dive into your code and presuming you structured it properly it wouldn't be hard to change that number.

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

wolph42 wrote:
Tue Apr 13, 2021 3:59 pm
I thought so much, and that was more or less my point which apparently did not come accross: if you want to use multiple but different overlay effects which can vary from light to heavy you might want to be able to set the 'refresh rate' per function. Im not sure how realistic nor how feasible that is,
It's not just feasible, it's already done. All of the ongoing processes in JUH are launched with "setInterval@lib:timer", which allows you to specify the interval duration (milliseconds between calls).

So for instance, the ambient sound manager runs every 333ms, the event manager every 250ms, the animated lighting manager every 125ms and the background animation manager every 42ms, with the upcoming JUH v0.2a, all on their own threads too!
Full Bleed wrote:
Tue Apr 13, 2021 1:49 am
Can it trigger a proper "hard" object selection (showing object macros in a selection window) like I'm on the object layer? I really want his functionality for object layer and hidden layer tokens.
Ok, here you go. I've attached a custom down 'n dirty one-off lib token for you, implementing the above that I whipped together on my lunch from the current state of JUH v0.2a. There's no docs or polish, and I can definitely improve it (pre-caching object lists in JS for one), but should be workable for what you want.

Some small caveats:

I have not found a way to launch a macro from non-library tokens yet, and I doubt you want your map objects all called "lib:<something>" especially if they are visible to players. So I've had to use the "Label" field to identify clickable objects, rather than them actually having an "onObjectClicked" macro and calling that (works fine for lib: tokens and global events though). Also, it currently doesn't handle conflicts with tokens on the token layer (working on it) so for instance if you try to select a token, but where you click overlaps with a clickable object - this code will select the object instead (FYI)

Quickstart
-drop the "lib:FullBleed" token onto your campaign
-change the label of clickable objects on the hidden or object layers to "isClickable"
-reload the campaign or click on "openTouchScreen" on the lib token
-click on stuff

To close the mouse handler, just click the "closeTouchScreen" button on the lib.

Let me know if that does what you needed!
Attachments
libFullBleed.rptok
(39.35 KiB) Downloaded 31 times
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

wolph42 wrote:
Mon Apr 12, 2021 3:09 am
onChangeFacing (or onChangeTokenFacing)
onChangeZoom (oronChangeViewport)
Can you give me some example of proposed use cases for these events?

I'm implementing these two, plus "onPlayerConnect" and "onPlayerDisconnect" tonight.

The latter are pretty obvious, but use cases for the former would help direct my implementation.

thx
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by wolph42 »

the facing part: when someone is mounted on e.g. a horse, you can set it so that it moves along with the token when the token moves, rotation however is undetectable. So: mounted token

the viewport part: this allows to tie in the overlay directly to the MT Map interface, you could do simply things like a chandelier on the ceiling that is actually overhead of tokens (without interfering with selection), a target marker to come into display, a HUD next to the token when you hover over it,
spell effects and animations (now done clunkily on map) can be moved to overlay.

Other none overlay could be forcing player screen to a certain view (not gm view perse), when they change it: snap it back. Put a bunch of me's in one room and we probably come up with loads more stuff.

User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by JoeDuncan »

wolph42 wrote:
Wed Apr 14, 2021 3:33 am
the facing part: when someone is mounted on e.g. a horse, you can set it so that it moves along with the token when the token moves, rotation however is undetectable. So: mounted token
Gotcha, you want a token to rotate in concert with another token.

It's probably fine to continuously fire a "rotate" event while the user is turning the wheel - this is what maptool itself does internally (when you rotate a token, it's updated constantly, not just at the end) i.e. if you have a bulls eye lantern light on, the light field updates as you rotate, not just at the end. Since it would be basically only handling a handful of tokens at a time, even a continuous rotate event should have minimal impact. I'll leave that up to the user though, and implement "onRotateStart", "onRotating" and "onRotateEnd" - then the user can decide for themselves what model to use.
wolph42 wrote:
Wed Apr 14, 2021 3:33 am
the viewport part: this allows to tie in the overlay directly to the MT Map interface, you could do simply things like a chandelier on the ceiling that is actually overhead of tokens (without interfering with selection), a target marker to come into display, a HUD next to the token when you hover over it,
spell effects and animations (now done clunkily on map) can be moved to overlay.
Not a problem, I've literally done this before, I can do it again. It's exactly the same use case too:

There's a transparent web overlay on top of a static image containing embedded information. You want the overlay to display "augmented reality" (AR) sprites (and other things) allowing interaction with the objects embedded in the static "background" (from the overlay's view). However, zooming is a continuous operation, and redrawing the AR correspondence to the background map in realtime while zooming is too expensive, so you only need to redraw the full overlay when the zoom is completed. Correct?

I built an entire live annotation system for medical image viewing, where the image was just a plain JPG/PNG, but the backend forwarded what we called "shadow annotations" (metadata on relevant "objects" in the static image) to our frontend, which was a transparent webview placed over the image. The overlay caught the mouse events, translated them into server cmds, sent them to the server which updated the image and sent back new metadata.

Doing this again but for Maptool should be even easier, as I don't have to worry about FDA approval or "fatal" severity bugs!

I'm going to start with providing the request "onZoomEnd" event (which I already implemented last night). Unlike for rotate, I don't think there's much need or call to implement "onZoomStart" or "onZooming" - there's not much utility in that and many wasted cycles.
wolph42 wrote:
Wed Apr 14, 2021 3:33 am
spell effects and animations (now done clunkily on map) can be moved to overlay.
Hey now! I've removed much of the "clunk" in JUH alpha 2! I get your point though: animating sprites in a web overlay is always going to be more performant than driving maptool token image flip macros from JS in a webview. I'm not sure I want my spell animations to be on top of my players, but that's just me.

You've just inspired another milestone for JUH alpha 4 - an general AR system for interacting with tokens/objects on the map, and displaying related info overlayed on top!

The rotate and zoom events will be in alpha 2 though.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - Event suggestions for v0.2a?

Post by aliasmask »

JoeDuncan wrote:
Mon Apr 12, 2021 7:37 pm
Already got "onMouseClick", "onMouseDown" and "onMouseUp" written, they work great!

It won't be released until JUH alpha 2 this coming Sunday though (the 18th).

However, if you need something before then I can whip up a quick one-off lib implementing the basic mouse events for you.
Is there a right click option or double click option? I know I've done onTokenSelect, onTokenDeSelect and onTokenReSelect (like a double click, but slower).

Post Reply

Return to “User Creations”