RPTools.net

Discussion and Support

Skip to content

It is currently Wed Mar 22, 2017 7:09 pm 






Reply to topic  [ 4 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9159
Location: Netherlands
 Post subject: Wolph42's drop in onMouseOverEvent (advanced)
PostPosted: Mon Apr 18, 2011 7:05 am 
Recently there was a discussion over the possible events in MT like onTokenMove, onSelectionChange, etc. These are officially supported by MT. There is however one event that is not officially supported but is available if you know how to implement: onMouseOver. The implementation is a pain and it has taken me about 4 hours of testing to get this right. The problem is not to trigger the event, the problem is to trigger the event AND you want to use the input() function. Using input() icw this trick will haywire MT, unless you do it right.

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.

INSTRUCTIONS

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:

*onMouseOverOnceVar:[macro("onMouseOverOnceEvent@lib:onMouseOver"):currentToken()]
*onMouseOverPermanentVar:[macro("onMouseOverPermanentEvent@lib:onMouseOver"):currentToken()]

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.

Note that:
- 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.
(can be also found in the 'Notes' section of the library token)
The macros will always send something to the chat when used. This might be useful or not. If not (so you want any output to chat ignored) then change the following line:
Code:
[h: link = macroLinkText("onMouseOverPermanentMacro@Lib:onMouseOver", "self", me, "selected")]

into
Code:
[h: link = macroLinkText("onMouseOverPermanentMacro@Lib:onMouseOver", "none", me, "selected")]

In both onMouseOverOnceEvent and onMouseOverPermanentEvent


lib-onMouseOver.rptok [82.41 KiB]
Downloaded 245 times

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II and onMouseOverEvent
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Last edited by wolph42 on Wed May 11, 2011 6:46 am, edited 2 times in total.
Top
 Profile  
 
User avatar  Offline
Demigod
 
Joined: Mon Jun 29, 2009 9:37 am
Posts: 3108
Location: Germany
 Post subject: Re: Wolph42's drop in onMouseOverEvent
PostPosted: Mon Apr 18, 2011 7:29 am 
Looks interesting, I hope I find time to toy around with it.

Thx for sharing

_________________
HELP: GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC.

most complete list of my maptool stuff


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9159
Location: Netherlands
 Post subject: Re: Wolph42's drop in onMouseOverEvent
PostPosted: Mon Apr 18, 2011 7:34 am 
Forgot to mention:
I've added a function that replaces the 'show dialog on new token', which allows the user a lot more versatility. This is also worth checking out. It makes use of one of the two events. Obviously you need to turn the show dialog off, this can also be found in the preferences.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II and onMouseOverEvent
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9159
Location: Netherlands
 Post subject: Re: Wolph42's drop in onMouseOverEvent (advanced)
PostPosted: Tue May 26, 2015 7:21 am 
added suggestion for change by bone white in OP.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II and onMouseOverEvent
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 4 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman