Loading ...
Sorry, an error occurred while loading the content.
 

Combo Boxes

Expand Messages
  • lerfc15
    Hello I have a question regarding combo boxes and scripts. I have a combo box for the characters race and need a script to add a skill depending on which race
    Message 1 of 3 , Jan 2, 2005
      Hello

      I have a question regarding combo boxes and scripts.

      I have a combo box for the characters race and need a script to add a
      skill depending on which race is chosen

      The combo box has the variable name race and 4 possible values 0 to 3

      I then used the script button on the Edit Combo Box dialog to add the
      following script

      if (race = 0)
      add skills.Resist = 1;
      elseif (race = 1)
      add skills.Awareness = 1;
      elseif (race = 2)
      add skills.Awareness = 1;
      elseif (race = 3)
      add skills.Endurance = 1;
      endif

      The problem is that no matter which race I select it always adds the
      skill Resist.

      It does use the variable race properly elsewhere since I use it to
      limit attribute values.

      So have I made an error in my code or can't I do it this way ?


      Thanks

      Anthony
    • Fesarius
      I believe you need to put $* in front of the occurrences of race in this script. This selects the context of the original character sheet. I.E. if ($*race
      Message 2 of 3 , Jan 2, 2005
        I believe you need to put '$*' in front of the occurrences of 'race' in this
        script. This selects the context of the original character sheet.

        I.E.

        if ($*race = 0)
        add skills.Resist = 1
        ...

        Without the decoration the variable referred to is one in the context of the
        conversion script, i.e. essentially an automatic variable.

        If that's not it, then you'll need better help than mine...

        P

        -----Original Message-----
        From: lerfc15 [mailto:jsuiter107@...]
        Sent: Sunday, January 02, 2005 6:35 AM
        To: cw@yahoogroups.com
        Subject: [cw] Combo Boxes





        Hello

        I have a question regarding combo boxes and scripts.

        I have a combo box for the characters race and need a script to add a
        skill depending on which race is chosen

        The combo box has the variable name race and 4 possible values 0 to 3

        I then used the script button on the Edit Combo Box dialog to add the
        following script

        if (race = 0)
        add skills.Resist = 1;
        elseif (race = 1)
        add skills.Awareness = 1;
        elseif (race = 2)
        add skills.Awareness = 1;
        elseif (race = 3)
        add skills.Endurance = 1;
        endif

        The problem is that no matter which race I select it always adds the
        skill Resist.

        It does use the variable race properly elsewhere since I use it to
        limit attribute values.

        So have I made an error in my code or can't I do it this way ?


        Thanks

        Anthony








        --------------
        Find out more about Metacreator by visiting Alter Ego Software at
        http://www.alteregosoftware.com
        Yahoo! Groups Links
      • Bruce Kvam
        This is correct. However, as written this will add skills each time the user changes the race. If you don t want that, you will need to also delete any items
        Message 3 of 3 , Jan 3, 2005
          This is correct.

          However, as written this will add skills each time the user changes the
          race. If you don't want that, you will need to also delete any items
          added by race selection before you add the skill. The best way to do
          that is to add an option to the skill when you add that tags it as added
          as a racial skill.

          Then you need to add a foreach loop against the skills lists, and when
          you find that option on a skill use deleteitem to remove it. This loop
          should occur before the addition of the skill so you don't delete the
          skill you just added!

          I would also suggest putting that code in a subroutine in a separate
          load script for that character sheet, and then call that subroutine from
          the combo box. It's a lot easier to edit the load script in a text
          editor than it is to edit the control.

          To reload the load script press CTRL+F12 (you have to do this after
          changing it each time).

          Fesarius wrote:

          >I believe you need to put '$*' in front of the occurrences of 'race' in this
          >script. This selects the context of the original character sheet.
          >
          >I.E.
          >
          >if ($*race = 0)
          >add skills.Resist = 1
          >...
          >
          >Without the decoration the variable referred to is one in the context of the
          >conversion script, i.e. essentially an automatic variable.
          >
          >If that's not it, then you'll need better help than mine...
          >
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.