I've created a lib token with two types of events, one that runs only once after you drag a new token onto the map. And one event that triggers every time you mouseover a DIFFERENT token.
The below instructions can be found in the 'Notes' of the lib token attached. To get this working, download the token, drag/drop it into you campaign file, follow at least the first 5 lines of instructions (but do read the rest, cause there are some catches) and you're golden.
For each type of event there are two macro's, one which is triggered on that event and one that is called by the triggered macro. The latter ends its name with 'Macro' and these are the macros that you can edit with you own code.
Make sure that the 'Show stat sheet on mouse over' is turned on:
menu--> edit --> preferences --> Interactions --> 'tokens' box: at the bottom --> check the checkbox
Add the following two lines to the Basic property set:
The property set can be set here:
menu--> edit --> Campaign Properties --> Token Properties --> Basic --> copy the lines --> Update --> OK
You can edit the two macro's that end with 'Macro'. Here you can put in code you like to have executed.
- if you use a different set for your tokens that you need to set the properties for that set
- if you only want to use the 'run once event' (onMouseOverOnceVar) or the 'run every time I hover over event' (onMouseOverPermanentVar) or both, add the lines correspondingly.
- the 'run once event' has a selectTokens() command that will select the token hovered over. This can be removed
- the 'run every time event' doesn't have a selectTokens() command, but you can add it if you like.
- If you 'cancel' the 'run once event' it will be triggered a 2nd time. Not sure why. If you however click 'ok' then it will run only once.
- There are two optional macros on this lib token. These you can use to either fix an onMouseOver event for the 'every time' type if its broken. Or reset the 'run once event' to run again. To Use: Just drag the macros to the campaign panel, select the token and run the macro.
- If the permanent event is broken for ONE token, it won't work anymore for ANY token!!!
- One way to break this is by copying a selected token. The copied token won't trigger the onMouseOverEvent. This is because as soon as you hover over a token the macro call is deleted and only restored if you hover of another token (that has that macro call active). The token ID of the last token that activated the event is stored in the lib. The ID's of the copied tokens however are unknown to the library. The only way to get those working is by using the 'resetPermanentEvent' macro.
Suggestions for changes
Code: Select all
[h: link = macroLinkText("onMouseOverPermanentMacro@Lib:onMouseOver", "self", me, "selected")]
Code: Select all
[h: link = macroLinkText("onMouseOverPermanentMacro@Lib:onMouseOver", "none", me, "selected")]