Joe's Ugly Hacks 'Drop-in' macro libraries - v0.2.5 [alpha]

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

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

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - v0.1 [alpha]

Post by JoeDuncan »

Full Bleed wrote:
Fri Apr 09, 2021 12:23 am
For example, I'm not sure I like the idea that someone could drop a potentially problematic executable into a campaign file.
Totally agreed. I'm not 100% positive, but from what I've already looked into, I'm pretty certain I could get an arbitrary executable to execute on a client's machine too, so that should *definitely* be fixed!

Executable binaries should definitely be barred, although JS files should be allowed in order to enable proper multi-threading with webworkers.
"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 - v0.1 [alpha]

Post by JoeDuncan »

Full Bleed wrote:
Fri Apr 09, 2021 12:23 am
That doesn't, however, mean that I don't want the option for local audio storage and distribution...
On another note, that's only ONE of JUH's basic features though, I'd love to hear what you think about the other parts of JUH too!
"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 - v0.1 [alpha]

Post by Full Bleed »

JoeDuncan wrote:
Fri Apr 09, 2021 3:27 pm
Full Bleed wrote:
Fri Apr 09, 2021 12:23 am
For example, I'm not sure I like the idea that someone could drop a potentially problematic executable into a campaign file.
Totally agreed. I'm not 100% positive, but from what I've already looked into, I'm pretty certain I could get an arbitrary executable to execute on a client's machine too, so that should *definitely* be fixed!

Executable binaries should definitely be barred, although JS files should be allowed in order to enable proper multi-threading with webworkers.
I had more to say on the subject but limited myself because I'd like to give the devs a chance to look more closely at this before alarming anyone. But it goes without saying that, historically, users have had little to fear from downloading and checking out or debugging campaign files from relatively unknown sources... but seeing what you've uncovered here makes me pause.

Hence the suggestion for new, appropriately named, asset acquisition functions and asset content filtering. Preferably done at the same time so this "new" functionality isn't lost.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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 - v0.1 [alpha]

Post by wolph42 »

JoeDuncan wrote:
Fri Apr 09, 2021 3:27 pm
Full Bleed wrote:
Fri Apr 09, 2021 12:23 am
For example, I'm not sure I like the idea that someone could drop a potentially problematic executable into a campaign file.
Totally agreed. I'm not 100% positive, but from what I've already looked into, I'm pretty certain I could get an arbitrary executable to execute on a client's machine too, so that should *definitely* be fixed!

Executable binaries should definitely be barred, although JS files should be allowed in order to enable proper multi-threading with webworkers.
I've informed the devs about this and asked t look into the .exe matter.

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

Joe's Ugly Hacks 'Drop-in' macro libraries - v0.2 [alpha]

Post by JoeDuncan »

(content moved to OP)
Attachments
JoesUglyHacks_0.2a.cmpgn
(11.28 MiB) Downloaded 24 times
Last edited by JoeDuncan on Wed Dec 29, 2021 11:06 pm, edited 3 times 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

Joe's Ugly Hacks 'Drop-in' macro libraries - v0.2 [alpha]

Post by JoeDuncan »

I just downloaded Maptool 1.11.4 and gave JUHa2 a try and it seems to work almost perfectly!

In fact performance seems better and I haven't even done anything yet! Everything but the animated lighting (and that I will fix post haste!) seems to work fine!

So give it a shot, and let me know what you guys think!
"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 - v0.1 [alpha]

Post by JoeDuncan »

Actually, the animated lighting issue wasn't because of Maptool 1.11.4, I had neglected to ensure that the lighting stamps were owned by the user.

I have updated the JUHa2 campaign file in the other post accordingly, should work fine in 1.11.4 now!
"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 - v0.1 [alpha]

Post by Full Bleed »

Hey Joe, good to see you back.

People left this alone for a loooong time... with the promise of what it was doing cropping up often enough to keep the ideas alive. But in just the last week or two, a group of intrepid musketeers on Discord (Blackwing, Reverend/Bubblobill, & Wolph42) have been hammering out a new Event Engine and Manager. It will be interesting to see how your approaches differ. ;)
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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 - v0.1 [alpha]

