PDA

View Full Version : Help with Xml anchored static height error



gsharp
October 31st, 2014, 05:21
creating an extension and I've finally got it all working but I keep getting the following warnings:
Ruleset Warning: window: Anchored static height ignored for control (Generate_Encounter) in windowclass (RandomGenerator)
Ruleset Warning: window: Anchored static height ignored for control (Generate_Treasure) in windowclass (RandomGenerator)

doesn't stop the extension from wroking but I'd like to solve it if possible. This is the code for the first label that generates the error and the other is basically the same.

<label_ps name="Generate_Encounter">
<anchored to="dice" position="right" offset="30" height="2" />
<static textres="RG_Generate_Encounter" />
<center />
</label_ps>

if anyone can help solve this it would be greatly appreciated.

damned
October 31st, 2014, 07:19
remove the height='2"

Trenloe
October 31st, 2014, 13:29
Damned is correct. As the new control is using the right anchor it shares 2 corners with the parent control which also defines the height of the new control - which is why you're getting the warning. See the "Using the anchoring shorthand notation" section here: https://www.fantasygrounds.com/modguide/windowing.xcp

gsharp
November 2nd, 2014, 13:01
I appreciate the help guys unfortunately this doesnt solve the problem. I'm still receiving the warnings.

damned
November 2nd, 2014, 13:06
can you post more code please?
windowclass (RandomGenerator)....

gsharp
November 2nd, 2014, 14:46
here's the Windowclass hopefully this might help you guys figure it out :)


<windowclass name="RandomGenerator">
<margins control="0,0,0,5" />
<frame>partysheet</frame>
<placement>
<size width="350" height="445" />
</placement>
<nodelete />
<script file="scripts/RG_functions.lua" />
<sheetdata>

<windowtitlebar name="header">
<resource>RG_window_title</resource>
</windowtitlebar>

<genericcontrol name="contentframe">
<anchored>
<top parent="header" anchor="bottom" offset="15" />
<left offset="20" />
<right offset="-45" />
<bottom offset="-32" />
</anchored>
<frame name="groupbox" offset="10,17,24,17" />
<disabled />
</genericcontrol>

<label_ps name="label_EL">
<anchored to="contentframe" position="insidetopleft" offset="20" />
<static textres="RG_label_EL" />
<center />
</label_ps>
<basicnumber name="EncounterLevel">
<anchored to= "label_EL" position="belowleft" offset="-9,9" width="32" height="20" />
<min>1</min>
<max>20</max>
<default>1</default>
</basicnumber>

<label_ps name="label_Location">
<anchored to="contentframe" position="insidetopright" offset="110" />
<static textres="RG_label_location" />
<center />
</label_ps>



<button_stringcycler name="Location_cycler">
<anchored width="100" to="contentframe" position="insidetopright" offset="100,29" />
<parameters>
<defaultlabelres>Location_val_any</defaultlabelres>
<labelsres>Location_val_aquatic|Location_val_deserts|Location _val_forests|Location_val_hills|Location_val_marsh es|Location_val_mountains|Location_val_plains|Loca tion_val_underground</labelsres>
<values>Aquatic|Deserts|Forests|Hills|Marshes|Mountains|Pl ains|Underground</values>
</parameters>

</button_stringcycler>

<button_roll name="button_roll">
<anchored to="contentframe" position="insidetopleft" offset="15,75" width="30" height="30" />

<script >
function onButtonPress()
local EL
local Location
local creatureCR
local creaturenumber
local npclink
local Encounter
local EncounterEL
EL = window.EncounterLevel.getValue();
Location = window.Location_cycler.getStringValue();
if Location == "" then
Location = "Any";
end

if window.Encounter_Frame.getDatabaseNode().getChildC ount() ~= 0 then
window.Encounter_Frame.getDatabaseNode().getChild("Encounter1").delete();
end
if window.Treasure_Frame.getDatabaseNode().getChildCo unt()~=0 then
window.Treasure_Frame.getDatabaseNode().getChild("Treasure1").delete();
end

Encounter = window.Encounter_Frame.getDatabaseNode().createChi ld("Encounter1");
EncounterEL= Encounter.createChild("level", "number");
EncounterEL.setValue(EL);
while EL ~= 0 do
creatureCR, creaturenumber, EL = window.getcreaturenumber(EL);

npclink = window.getnpclink(creatureCR, creaturenumber, Location);
if npclink then
while creaturenumber ~= 0 do
window.addtoencounter(npclink, window.Encounter_Frame.getDatabaseNode().getChild("Encounter1"))
creaturenumber = creaturenumber -1;
end
else
EL = window.EncounterLevel.getValue();
end
end

end

</script>

</button_roll>

<genericcontrol name="dice">
<anchored to="button_roll" position="right" offset="10" width="80" />
<frame name="fielddice" offset="7,5,7,5" />
<disabled />
</genericcontrol>

