Brianide
August 17th, 2014, 23:40
I want to create an object that holds a line for a skill. It just needs to hold a stringcontrol label and a modified numberfield rank. When the rank is double-clicked, I need the label text to go to the chat box. I'm looking at something like this:
--<template name="skill_line">
----<stringcontrol name="label" />
----<numberfield name="rank">
------<script>
--------function onDoubleClick(x,y)
----------local rRoll = { sType = "dice", sDesc = getLabelText(), aDice = StringManager.convertStringToDice("4DF"), nMod = getValue() };
----------ActionsManager.performAction(nil, nil, rRoll);
--------end
------</script>
----</numberfield>
--</template>
Is a template appropriate to handle an object like this, or do I have to make something like a windowclass? In the case of a windowclass, can I make instances of it via xml like I would a template? And what's the proper way to reference the label's text for sDesc? In a window class, it looks like it'd be window.label.getValue(), but I would guess that doesn't work in a template. Any info is greatly appreciated.
--<template name="skill_line">
----<stringcontrol name="label" />
----<numberfield name="rank">
------<script>
--------function onDoubleClick(x,y)
----------local rRoll = { sType = "dice", sDesc = getLabelText(), aDice = StringManager.convertStringToDice("4DF"), nMod = getValue() };
----------ActionsManager.performAction(nil, nil, rRoll);
--------end
------</script>
----</numberfield>
--</template>
Is a template appropriate to handle an object like this, or do I have to make something like a windowclass? In the case of a windowclass, can I make instances of it via xml like I would a template? And what's the proper way to reference the label's text for sDesc? In a window class, it looks like it'd be window.label.getValue(), but I would guess that doesn't work in a template. Any info is greatly appreciated.