# Thread: Trying to create a condition track

1. ## Trying to create a condition track

I am creating a ruleset and I have got a bit stuck....

I am trying to create a condition track that affects defenses, attack rolls, skill and ability checks.

I know I'll need to write a lua script to do this, but could nayone give me some pointers?

The condition track needs to have 6 check boxes and 4 of the conditions has a numbercontrol, with a specifc nuber set to them.

What I cannot work out is out to get FGII to display a checkbox, I suspect I need to create a lua script and fields for them to display?

To give an idea of what I am trying to achieve:

Code:
```      Unaffected ()
[ -1] To all rolls  ()
[ -2] To all rolls  ()
[ -5] To all rolls  ()
[-10] To all rolls  ()
Unconscious ()```

[-10]

2. How are you going to determine if a roll meets the criteria of defenses, attack rolls, skill and ability checks?

The code for the condition track wouldn't be too bad but the hard part is going to be how you determine when to take the -2 off a roll. What if the roll is for damage, etc. You would need to somehow flag the type of rolls you want to get the -2 so when it knows when to deduct them. The other thought might be making it so the players have a button or something next to the modifier box that they can hit that will automatically throw in a modifier there for the current penalty they are at.

3. Originally Posted by joshuha
How are you going to determine if a roll meets the criteria of defenses, attack rolls, skill and ability checks?

The code for the condition track wouldn't be too bad but the hard part is going to be how you determine when to take the -2 off a roll. What if the roll is for damage, etc. You would need to somehow flag the type of rolls you want to get the -2 so when it knows when to deduct them. The other thought might be making it so the players have a button or something next to the modifier box that they can hit that will automatically throw in a modifier there for the current penalty they are at.
It did not need to be automated....

If we were playing on paper they would do it manually, so not the end of the world....

I was just thinking that I could have a number box showing the modifier, controlled by a script depending on how many boxes were checked the value in the number box would change....

4. As far as creating the slots, wouldn't something similiar to the spell lists circles that you check work for you?

That code is in charsheet_spellcounter.lua. Basically its just adding/removing bitmapwidgets to the sheet.

5. If all you want is a tickbox next to each condition this is easily achieved. Take a look at charsheet_spells.xml and common_templates.xml.
There is a template called "checkbox" that is used for the "spontaneous" indicator and also the (memorized/cast circles).
Basically all you'd need is to create fields using that template (as shown below).
No lua scripting should be required unless you want to do something fancy, like disabling or automatically setting/unsetting some conditions when another one is selected/unselected . . .

Code:
```

<checkbox name="condition_unaffected">
<anchored>
<left>
<to>yourunaffectedstringfield</to>
<anchor>left</anchor>
<offset>5</offset>
</left>
<bottom>
<to>yourunaffectedstringfield</to>
<anchor>bottom</anchor>
<offset>-1</offset>
</bottom>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>
<!-- you can include the stateicon tags to specify the images or you can leave them out and it will use the default tickbox icons defined in the template (indicator_checkon and indicator_checkoff)
<stateicons>
<on>indicator_casterspontaneous</on>
<off>indicator_casterprep</off>
</stateicons>
-->
<tooltip>
<text>Unaffected on/off</text>
</tooltip>
</checkbox>

<checkbox name="condition_minus1">
<anchored>
<left>
<to>yourminus1stringfield</to>
<anchor>left</anchor>
<offset>5</offset>
</left>
<bottom>
<to>yourminus1stringfield</to>
<anchor>bottom</anchor>
<offset>-1</offset>
</bottom>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>
<tooltip>
<text>Minus1 on/off</text>
</tooltip>
</checkbox>

... etc```

If all you want is a tickbox next to each condition this is easily achieved. Take a look at charsheet_spells.xml and common_templates.xml.
There is a template called "checkbox" that is used for the "spontaneous" indicator and also the (memorized/cast circles).
Basically all you'd need is to create fields using that template (as shown below).
No lua scripting should be required unless you want to do something fancy, like disabling or automatically setting/unsetting some conditions when another one is selected/unselected . . .

Code:
```

<checkbox name="condition_unaffected">
<anchored>
<left>
<to>yourunaffectedstringfield</to>
<anchor>left</anchor>
<offset>5</offset>
</left>
<bottom>
<to>yourunaffectedstringfield</to>
<anchor>bottom</anchor>
<offset>-1</offset>
</bottom>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>
<!-- you can include the stateicon tags to specify the images or you can leave them out and it will use the default tickbox icons defined in the template (indicator_checkon and indicator_checkoff)
<stateicons>
<on>indicator_casterspontaneous</on>
<off>indicator_casterprep</off>
</stateicons>
-->
<tooltip>
<text>Unaffected on/off</text>
</tooltip>
</checkbox>

<checkbox name="condition_minus1">
<anchored>
<left>
<to>yourminus1stringfield</to>
<anchor>left</anchor>
<offset>5</offset>
</left>
<bottom>
<to>yourminus1stringfield</to>
<anchor>bottom</anchor>
<offset>-1</offset>
</bottom>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>
<tooltip>
<text>Minus1 on/off</text>
</tooltip>
</checkbox>

... etc```
I'm getting nowhere with this....

This is the section of code I have:

Code:
```	  <genericcontrol name="conditionframe">
<bounds>335,290,160,300</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>
<stringcontrol name="conditionlabel">
<anchored>
<to>conditionframe</to>
<position>insidetop</position>
<offset>0,10</offset>
</anchored>
<font>sheetlabel</font>
<static>Condition</static>
<center />
</stringcontrol>
<genericcontrol name="conditionnormal">
<bounds> 345,310,140,40</bounds>
<frame>
<name>sheetfocus</name>
</frame>
</genericcontrol>
<stringcontrol name="normallabel">
<anchored>
<to>conditionnormal</to>
<position>insideleft</position>
<offset>10,-10</offset>
</anchored>
<font>sheetlabel</font>
<static>NORMAL</static>
</stringcontrol>```
(Looked at the sheet again and it's normal not unaffected).

Anyway if I create a checkbox it is not displayed!

7. Looks like you're altogether missing the part of the code that creates the checkbox itself. Maybe you didn't copy/paste the whole thing?

8. D'OH!

Code:
```	  <genericcontrol name="conditionframe">
<bounds>335,290,160,210</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>
<stringcontrol name="conditionlabel">
<anchored>
<to>conditionframe</to>
<position>insidetop</position>
<offset>0,10</offset>
</anchored>
<font>sheetlabel</font>
<static>Condition</static>
<center />
</stringcontrol>
<genericcontrol name="conditionnormal">
<bounds> 345,310,140,40</bounds>
<frame>
<name>sheetfocus</name>
</frame>
</genericcontrol>
<stringcontrol name="normallabel">
<anchored>
<to>conditionnormal</to>
<position>insideleft</position>
<offset>10,-10</offset>
</anchored>
<font>sheetlabel</font>
<static>NORMAL</static>
</stringcontrol>
<checkbox name="condition_normal">
<anchored>
<left>
<to>conditionnormal</to>
<anchor>left</anchor>
<offset>5</offset>
</left>
<bottom>
<to>conditionnormal</to>
<anchor>bottom</anchor>
<offset>-1</offset>
</bottom>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>```
Using this code above the check box appears in the very bottom left of the character sheet!

I am coming to the conclusion that I do not understand the anchoring code (the library description did not enlighten me either!)

I am feeling a bit thick right now.....

9. Ah! The Saga Star Wars... I was wondering about this, and I'd hoped that someone was on it. I'm not an xml guy, so I didn't think I could tackle it.

If you don't mind, how far along are you? And do you mind sharing when you're done?

10. <looking around for any Hasbro persons> Erm nope, not a copyrighted licensed system in any way relating to a certian 6 films no sir!...

The ruleset may be called SWd20 but that's a coincidence!

Seriously it's going slowly (it was just going to be for when not all my Modern players were around on a night), that siad given it was just going to be a character sheet with no rules, and has no images or mentions any brand names anywhere (other than the fact that there are force points), if it does get finished then I'll might PM it to people........

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•