PDA

View Full Version : Get window reference of ct_entry given the node



Ken L
December 2nd, 2017, 01:29
Last night after doing an effect plugin, I tried to look for for a way to do another CT plugin but got stumped.

The general Idea is that given a Node of a ct_entry/ct_client_entry, how do I then properly get the window instance of it to utilize window functions on it? Unlike something global, or opening a generic window, I wish to get the ct_entry or ct_client_entry, window within the combat tracker.

Ken L
December 2nd, 2017, 03:23
The closest solution I can get now after unboxing this from another angle, is to grab the entire combat tracker window via findWIndow, and use a ct_entry unique identifier to zone in on the entry. This way you'll automatically have the windowlist of ct_entry, and you can cherry pick from the node data.

It's easy to get the node data if you have the window, but it's difficult to re-acquire it if you only have the node data and it's non-unique.

The only identifying data is something like a token ID so going from the map to the CT is solved. Outside of that it gets fuzzy.

Moon Wizard
December 2nd, 2017, 04:21
The CT child node is unique to each window. The only solution is to grab the CT window using Interface.findWindow, and then iterate through the list windows to find the window with the same DB node path.

That’s why all of the CT controls write to the database, so that grabbing the window is unnecessary for the vast majority of needs. The updates to he CT database node should automatically reflect in the CT entry controls.

Perhaps an example of what you are trying to accomplish where you need a CT entry window, instead of a CT node?

Regards,
JPG

Ken L
December 2nd, 2017, 05:05
The idea was a quick snap CT to selected token extension. Tuesday I had a combat with 30+ combatants and when an AoO was triggered, The tokens were geographically next to each other, but scattered all over the tracker making accessing their effects a PITA. This is to raise the quality of life by allowing me to select the token and snap the CT to that entry for further examination.

Bidmaron
December 2nd, 2017, 05:31
What did you the user do in order to cause the snap-to-token effect to occur? Are you going to post an extension on this? Sounds very useful.

Nickademus
December 2nd, 2017, 05:43
I was planning on doing this but hadn't gotten around to it. I imagine it was something to do with getting the CT entry associated with the token, then finding the window the entry is in then using windowlist.scrollToWindow.

Ken L
December 2nd, 2017, 06:05
It works, the DBNode path was a direct hit for what I needed; thanks moon. Just a little filtering will do. Nick's pretty much on the dot for what I wanted. The scroll seek needs a visual aid, so chances are I'm going to do some highlighting of the entry to make it easier to find. The goal is to reduce the amount of time during 'look up'.

As for releasing it, someday perhaps. I have a number of extensions I haven't been releasing for reasons my core players know about, but it's easy enough to write (less than 20 or so lines or 50 expanded) of logic.

Bidmaron
December 2nd, 2017, 13:25
Can we sweet talk you into posting your code then? There seems to be an informal agreement around here that we try to post solutions to anything we discussed on the boards, particularly if someone helped sort out the problem.