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

Re: [cw] Getting an item's value

Expand Messages
  • Daniel Sobral
    Thanks. I didn t try listiteminfo because of the way the help was written, and I quickly dismissed optvalue() because the prototype looked the same. More
    Message 1 of 4 , Jul 25, 2006
    • 0 Attachment
      Thanks. I didn't try listiteminfo because of the way the help was written, and I quickly dismissed optvalue() because the prototype looked the same. More specifically:
       

      listiteminfo(listName, itemIdentifier, reference)

      If itemIdentifier is a number, return information about the itemIdentifier'th item in the list named listName.

      The "th" on itemIdentifier led me to believe it was an index number, not a string value. So, I'd suggest rewording the help for this function (the help for optvalue is clear enough -- I just dismissed it without actually reading the help).

       
      On 7/25/06, Bruce Kvam <bkvam@...> wrote:

      The easiest way to obtain the value of an option for a named item in a list is optvalue:

      optvalue('Abilities', 'Leadership', 'Total')
        
      This function can also be used in the context of foreach with a single argument to get the value of an option for the current item.

      The listiteminfo function can do the same thing with a slightly different syntax:
      listiteminfo('Abilities', 'Leadership', '@Total@')
      If you want to get information other than option values you need to use listiteminfo. For example, to get the level (base score), you would use:
      listiteminfo('Abilities', 'Leadership', '@v@')


      Daniel Sobral wrote:
      I have converted the Ars Magica 5's CharacterSummary filter to output
      combat stats in CSV format, so that I could run some algorithms to
      find valid combat groups within those lists.
      
      This all went pretty much straightforward, but now I have a problem.
      For each character, I need the Total of the Leadership ability, if
      available.
      
      I know how I would go about to find this value in loop through
      Abilities, but I find that quite inconvenient. It would be best if I
      just printed this value on every line of a character's weapon stats.
      
      I have tried to get this value, but without any success. My latest attempt is:
      
      %finditemvalue('Abilities:@Name="Leadership"','max','Total')%;\
      
      But no go. How can I get around this? I looked for examples of using
      finditemvalue, but nothing seems to help.
        




      --
      Daniel C. Sobral
    • Support
      You stopped reading before you should have. The full text is given below. Note the bold sentence. *listiteminfo*(/listName/, /itemIdentifier/, /reference/) If
      Message 2 of 4 , Jul 25, 2006
      • 0 Attachment
        You stopped reading before you should have. The full text is given below. Note the bold sentence.

        listiteminfo(listName, itemIdentifier, reference)

        If itemIdentifier is a number, return information about the itemIdentifier'th item in the list named listName. If itemIdentifier is a string, return information about the item with that name in listName. The reference is formatted in the same fashion as text in adjustment options. This can be used in conjunction with the listentries function to loop through all items in a particular list to find items that meet certain criteria. If listName begins with an asterisk ("*") the list in the data sheet is accessed, allowing you to obtain information about items that aren't selected in the current character sheet. In this case, the itemIdentifier should be the item name, not an index.

        If running within a script, items in the default data sheets are searched before other data sheets.

        Daniel Sobral wrote:
        Thanks. I didn't try listiteminfo because of the way the help was written, and I quickly dismissed optvalue() because the prototype looked the same. More specifically:
         

        listiteminfo(listName, itemIdentifier, reference)

        If itemIdentifier is a number, return information about the itemIdentifier'th item in the list named listName.

        The "th" on itemIdentifier led me to believe it was an index number, not a string value. So, I'd suggest rewording the help for this function (the help for optvalue is clear enough -- I just dismissed it without actually reading the help).


      Your message has been successfully submitted and would be delivered to recipients shortly.