RPTools.net

Discussion and Support

Skip to content

It is currently Wed Oct 18, 2017 5:21 pm 






Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6237
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Sun Mar 21, 2010 11:31 pm 
My tests are done with a mostly empty frame (designed specifically to test the number of outputs), and that's where 4 repeats of the output come from. I don't know why I get that many, though; the code seems to indicate that it should fire a maximum of three times.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sat Apr 12, 2008 3:17 pm
Posts: 278
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Tue Apr 13, 2010 5:18 pm 
Has anyone made any progress with making onChangeSelection more reliable?

I keep thinking how neat it would be to have a default attack or spell macro hooked up so that you could click enemy tokens Diablo-style.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6237
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Tue Apr 13, 2010 6:04 pm 
AFAIK, nobody's doing any work on it - it is what it is.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Giant
 
Joined: Mon May 04, 2009 2:44 pm
Posts: 214
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Fri Apr 23, 2010 10:03 am 
Quote:
If you just change the properties manually or with a macro that doesn't refresh the frame, then no, the frame won't be updated.


I just noticed something last night, and it could be due to a cold induced daze, I'm not sure.

But when I have a macro up using onChangeSelection that displays a token property (Say Current Hit Points), and I make a manual change to it, it automatically updates. It seems to relaunch the macro without having to call it again.

This makes things a lot easier. I can have the quick sheet show numbers for stuff and when they change (due to bless, bard song, etc), it updates so the players can see.

Very cool!

Once again, maptools ROCKS!

Skester
(still in a cold induced daze and enjoying it)


Top
 Profile  
 
 Offline
Dragon
 
Joined: Fri Apr 23, 2010 7:17 pm
Posts: 317
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Fri Apr 30, 2010 12:27 am 
So it seems pretty obvious when 'onChangeImpersonated' and 'onChangeSelection' fire, but what about 'onChangeToken'? Is there more information than just "doesn't always work perfectly"? What token has to change in order for the event to fire? Is it the token that was current when the [frame:] call was made? What is it that makes it "not perfect"? It seems like this is the functionality people might be searching for to handle manual or automated updates, so what are the deficiencies, and when--if ever--CAN we rely on this event? Is it so poorly implemented and/or badly understood that we should just ignore its existence entirely?

_________________
"He knows not how to know who knows not also how to un-know." --Sir Richard Burton


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6237
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Fri Apr 30, 2010 12:54 pm 
prestidigitator wrote:
So it seems pretty obvious when 'onChangeImpersonated' and 'onChangeSelection' fire, but what about 'onChangeToken'? Is there more information than just "doesn't always work perfectly"? What token has to change in order for the event to fire? Is it the token that was current when the [frame:] call was made? What is it that makes it "not perfect"? It seems like this is the functionality people might be searching for to handle manual or automated updates, so what are the deficiencies, and when--if ever--CAN we rely on this event? Is it so poorly implemented and/or badly understood that we should just ignore its existence entirely?


From Craig's comments:
Quote:
The change token one is kinda tricky, it gets fired often even when it appers there has been no change to the token -- but MapTool has updated something internally that is not visible to either the user or macros -- this is why it is reccomended to have your macro update the dialog/frame when changing a token if possible, it will lead to the code being executed a lot less often


What constitutes a "change" to a token is not strictly a change in a property manipulable by macro functions or by the UI. It could - in addition to a property value change or changing it to an NPC or something - be something internal to the token's XML that is handled entirely within MapTool, and therefore I wouldn't consider it a reliable means to update a frame or dialog. Now, such an internal change may be irrelevant to any value important to the user, meaning that the macro being called by onChangeToken is run for no particular reason, but doesn't fail.

In all cases, what constitutes an event intuitively might not be the same way internally (hence why "onChangeSelection" may fire anywhere between 1 to 4 times every time you select a token). I would expect that onChangeToken probably works as reliably as the others, but you can't predict how many times it will fire, and it may fire when you haven't done anything yourself to change the token (but MapTool has made a modification).

Automatic updating is trivially handled via macro anyway; an explicit call to the frame-generating macro does the trick as easily as a callback.


