checkboxes, skill prerequisites and calculations

Hello gents,

I'm trying to build a character sheet for a larp, the system is basically pick and buy, with some limitations:
there two skills that are mutally exclusive (clerical and wizardly magic), and there are skills with prerequisites.

What I would like to do is a sheet that automatically subtract the skill cost from a predefined pool, and that check the prerequisites and exclusions. The calculation part I'm fairly confident to resolve, but the prerequisite and exclusivity is eluding me. Any way to make it work?

Comments

  • It has been a while, so I'm sure this person gave up already... Sad. I'll answer the question though, in case other people need to know!

    You need to use "if" in Javascript. If they try to add a skill without the prerequisite, set the skill back to the default value.

    To make an exclusion you have to use a hidden field.
    Make a hidden label field named "magictype" and set the text to "nothing". When the player selects a type of magic, we need to list it in that field to say what they chose, so we can ask about it later.

    I'm going to assume the skills are two check boxes named "clericalmagic" and "wizardmagic" for the following example

    Create a function similar to as follows

    if (clericalmagic.Checked == true) //Check if they tried to take Clerical Magic
    {
      if (magictype.text == "nothing") //They did, have they already chosen a magic?
      {
        magictype.text = "clericalmagic" //They didn't! So set it to "clericalmagic" to say they chose this type
      }
      else //They have chosen a magic!
      {
        if (magictype.text == "wizardmagic") //Did they chose wizard magic?
        {
          clericalmagic.Checked = false //They did! They can't take clerical magic, so uncheck that box
        } //There's no else down here, because the only other option is clericalmagic, and if it IS clericalmagic, then nothing more needs to be done.
      }
    }
    else //They didn't check the box for clericalmagic?
    {
      if (magictype.text == "clericalmagic") //Check if they had it and just unchecked the box
      {
        magictype.text = "nothing" //They took it away, so set the magictype to "nothing", since it isn't there anymore
      }
    }

Leave a Comment