Post by wolph42 »

Hey Joe ("what are you doing with that gun in your hand")

First of all: good to hear that you're doing alright again! Welcome back to the virtual living :D.

it took me ages to finally pick up where you have left. I initially picked it up with Reverend (Bubblobill) but we more or less got stuck in your line of thought so I asked a friend of mine (Blackwing) to have a look and he basically wrote the entire JS engine a new from the ground up, also using the latest features that MT now has, making it a LOT more comprehensible and clean (still not as clean as we would have liked but close enough). The general idea is the same though: timer event and hooking in events into the timer. The approach however is vastly different.

It would be nice to join efforts so we don't do stuff twice, but the big caveat here is that the discussion is taking place on discord (of which you've expressed your dislike).

For now I've attached the latest version to this post so you can have a look to 'our' approach:
https://www.dropbox.com/s/1z5c8i07ni58y ... cmpgn?dl=1

Blackwing
Kobold
Posts: 6
Joined: Tue Dec 21, 2021 8:50 am

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - v0.1 [alpha]

Post by Blackwing »

Hiya Joe,

Thought I'd shed a little light on our work.

Yeah we did a major redesign/rewrite, but conceptually based on similar principles (Javascript timers, eventlisteners etc.) and thought to take advantage of Maptool's new features of being able to have javascript files clean in a macro and then include them in the HTML through the script tag like this:

Code: Select all

<script src = "lib://EventEngine/macro/EventEngine.js?cachelib=false"></script>. 
Due to that capability it's got a pretty clear separation between the Javascript/HTML and the MTScript side. It uses some ES6 features like classes.

The center of it are the different Event Classes that have a uniform interface but handle event specific things themselves (like hooking themselves with an event listener to a particular event). The whole things has been written so that the Javascript engine side can be developed and tested using a regular browser like Firefox or Chrome and with only minimal MT-specific handling in the Javascript code.

On top of that is the MT side of things handling starting stopping etc as well as macro's for feeding back data and of course the handlers to react to the events triggering.

Blackwing
Kobold
Posts: 6
Joined: Tue Dec 21, 2021 8:50 am

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - v0.2 [alpha]

Post by Blackwing »

JoeDuncan wrote:
Mon Dec 20, 2021 11:11 pm
For the JUH to run automatically, it must be launched from "onCampaignLoad". Maptool calls "onCampaignLoad" when the campaign is loaded, on the server when it's started, on each player's client when they join, and on the server when it is stopped. Additionally, whenever Maptool starts a server, stops a server or connects/disconnects a player from a server - IT CLOSES ALL THE OPEN OVERLAYS IN THE CLIENT WITHOUT TEMRINATING THEIR PROCESSING. Sadly, for the JUH, because we are using indefinite timers running in JS in the HTML overlays, this leaves processes running in an overlay that can no longer be accessed (by any means I have tried). The only solution is close and restart Maptool. So if you are a player, you MUST close all the JUH processes (with the big red KILL ALL button) before disconnecting from a server, or you will have to restart Maptool before reconnecting. Similarly, if you are running a game as a GM, you MUST close all the JUH processes before either starting, or stopping a server, or you will be left with unkillable processes in your Maptool and will be forced to close and restart it.
Not sure if this will help you or not, but the terminating of the overlays will cause the "unload" event to fire. If you attach a listener to the "unload" event of the body of the overlay you may be able to clean up before it's unreachable.

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

Re: Joe's Ugly Hacks 'Drop-in' macro libraries - v0.1 [alpha]

Post by JoeDuncan »

wolph42 wrote:
Tue Dec 21, 2021 6:46 am
Hey Joe ("what are you doing with that gun in your hand")

First of all: good to hear that you're doing alright again! Welcome back to the virtual living :D.
Thanks!
wolph42 wrote:
Tue Dec 21, 2021 6:46 am
It would be nice to join efforts so we don't do stuff twice, but the big caveat here is that the discussion is taking place on discord (of which you've expressed your dislike).

For now I've attached the latest version to this post so you can have a look to 'our' approach:
https://www.dropbox.com/s/1z5c8i07ni58y ... cmpgn?dl=1
Interesting. I'll take a look and let you know what I think.

I would point out though, that my event system is already built, functionally complete and available. Upgrading it to use the Ajax async calls won't take long at all.

Hope to hear from you all soon!
"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 - v0.1 [alpha]

Post by JoeDuncan »

JoeDuncan wrote:
Tue Dec 21, 2021 10:01 am
wolph42 wrote:
Tue Dec 21, 2021 6:46 am
or now I've attached the latest version to this post so you can have a look to 'our' approach:
https://www.dropbox.com/s/1z5c8i07ni58y ... cmpgn?dl=1
Interesting. I'll take a look and let you know what I think.
Ok, so I've downloaded it and gone through the code - it's an impressive amount of work. I like your hex grid handling routines, which is something I'd also been working on to support hex maps, but yours is nicer than mine, so I will *def* be borrowing some of those ideas. I don't think there's much danger of us duplicating any effort though, as the two projects appear to have vastly different goals and scopes.

The JUH is intended to be simple, clean and straightforward utilities; that can be used to build more complex things. It isn't meant or intended to (and won't) be a "do everything" swiss army knife kind of kit

For example with lib:events, I implemented a couple of basic events as examples, but the important part is that JUH provides an architecture for people to define their own events however they like. That was my goal with lib:events. I have absolutely no intention of implementing every event people might want - I built the JUH so they can implement them themselves.

You guys DO seem to be trying to implement every possible Maptool client and in-game event that you can think of that anyone would ever want, as well as every ancillary & somewhat related functionality (like seeing and hearing through walls etc...?). No offense, but it already seems to be suffering from a bad case of overengineering, feature creep and scope expansion :(

The JUH doesn't have nearly the same scope - my focus is on building minimal utilities that provide missing features, period (mostly ones I want to use in my campaign). I don't really have the time or interest to work on something with as large a scope as what you guys are trying to do, apologies :(

I am going to continue building the JUH with the plan I've got, and turn it into a stable Add-on library for Maptool that fills in some basic stuff with minimal functionality. You guys are more than welcome to incorporate the JUH libs into your project to provide some of the base functionality if you like, and I will happily collaborate on any changes you might need to the JUH.

Other than that though, the two projects are so different in scope and intent that I doubt we need worry much about stepping on each other's toes or duplicating effort.
"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 - v0.2 [alpha]

Post by JoeDuncan »

Blackwing wrote:
Tue Dec 21, 2021 9:24 am
Not sure if this will help you or not, but the terminating of the overlays will cause the "unload" event to fire. If you attach a listener to the "unload" event of the body of the overlay you may be able to clean up before it's unreachable.
That issue seems to have been resolved in 1.11.4. At least it didn't show up in my quick compatibility tests.

I'll implement the unload event for sure though (thanks for the reminder), should have thought of that earlier, it's just normally not reliable enough to count on "in the wild" - but Maptool is a constrained environment....
"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 - v0.1 [alpha]

Post by JoeDuncan »

Blackwing wrote:
Tue Dec 21, 2021 9:15 am
Hiya Joe,

Thought I'd shed a little light on our work.

Yeah we did a major redesign/rewrite, but conceptually based on similar principles (Javascript timers, eventlisteners etc.) and thought to take advantage of Maptool's new features of being able to have javascript files clean in a macro and then include them in the HTML through the script tag like this:

Code: Select all

<script src = "lib://EventEngine/macro/EventEngine.js?cachelib=false"></script>. 
Due to that capability it's got a pretty clear separation between the Javascript/HTML and the MTScript side. It uses some ES6 features like classes.
I'm aiming to convert the JUH into an Add-on, and separate much of that stuff out similarly myself as well.

I am liking a lot of the new features! This will also help with the multi-threading improvements I am working on as it makes it easier to offload processing to anon JS delegates from MTScript
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

Post Reply

Return to “Drop-In Macro Resources”