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
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

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

Post by JoeDuncan »

UPDATE Dec 30, 20201
==================

Hey all,

I'm updating this thread to be a generic JUH - feature requests/changes thread.

If you have any requests for new JUH features, or changes/modifications to existing JUH features, please post them here, and I will address them as soon as possible.

Cheers!


ORIGINAL POST
=============
Spoiler
Hey all,

I hope everyone is having a fine weekend! I have been isolating in my bedroom since I came down with the flu (or something - COVID negative thankfully!) so I've been working on JUH alpha 2!

I have essentially completed the custom configurable event system, and I have already implemented "onChangeMap", "onChangeOwner", "onChangeState", "onTokenSeen" and "onChangeImpersonation" as "pre-configured" events.

I can probably provide a couple more prefab events, but I'm not sure what would be most useful.

What kind of events have YOU always wanted to see in Maptool?

Your input is appreciated!

thx
Last edited by JoeDuncan on Thu Dec 30, 2021 3:06 pm, edited 1 time in total.
"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 »

Say "goodbye" to the "clunk" in your JUH animations!

Say "hello" to butter smooth JUH token animation!

I'm happy to announce (since nobody gave me any events to build) - I've just finished adding *MULTITHREADING* to the JUH animation processor! :D

Together with some optimizations of the animation spec itself (mostly removing labels and turning it all into arrays), I've achieved at least a 10x increase in JUH animation performance!

Stay tuned for the release of JUH alpha 2! Now with:

-custom events
-animated lighting
-*multithreading*

(release date: next weekend)
"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:
Sun Apr 11, 2021 6:53 pm
Nice! event handlers are useful, I'm curious what it will look like
The essential structure is like so:

-you register an event with: a label, a condition check macro, a callback macro and state packet
-condition check macros accept the current state packet, and return either false, or a new state packet
-the event processor then periodically iterates the list of events, and runs their condition check macro with the saved state
-if the condition is false, nothing else happens
-if the condition is a new state, first the event state is updated, then the callback macro is called
-callback macros currently receive the old state and the new state for processing (possibly just a delta if I can figure out how to get the event processor to generate state deltas agnostically)

For instance I register the following for "onChangeMap"

["change map", "checkChangeMap@lib:events", "onChangeMap@lib:events",["campsite"]]

"checkChangeMap" just gets the current map and compares it with the stored one ("campsite"), returning either "false" or the new map name
If "onProcessEvents" receives something other than "false" on the condition, it sets that as the new event check state, and then calls the callback with the old and new states

That's the basics anyways.

I have a loader that will scan for "lib:" tokens defining "onChangeMap" and "onChangeImpersonation" and automatically register them as callbacks. I'll likely do the same for tokens with "onChangeOwner", "onChangeState" or "onTokenSeen" defined as well.

The state packet can be literally anything you like for custom events, as long as the processing and interfaces match the spec (not fixed yet)
"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 »

interesting stuff, there are two events that I know have popped up in th epast:
onChangeFacing (or onChangeTokenFacing)
onChangeZoom (oronChangeViewport)

I know the former was discussed with the devs and wasn't picked up because its a bit volatile. When you rotate a token you use your mousewheel and you could take a few seconds to position the facing of the token, so when do you trigger the event?

The other one I realise has never been discussed and is something I could put up as a FREQ as well. This one is usefull for using overlays, you can detect a position of a token on the map and e.g. put a cloud over its head, but the viewport change (zoom) screws with that, note that this I is only usefull when the zoom level is returned (and not just the event) which should be doable with getZoom(). I'll put this up as a FREQ as well.

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
When you rotate a token you use your mousewheel and you could take a few seconds to position the facing of the token, so when do you trigger the event?
Yeah, we had that problem with the real time interaction UI I built for a medial imaging company I used to work for.

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".

It's also possible to use this method to provide interactive events like "onChangingFacing" that fires *while* you are performing an action, and then have the "onChangeFacing" fire as a terminal event when the action is over.

Funny - it was actually the zoom feature we used this technique for, as we dumbed down the resolution during zoom, but then needed to bring it back to full when the zoom was finished, and users zoomed with the mouse wheel!

