Stand alone init frame [Dev]

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Raoden wrote:What about the ability to double-click on a token to center your view on it and select it? I like what we're doing here, but Rumble might be right -- the default Init panel has a lot of bells and whistles attached to it already.
Good call. Yeah, I think when I wrote claim that I wasn't thinking straight. :) Anyway, that's definitely reproducible, I'm thinking with a click on the associated portrait, limited by ownership/GM status. Should not be overly hard to code that up.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Stand alone init frame

Post by Azhrei »

aliasmask wrote:
Raoden wrote:It's an ugly solution, but I suppose you could always just make a dummy Frame, make it tiny, and plop it over the default "Next" button.
But I'm more worried about the players doing it rather than me.
Can players even click it if you turn off Owner Permissions? I don't think so...

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Updated version with the click to center and select (works only in b68), appearance a little cleaner, and with some initial configurable display preferences.
Attachments
lib_init.rptok
(675.09 KiB) Downloaded 71 times
Add Token To Init.mtmacro
(724 Bytes) Downloaded 69 times
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

No new version quite yet, but I fiddled with this a bit more, and now have it set to allow individual user display settings including table width, picture size, etc. The GM settings are used until the player sets some of his own, saved according to their current player name.

I've also started setting up a suite of GM options for restricting information and access to what non-GM's can see. Still working on that one, but I think I'm making good progress.

Just a couple of issues have come to mind as I've been working on this:
1. The built-in init panel updates to all clients when changes happen. Any thought on how to do this efficiently and without sending out too much crap to the chatlog in the process?
2. Currently works via macroLink() in a frame, which requires an output parameter. Any thoughts on how best to all for something like the current function where players receiving init spits a message to the chatlog but npcs getting it does not?
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Stand alone init frame

Post by aliasmask »

Typically, NPCs don't have owners... so I'd make an owner check and send message to owner(s) when it becomes it's turn... or just don't send a message if token is NPC. But, with the macroLink updates to the other players they will get a blank line anyway.

But, a way to do it without sending a link via chat would be to set mouseover call to update from a lib token. I'm not sure about the few event that are available like onChangeSelection but I think there is a onTokenChange or something like that could work. Changing a property of that token could trigger in the frame an update.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Stand alone init frame

Post by Raoden »

aliasmask wrote:But, a way to do it without sending a link via chat would be to set mouseover call to update from a lib token. I'm not sure about the few event that are available like onChangeSelection but I think there is a onTokenChange or something like that could work. Changing a property of that token could trigger in the frame an update.
Interesting idea, but wouldn't it only work if the Lib token in question is on the current map?
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Stand alone init frame

Post by aliasmask »

I'm thinking if any frame, server or client has onChangeToken() then all you need to do is update any token that client/server can see (I don't know if it updates for tokens you can't see) and then it will run whatever code you want. I've never used onChangeToken() before, so I'm a little sketchy on implementation, but in theory it should work. Since token changes happen alot, you'll need to make some checks at the beginning as to not tax your system. I would say put your code on a lib token. The first check would be to test for that lib token's updates. Then test a property on that lib token, perhaps updateInit = 0/1? Set to 1 when ever there is an init change using the macro button.... hmm I just had a thought. If we set on that lib currentInit = tokenid and mapInit = [getInitiativeToken()] and make the next check to see if those match, we wouldn't need a different NEXT button to hook in to it. There would definitely need to be some experimentation to see if it can work on a different a map than the lib file is on. But this sounds promising.

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Yeah, if anybody has definitive info on how (if it exists) the onChangeToken() or onTokenChange() functions work, that would be very handy. I'm thinking, since all the data is stored on the lib, then whenever anything changes on the lib it should update the frames. But I've tried onChangeToken("Lib:init") in place of onChangeSelection() (which works) and yet the frames aren't updating.

The good news: I've gotten a ton of cool stuff working, and even figured out how to report to all players if and only if a PC get initiative.
In short, it's really coming along, but if I can't get this auto-updating thing going, the panel will be all but useless.

HELP!!!! :D

