CodaBool / terminal

A FoundryVTT module to create interactive terminals with custom content and theming
3 stars 1 forks source link

[REQUEST] - Scripts instead of macros #12

Closed Vespilo closed 2 months ago

Vespilo commented 3 months ago

Is your feature request related to a problem? Please describe. With the introduction of Foundry V12's region we got new ways to execute scripts without having to amass macros. I'm not sure if it is possible for a module to use it the same way, but it would clean up the macro collection if scripts could directly be put into the terminal's button functionality

Describe the solution you'd like A field or dialog for adding buttons to the console that can execute scripts rather than macros, similar to the region behavior options

Describe alternatives you've considered Macros as usual are viable, it's merely a QOL feature that I'm not sure can be implemented or not

Additional context image

CodaBool commented 3 months ago

The Foundry source code isn't difficult to look into. I'll take some time to see how they do it.

It is definitely possible for a module to do this. I have seen a theripper93 module do this. Might have been the puzzle one, not sure.

CodaBool commented 2 months ago

Started a prototype but having second thoughts on how useful this will be. It is easier for me to just support Macros and not have the overhead of another way of running code.

prototype, (it's just UI, didn't code out running a script)

image

There currently is two ways of running code. There is the current macro method but there is also integration with Monk's Active Tile Triggers. I checked and they actually have a way to run inline code like you are wanting. I think that would be my recommendation for you to help clean up your macros (assuming you have already looked into the obvious solution of folders).

all that is needed is an active Monk's Active Tile Triggers module and you'll see the new checkbox

image

Follow the hover tooltip instructions to remove the default "When: Enter". Then write a trigger for "run code" like this

image

CodaBool commented 2 months ago

I will add support for executing region behaviors in a future update. That should be a good way to allow for inline scripts without any additional modules.