Edit: Some specifics

I put together a very small campaign file that tests what might fire onChangeToken.

First off, I get a null pointer exception thrown every time I try it - something in the code is having some troubles. However, the events still fire (and the testing frame still does the trick).

So:
Moving a token fires the event twice.
Opening the Edit Token dialog (whether you change anything or not) fires the event twice
Running a macro that changes token properties fires the event twice (including things like the special token.whatever variables, it seems)
Changing a token's type (from NPC to PC) fires an additional change event on top of any property change events being fired
Setting a state or clearing it via right-click fires the event once
changing size fires the event once
Adding a light source fires the event once
Initiative actions have no effect on onChangeToken
Flipping a token horizontally or vertically seems to throw MapTool into and endless loop of onChangeToken events
Halo changes fire the event once
Snap to grid changes fire the event once

There are probably others I couldn't think of, but I ran through the right click menu and some experimental macros. The biggest problem I had was that every onChangeToken event also triggered a null pointer exception.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
 Offline
Dragon
 
Joined: Fri Apr 23, 2010 7:17 pm
Posts: 317
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Sat May 01, 2010 12:56 am 
Huh. Okay. I've been fooling with it a little since I posted, and it seems to be working relatively well for me for a simple frame-based character sheet that switches between view and edit states. I guess the part that saves it might be that I really expect that nothing (else) is done to the token while in the edit state. When in the view state, I really don't care if the frame is re-painted a couple times, though when multiple players are messing with things I guess it could get a bit more messy. Hmm.

_________________
"He knows not how to know who knows not also how to un-know." --Sir Richard Burton


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sat Apr 12, 2008 3:17 pm
Posts: 278
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Mon Jun 28, 2010 7:01 pm 
Quote:
But when I have a macro up using onChangeSelection that displays a token property (Say Current Hit Points), and I make a manual change to it, it automatically updates. It seems to relaunch the macro without having to call it again.


Is this happening for Campaign properties? Or for hidden props on the token? Details?


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Sun Aug 12, 2007 9:49 am
Posts: 1362
Location: Midsomer Norton, (Near Bath), UK
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Fri Jul 16, 2010 2:15 am 
How would I get this to run on 'Submit' from a Dialogue or Frame?

I give the PC's options for any appropriate modifiers when they make a roll, and want to use this for a GM pop up, but rather than clicking from chat, when they submit their info (and thus end that macro) one pops up for the gm to use for any hidden modifiers.

I am still getting back in to the 'MTscript' mind set having been away for a year or so

_________________
Cweord

This message has been spell checked by Freudcheck - any mistakes are purley a figment of your imagination.
-------
My Tokens Directory
http://gallery.rptools.net/v/contrib/Cweord/Character_Tokens/


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6237
 Post subject: Re: Are you aware of this: onChangeSelection
PostPosted: Fri Jul 16, 2010 10:54 am 
toyrobots wrote:
Quote:
But when I have a macro up using onChangeSelection that displays a token property (Say Current Hit Points), and I make a manual change to it, it automatically updates. It seems to relaunch the macro without having to call it again.


Is this happening for Campaign properties? Or for hidden props on the token? Details?



Are you sure you're using "onChangeSelection" and not "onChangeToken"?

Quote:
How would I get this to run on 'Submit' from a Dialogue or Frame?

I give the PC's options for any appropriate modifiers when they make a roll, and want to use this for a GM pop up, but rather than clicking from chat, when they submit their info (and thus end that macro) one pops up for the gm to use for any hidden modifiers.

I am still getting back in to the 'MTscript' mind set having been away for a year or so


onChangeSelection won't do anything like that - it simply triggers a particular macro whenever the list of selected tokens changes (in fact, it doesn't have any specific interaction with submit buttons or anything).

That's fine - except that you cannot (easily) direct a dialog to pop up on another user's PC. There is a trick involving macroLinks that can do it, but it's somewhat of a pain in the butt.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3

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 are 2 users online :: 0 registered, 0 hidden and 2 guests (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 2 guests





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman