PDA

View Full Version : reference to window element from a template->script?



celestian
March 5th, 2017, 02:23
I need to access the window "above" a template script I run. The template is a "ability score" template and has a script. That script has a onValueChanged to do something. During that process I'd like to tweak a tooltip up the chain in the window.


Sample ability score entry in the window


<windowclass name="charsheet_main" >
<sheetdata>

<number_charabilityscore2 name="strength" source="abilities.strength.score" >
<tooltip textres="char_tooltip_strength" />
<anchored offset="-10,30" width="45" height="45"/>
<target>strength</target>
</number_charabilityscore2>

<label name=THISLABEL>
</label>

</sheetdata>
</windowclass>




The template for above ability score is:



<template name="number_charabilityscore2">
<number>
<anchored to="statstitle" position="insidetopleft"/>
<rollable />
<min>1</min>
<max>25</max>
<default>9</default>
<font>arial-bold-12</font>
<frame name="abilityscore_box" />
<script file="campaign/scripts/number_abilityscore.lua" />
</number>
</template>



The code within number_abilityscore.lua is where I'd like to back reference the "THISLABEL" and changes it's tooltip text. Is it possible to do that from within the number_abilityscore.lua code? I've been trying to figure out how to do it but can't find a working solution.

celestian
March 5th, 2017, 03:56
Okay, so this turned out easier than I was making it... noob!

window.THISLABEL was how I could reference the variable from within the lua.