<label_ps name="Generate_Encounter">
<anchored to="dice" position="right" offset="30" />
<static textres="RG_Generate_Encounter" />
<center />
</label_ps>
<windowlist name="Encounter_Frame">
<anchored>
<top parent="button_roll" anchor="bottom" offset="40" />
<left anchor="left" offset="40" />
<right anchor="right" offset="-65" />
<bottom anchor="center" offset="20" />
</anchored>
<class>battlesmall</class>
<frame name="diebox" offset="10,17,24,17" />
<datasource>..Enc</datasource>
</windowlist>


<button_roll name="button_roll2">
<anchored to="Encounter_Frame" position="insidetopleft" offset="0,75" width="30" height="30" />
<script>
function onButtonPress()
local EncTreasure={};
local TreasureStrings={};
local Treasure
local EL
Module.activate("3.5E Basic Rules");
Basic = DB.getRoot("3.5E Basic Rules");
Basic = Basic.getChild("reference");
Equipment = Basic.getChild("equipment");
Armor = Basic.getChild("armor");
Weapon = Basic.getChild("weapon");
Module.activate("3.5E Magic Items");
Magic = DB.getRoot("3.5E Magic Items");
Magic = Magic.getChild("reference");
Magic = Magic.getChild("magicitems");

EL = window.EncounterLevel.getValue();
if window.Treasure_Frame.getDatabaseNode().getChildCo unt()~=0 then
window.Treasure_Frame.getDatabaseNode().getChild("Treasure1").delete();
end
Treasure = window.Treasure_Frame.getDatabaseNode().createChil d("Treasure1");

if window.Encounter_Frame.getDatabaseNode().getChildC ount() ~= 0 then
window.Treasure_Frame.getDatabaseNode().getChild("Treasure1").getChild("name").setValue("Treasure from ".. window.Encounter_Frame.getDatabaseNode().getChild("Encounter1").getChild("name").getValue());
local Enctable = window.Encounter_Frame.getDatabaseNode().getChild("Encounter1").getChild("npclist").getChildren();

for v,e in pairs(Enctable) do
local sClass, sRecord = e.getChild("link").getValue();
if DB.findNode(sRecord).getChild("treasure").getValue() == "" then
TreasureStrings[v] = "None";
else
TreasureStrings[v] = DB.findNode(sRecord).getChild("treasure").getValue();
end
end
else

Treasure.getChild("name").setValue("Random Treasure");
TreasureStrings[1]="Standard";

end

EncTreasure = window.ConvertTreasure(TreasureStrings);

for v,e in pairs(EncTreasure) do

local Coins = window.getCoins(e[1], EL);
window.addCoins(Treasure, Coins);
local Goods, ItemsExtra = window.getGoods(e[2], e[3], e[5], EL);
window.addGoods(Treasure, Goods);
local Items = window.getItems(e[4], ItemsExtra, EL);
window.addItems(Treasure, Items)
end
end
</script>
</button_roll>

<genericcontrol name="dice2">
<anchored to="button_roll2" position="right" offset="9" width="80" />
<frame name="fielddice" offset="7,5,7,5" />
<disabled />
</genericcontrol>

<label_ps name="Generate_Treasure">
<anchored to="dice2" position="right" offset="30" />
<static textres="RG_Generate_Treasure" />
<center />
</label_ps>

<windowlist name="Treasure_Frame">
<anchored>
<top parent="button_roll2" anchor="bottom" offset="40" />
<left anchor="left" offset="40" />
<right anchor="right" offset="-65" />
<bottom anchor="bottom" offset="-55" />
</anchored>
<class>parcelsmall</class>
<frame name="diebox" offset="10,17,24,17" />
<datasource>..Tre</datasource>
</windowlist>
<close_RandomGenerator />

Trenloe
November 2nd, 2014, 16:53
The label_ps control template inherits a static height of 20 from the label template found in the CoreRPG ruleset (in common\template_common.xml).

Change the position="right" anchor to position="righthigh" and keep a height entry, or rely on the template height of 20. The righthigh anchor position only inherits the top and left starting positions of the new control from the parent.

gsharp
November 3rd, 2014, 04:00
thanks for the help Trenloe that fixed the problem. Cheers for the help everyone.

damned
November 3rd, 2014, 05:16
now when are you going to let on what you are working on!

gsharp
November 3rd, 2014, 05:30
sorry wasnt trying to hide it or anything. I'm making a random encounter and treasure generator! I know that there is another one floating around but I wanted one that would actually give me an ecounterlink and a treasure parcel link. At the moment it only uses the 3.5 monster/magic/basic module but I have plans to extend it to include other modules sometime in the future. I just implemented the encounter table from the DM book and likewise for the treasure. This is the first extension I've made so if anyone feels like cleaning up the code and making it more versatile feel free. Otherwise thanks for the help and give it a try and let me know what you think.

damned
November 3rd, 2014, 05:54
no one was worried about you hiding anything - Im just keen to see what you come up with :)
i dont use 3.5 but I will give it a whirl in the next day or so!