Varsuuk
June 13th, 2023, 22:04
This section always confused me - I sometimes get "dense" with things and have to revaluate it later. I did so, several times for a minute or 3 over a long time, everytime I came across this. I so very rarely used the indexing and when I did, I simply bruteforced it if I got it wrong until it was right. But I wanted to always "grok" it.
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644496/Ruleset+-+Scripting#Accessing-XML-Parameters-from-Scripts
I recenty USED the [1]/[2] on my own in a script correctly and remembered to check again. This time, I still didn't get why "empy" & "normal" were treated so differently than "first" & "last". So, fed up with my denseness - I did what I always do, setup a test app. In this case the code I was working on, I added a simple control to and looked at the output:
<genericcontrol>
<states>
<empty>
<icon>emptyicon</icon>
</empty>
<normal>
<icon>normalicon</icon>
</normal>
</states>
<flags>
<first />
<second />
</flags>
<label>Control label</label>
<script>
function onInit()
Debug.console(states)
Debug.console(flags)
Debug.console(label)
end
</script>
</genericcontrol>
And the result:
57701
So, it seems my confusion was because for all these years that wiki page was in error? There IS no [2] to be seen, I couldn't figure out what there would be...
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644496/Ruleset+-+Scripting#Accessing-XML-Parameters-from-Scripts
I recenty USED the [1]/[2] on my own in a script correctly and remembered to check again. This time, I still didn't get why "empy" & "normal" were treated so differently than "first" & "last". So, fed up with my denseness - I did what I always do, setup a test app. In this case the code I was working on, I added a simple control to and looked at the output:
<genericcontrol>
<states>
<empty>
<icon>emptyicon</icon>
</empty>
<normal>
<icon>normalicon</icon>
</normal>
</states>
<flags>
<first />
<second />
</flags>
<label>Control label</label>
<script>
function onInit()
Debug.console(states)
Debug.console(flags)
Debug.console(label)
end
</script>
</genericcontrol>
And the result:
57701
So, it seems my confusion was because for all these years that wiki page was in error? There IS no [2] to be seen, I couldn't figure out what there would be...