Triggerables - draw an area and link a macro to it AND/OR apply core features.
ORIGINAL POST
a. same as bot. There is a UI where you can link macros to area names
b. if an area is called e.g. trap15 then the corresponding macro is "areaTrigger_trap15"
c. similar to onTokenMove. There is only the macro 'areaTrigger' and when you move over a trigger area that macro is run. Either with the areaName as argument or not.
d. additionally you could have a core set of functions that you can assign to an area (so no macro involvement) these could be:
- limit movement
- block movement
- limit vision (see other thread for further details)
----
Passed on arguments:
array of json objects. Each object consist out of "tokenName":"triggerType"
triggerTypes are:
triggerType ("start on area", "end on area", "total distance moved", " same length='total distance moved' - 'distance moved on trigger area' ")
- noInteraction (0000) should never happen (as nothing is triggered)
- movedOn (0110) move onto the triggerArea
- movedOff (1010) move off the triggerArea
- movedOver (0010) move over the triggerArea
- movedNot (1101) when you move the token but place it back on its original spot (without waypoints)
- movedReturn (1110) when you move the token AND use way points AND leave the token but end the move onto the token
- movedRemain (1111) when you move but remain on the token during the entire move (both the path and the triggerpath are the same length)
SUMMARY OF DISCUSSION SO FAR
1. triggerables can both be set up for drawables and tokens (assets, but I find the term tokens less arbitrary).
2. a UI is required to link a 'happening' to a triggerable
3. drawables should be selectable, moveables etc. and if thats the case than activating the UI for both drawables and token can be the same and can be activated the same: select either by mouse click or area select and hit some menu button: create trigger. Question: should tokens and drawables be selectable at the same time or not? (e.g. are they on the same layer?)
4. multiple tokens and/or drawables (triggerables) can be selected at once and the UI will apply 'the happening' to all.
5. overlapping triggerables are triggered by z-order, lowest first.
6. and now for the spaghetti code: the UI.
Code: Select all
TEXTFIELDS:
o Enter the name of this trigger (will be used to link triggerables). If you leave this blank its NOT a triggerable (so below functions will NOT work).
o Enter macro_name@lib:token that will be executed on trigger. Leave blank for none.
o Enter audio file name (dropdownbox?). Leave blank for none.
o Enter movement formula with M as default movement variable (e.g. "M+1","M*2","(M-1)*3","(M+4)/3") this will influence the movement counter beneath your token when you drag it. Leave blank for default. Note that 'difficult terrain' *increases* the move counter!! (so e.g. M*2 not M/2).
Question: should the movement influencer do anything else? e.g. also [wfunc]getMoveCount[/wfunc]
CHECKBOXES:
o Link ALL triggerables with the same name (unchecked will trigger the event for EVERY triggerable a token passes over also if they overlap; checked will trigger the event once per movement.
trigger the event on:
o movedOn move onto the triggerArea
o movedOff move off the triggerArea
o movedOver move over the triggerArea
o movedNot when you move the triggerArea but place it back on its original spot (without waypoints)
o movedReturn when you move the triggerArea AND use way points AND leave the triggerArea but end the move onto the triggerArea
o movedRemain when you move but remain on the triggerArea during the entire move (both the path and the triggerpath are the same length)
question: can you and what will happen if you set different event triggers for linked triggerables?
The reason I ask is because I know you want 'coordinates' and 'pathlength' returned as arguments and as suggested, you would want that in the same format as the other functions (like getLastPath) thats [{x:0;y:12},{x:0;y:13},etc]. And when *is* a triggerable triggered? On pixel touch or on 50%+ ? Personally I'm in favour of the simplest solution: pixel touch. In that case the cell-coordinate where that pixel resided will be returned as argument.