Should be able to use the same technique with "onChangeZoom" too and then Bob's your uncle!

"onChangeFacing" and "onChangeZoom" on order, coming right up! (to be released with JUH Alpha 2!)
"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:
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.
Now that I'm thinking about it, I think we used this technique for our rotation as well!

Literally the same methods, so I know it will work just fine.
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

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

Post by Full Bleed »

Not sure what your limitations are, but what about an onObjectSelection event?

Use case: viewtopic.php?f=20&t=28828&p=277061
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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 »

Full Bleed wrote:
Mon Apr 12, 2021 4:40 pm
Not sure what your limitations are,
Dude, now you're just thinking wrong!

I always start by assuming I don't have any limitations - but that the world does - and then I assume they can be overcome and try everything I can think of to get around them.
Full Bleed wrote:
Mon Apr 12, 2021 4:40 pm
but what about an onObjectSelection event?
Use case: viewtopic.php?f=20&t=28828&p=277061
Easily. Any Javascript mouse event can be proxied to the macro layer through an overlay. Just checked and it seems to work just fine (Anyways, there's like a half-dozen other ways to do it if I hit any snags)

Now that you've made me think of it, what I'm going to do is implement the following basic mouse events:

-onMouseDown
-onMouseUp
-onMouseOver
-onMouseOut
-onMouseClick
-onMouseMove

(kicking myself for missing this earlier, they're pretty much the most obvious events to implement! duh)

Then you can just subscribe to "onMouseClick", which will feed you the Maptool screen coords, check if there's an object there and do whatever you like.

Possibly I can make it even easier by making the check automatic for tokens with "onMouseClick" defined and then just run it.

Would that do?
Last edited by JoeDuncan on Mon Apr 12, 2021 7:38 pm, edited 1 time in total.
"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 »

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.
"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 »

Woot! Got "onMouseMove", "onMouseOut" and "onMouseOver" working great too! :D

Not a problem to add an "onObjectClicked" event to JUH for you out of the box either!

("onObjectClicked" makes more semantic sense than "onObjectSelected" because while I can make a mouse click select an object, I have not yet found a way to force the UI to change layer.)

Stay tuned for JUH alpha 2, coming to virtual worlds near you this weekend! Now featuring:

-improved token animation
-animated lighting system!
-custom events!
-multi-threading!
-MOUSE EVENTS!
-free pie!*





(* I lied, there is no pie)
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

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

Post by Full Bleed »

Nice work. Not sure what the overhead for these events are going to be but its very cool to see that they can and are being done.

Out of curiosity, you seem quite experienced with JS... why not work on MT proper? Can't imagine that all this work wouldn't have a greater and more lasting impact there.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

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

Post by Full Bleed »

JoeDuncan wrote:
Mon Apr 12, 2021 11:23 pm
Not a problem to add an "onObjectClicked" event to JUH for you out of the box either!

("onObjectClicked" makes more semantic sense than "onObjectSelected" because while I can make a mouse click select an object, I have not yet found a way to force the UI to change layer.)
I think I have a FREQ in for a function to change active layer, but not sure when/if that will ever be implemented.

So what happens when clicking on an object through the token layer (the "soft" selection that displays object notes) with this event? 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.
-free pie!*

(* I lied, there is no pie)
I'm out.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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 »

Full Bleed wrote:
Tue Apr 13, 2021 1:26 am
Nice work. Not sure what the overhead for these events are going to be but its very cool to see that they can and are being done.
Not much from what I can tell so far, JS is pretty optimized.
Full Bleed wrote:
Tue Apr 13, 2021 1:26 am
...why not work on MT proper?
The short answer is what I'm implementing in macros is trivial, while working with the Maptool source... is not :(
Full Bleed wrote:
Tue Apr 13, 2021 1:26 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.
Yes, this works just fine. Already implemented & tested.

As I said though, while I can do "selectTokens" to select an object on the object layer (so you see it's macros in the "selection" window) - it *doesn't* change the active layer, so there's no visible indication that the object is selected (as you will still be on the token layer).
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"


Post Reply

Return to “User Creations”