Frames and Tabs and selection/removal.

If you have an idea for a new feature, please discuss it in the main MapTool forum first, then post a summary of the discussion here. Use the first Sticky as a template.

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

Post Reply
User avatar
celestian
Dragon
Posts: 276
Joined: Mon May 17, 2010 3:29 pm

Frames and Tabs and selection/removal.

Post by celestian »

I have 2 issues related to frames and those frames in a tab.

I have a "Sheet" for each NPC. That sheet is a small statblock with "links" to attack, adjust health/etc. These are used by the DM. I like to have the entire "encounter" sheets up and in a single tab "window".

Here is an example of what I am talking about:
http://www.evernote.com/l/ASDDMR6voAFMY ... YTpsqJSrs/

* See if the "npc sheet" page is visible and close it.
* During initiative if "npc sheet" is visible "select" it (bring to front?).

Here is the code I use for "if visible close" for when an NPC dies.

Code: Select all


[if(myHP <=0), code :{
		[h: sendToBack(myID)]
		[h: npcSheetFrame = strformat('NPC:'+getName(myID)+':%{myID}')]
		[h, if(isFrameVisible(npcSheetFrame)): closeFrame(npcSheetFrame)]
		
		[LOG_KILL(myID)]
		[h: gmOUT = concat(gmOUT,strformat("%{macro.return}"))]
		[h: outTxt = concat(outTxt,strformat("%{myName} is dead!"))]
		[h: setState("NPCDead", 1,myID)]
	};{}]
The only way the closeFrame works is if I have the window actually open and not in a "tab".

Is there a way around this? I like to have all my npc frames for a encounter open in a tab window.

Here is the code clip I use to attempt to "select" the frame during initiative.

(whoWent is a tokenID)

Code: Select all

	[h: npcSheetFrame = strformat('NPC:'+getName(whoWent)+':%{whoWent}')]
	[h, if(isNPC(whoWent) && isFrameVisible(npcSheetFrame)): resetFrame(npcSheetFrame)]

"resetFrame() doesn't "select" that tab.

Can either of these features be added to upcoming versions? It would really be convenient feature set to use.

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

Re: Frames and Tabs and selection/removal.

Post by aliasmask »

If your goal is to close a tabbed frame you don't need to check to see if it is visible. Frames are not "visible" if not currently selected in the tab group. resetFrame will remove a frame from a tabbed group, so you don't want to use that. You need to redraw the frame to bring to front. You shouldn't track the frame states based on the frame but through another method like a variable.

For example, always draw frame is NPC is not dead and always close frame when NPC is dead, then remove them from init.

User avatar
celestian
Dragon
Posts: 276
Joined: Mon May 17, 2010 3:29 pm

Re: Frames and Tabs and selection/removal.

Post by celestian »

aliasmask wrote:If your goal is to close a tabbed frame you don't need to check to see if it is visible. Frames are not "visible" if not currently selected in the tab group. resetFrame will remove a frame from a tabbed group, so you don't want to use that. You need to redraw the frame to bring to front. You shouldn't track the frame states based on the frame but through another method like a variable.
Taking out the "isVisible" before removal did fix the delete frame if tabbed in a window.

Setting up a "refresh" (UDF to load the frame) of the window w/o checking "isVisible" in initiative situation worked as well. If the frame isn't loaded it will do it which I can cope with.

Thank you once again for your help.

/bow

Post Reply

Return to “Feature Requests”