Ardem
December 14th, 2013, 10:21
I trying something different, and could use a little help.
I want to add a windows class on the desktop, which sits under desktopclasses.xml. It is a timecounter, for campaign reasons. However it does not create a node.
When opening a window you use the registerStackShortcut that creates the node example.
DesktopManager.registerStackShortcut("button_rmcrandom", "button_rmcrandom_down", "Randoms", "fgrandom", "randomdata");
I created a node using onInit script
timecounter = DB.createNode("timecounter");
and the fields
timecounterday =timecounter.createChild("day","number");
timecounterminute =timecounter.createChild("minute","number");
timecounterhour=timecounter.createChild("hour","number");
My problem is the windowclass does not seem to link with the DB, just wondering can anyone point me in the right direction here. At first I just used code to enter direct into the DB and update the fields, however this does not help me push the information to the players.
This is the windows class.
<windowclass name="timecounter">
<sizelimits>
<minimum width="120" height="75" />
</sizelimits>
<noclose />
<script file="desktop/scripts/timecounter_entry.lua" />
<sheetdata>
<genericcontrol name="base">
<bounds>0,0,150,75</bounds>
<icon>timecounter</icon>
</genericcontrol>
<numberfield name="day">
<bounds>15,15,50,42</bounds>
<font>timecounter</font>
<displaysign />
<readonly />
<right />
</numberfield>
<numberfield name="hour">
<bounds>60,15,50,42</bounds>
<font>timecounter</font>
<readonly />
<right />
</numberfield>
<numberfield name="minute" source="timecounter.minutes">
<bounds>90,15,50,42</bounds>
<font>timecounter</font>
<readonly />
<right />
</numberfield>
<stringcontrol name="label">
<bounds>0,5,150,12</bounds>
<font>timecounterlabel</font>
<static>DAYS PASS SINCE X TIME</static>
<center />
</stringcontrol>
<stringcontrol name="label">
<bounds>97,15,5,42</bounds>
<font>timecounter</font>
<static>:</static>
<center />
</stringcontrol>
<buttoncontrol name="minuteplus">
<bounds>104,50,12,12</bounds>
<state icon="button_plus" />
<script>
function onClickRelease()
window.minutesplus();
end
</script>
</buttoncontrol>
<buttoncontrol name="minuteminus">
<bounds>118,50,12,12</bounds>
<state icon="button_minus" />
<script>
function onClickRelease()
window.minutesminus();
end
</script>
</buttoncontrol>
<buttoncontrol name="hourplus">
<bounds>70,50,12,12</bounds>
<state icon="button_plus" />
<script>
function onClickRelease()
window.hoursplus();
end
</script>
</buttoncontrol>
<buttoncontrol name="hourminus">
<bounds>84,50,12,12</bounds>
<state icon="button_minus" />
<script>
function onClickRelease()
window.hoursminus();
end
</script>
</buttoncontrol>
<buttoncontrol name="dayplus">
<bounds>20,50,12,12</bounds>
<state icon="button_plus" />
<script>
function onClickRelease()
window.daysplus();
end
</script>
</buttoncontrol>
<buttoncontrol name="dayminus">
<bounds>34,50,12,12</bounds>
<state icon="button_minus" />
<script>
function onClickRelease()
window.daysminus();
end
</script>
</buttoncontrol>
</sheetdata>
</windowclass>
I want to add a windows class on the desktop, which sits under desktopclasses.xml. It is a timecounter, for campaign reasons. However it does not create a node.
When opening a window you use the registerStackShortcut that creates the node example.
DesktopManager.registerStackShortcut("button_rmcrandom", "button_rmcrandom_down", "Randoms", "fgrandom", "randomdata");
I created a node using onInit script
timecounter = DB.createNode("timecounter");
and the fields
timecounterday =timecounter.createChild("day","number");
timecounterminute =timecounter.createChild("minute","number");
timecounterhour=timecounter.createChild("hour","number");
My problem is the windowclass does not seem to link with the DB, just wondering can anyone point me in the right direction here. At first I just used code to enter direct into the DB and update the fields, however this does not help me push the information to the players.
This is the windows class.
<windowclass name="timecounter">
<sizelimits>
<minimum width="120" height="75" />
</sizelimits>
<noclose />
<script file="desktop/scripts/timecounter_entry.lua" />
<sheetdata>
<genericcontrol name="base">
<bounds>0,0,150,75</bounds>
<icon>timecounter</icon>
</genericcontrol>
<numberfield name="day">
<bounds>15,15,50,42</bounds>
<font>timecounter</font>
<displaysign />
<readonly />
<right />
</numberfield>
<numberfield name="hour">
<bounds>60,15,50,42</bounds>
<font>timecounter</font>
<readonly />
<right />
</numberfield>
<numberfield name="minute" source="timecounter.minutes">
<bounds>90,15,50,42</bounds>
<font>timecounter</font>
<readonly />
<right />
</numberfield>
<stringcontrol name="label">
<bounds>0,5,150,12</bounds>
<font>timecounterlabel</font>
<static>DAYS PASS SINCE X TIME</static>
<center />
</stringcontrol>
<stringcontrol name="label">
<bounds>97,15,5,42</bounds>
<font>timecounter</font>
<static>:</static>
<center />
</stringcontrol>
<buttoncontrol name="minuteplus">
<bounds>104,50,12,12</bounds>
<state icon="button_plus" />
<script>
function onClickRelease()
window.minutesplus();
end
</script>
</buttoncontrol>
<buttoncontrol name="minuteminus">
<bounds>118,50,12,12</bounds>
<state icon="button_minus" />
<script>
function onClickRelease()
window.minutesminus();
end
</script>
</buttoncontrol>
<buttoncontrol name="hourplus">
<bounds>70,50,12,12</bounds>
<state icon="button_plus" />
<script>
function onClickRelease()
window.hoursplus();
end
</script>
</buttoncontrol>
<buttoncontrol name="hourminus">
<bounds>84,50,12,12</bounds>
<state icon="button_minus" />
<script>
function onClickRelease()
window.hoursminus();
end
</script>
</buttoncontrol>
<buttoncontrol name="dayplus">
<bounds>20,50,12,12</bounds>
<state icon="button_plus" />
<script>
function onClickRelease()
window.daysplus();
end
</script>
</buttoncontrol>
<buttoncontrol name="dayminus">
<bounds>34,50,12,12</bounds>
<state icon="button_minus" />
<script>
function onClickRelease()
window.daysminus();
end
</script>
</buttoncontrol>
</sheetdata>
</windowclass>