EDIT: I found this page: http://lmwcs.com/rptools/wiki/User:Verisimilar/Projects
and this seems to suggest there's no () associated with onChangeToken. This implies to my mind that this will fire the macro whenever ANY token is changed, or else when the currently selected token is changed. If the former, could be a major performance issue. If the latter, I might have to find some workaround using selectTokens() or something. Hmmmm.
Last edited by plothos on Mon Jun 14, 2010 4:20 pm, edited 1 time in total.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Stand alone init frame

Post by CoveredInFish »

It should work exactly as onSelectionChange. There is no function - its a html header entry. See my sticky.

I did not play around with this more .. so no help from me further than this.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Stand alone init frame

Post by Raoden »

So ... it fires anytime any Token is changed?
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Using onChangeToken now seems to work... mostly. It's updating and seems not to be firing too frequently, but it only works when you have a token selected. I added onChangeSelection as well, so that now it'll update when you select something, which will usually be required before do anything. And you'll still get updates when a PC gets init, even if your panel isn't updating. It's very awkward, and I'm worried about performance hits, but it's working okay.
Last edited by plothos on Mon Jun 14, 2010 4:47 pm, edited 1 time in total.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Raoden wrote:So ... it fires anytime any Token is changed?
Yeah, the way I have it set up it's firing based on changes to any token.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Okay, here's the updated lib.

Features:
  • 1. Tracks initiative of tokens and "events" which is intended for periodically recurring game elements like spell effects, evironmental elements, etc. Events can receive a "duration" which will decrease by 1 when the even receives initiative.
    2. Entries can be bumped up or down, or resorted by manually changing their initiative count.
    3. Display settings allow for customization, and are player-specific, so each player can set it up how they like it.
    4. Player access settings allow the GM to limit what players can do and how much they see. If tokens or events are hidden from players, they show up in italics in the GM's panel as a reminder.
    5. When a PC receives initiative all users get a notification, otherwise the panel is silent.
    6. If a player has the panel open, it will update whenever a token or your selection changes, though you must have a token selected for this to occur.
    7. Portraits are shown for tokens, if available, otherwise the token image is used.
    8. Events show a big E instead, and non-event entries (i.e. mystery tokens and such, show a silhouette image).
    9. Clicking a token's image will center the map on the token, and if using b68 or later will select said token as well (earlier version will not break, but will spit an undefined function message to the clicker's log).
Attachments
Display Init Panel.mtmacro
(715 Bytes) Downloaded 78 times
Add Token To Init.mtmacro
(724 Bytes) Downloaded 65 times
lib_init.rptok
(678.02 KiB) Downloaded 69 times
Last edited by plothos on Mon Jun 14, 2010 5:13 pm, edited 1 time in total.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Stand alone init frame

Post by CoveredInFish »

I played a little bit around with onChangeToken. The id of the token changed is appended to the macro.args. It seems like its really concatenated to it as string. So when I set macro.args my self in the macroLinkText()-call it probably messes things up.
whatITried

Code: Select all

[frame("onChange"): {
  <html>
    <head>
        <title>onChange</title>
        [h: link = macroLinkText("onChange@CAMPAIGN", "none")]
        <link rel='onChangeToken' type='macro' href='[r:link]'>
    </head>
    <body>
        <pre>[r:macro.args]</pre>
    </body>
  </html>
}] 

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Stand alone init frame

Post by plothos »

Playing around with this further, onChangeToken is a little wonky. I had a server and a client on the same PC. I would advance init and toggle back and forth between these to see if the frame was updated for the client. Just constantly advancing init usually but not always updated the client's panel. There seemed to be no rhyme nor reason to when it would fail to update. This is especially odd, since advancing init will always change the Lib's property "Initcount". Still, it's firing the vast majority of the time, and with selection changes also going on it seems to be working fairly well.

Also, I have yet to see it fail when a PC is reported to have init, so hopefully anytime anybody needs to move their token they'll get a fresh init panel. That's something, at least.

What I would really really like (attn. Azhrei!) is a function onChangeToken(id) that would let me specify a particular token that forces the updates.... and of course that reliably does it upon such changes.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

Post Reply

Return to “Drop-In Macro Resources”