json.objrolls

From RPTools Wiki
Revision as of 11:44, 26 March 2017 by Bubblobill (talk | contribs) (Created page with "Is similar to json.rolls() but returns a json object. It takes 3 parameters json.objrolls(names, stat, rolls) This will generate rolls for all the stat for each "name". roll...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Is similar to json.rolls() but returns a json object. It takes 3 parameters

json.objrolls(names, stat, rolls)

This will generate rolls for all the stat for each "name". rolls is either a single string with a roll expression in which case every stat will use same roll expression, or a json array with a roll expression for each stat (so must be same size as stat).


e.g.

{json.indent(json.objrolls("['henchman1', 'henchman2', 'henchman3']", "['Str', 'Dex', 'Con', 'Int', 'Wis', 'Chr']", "3d6"),2)}


code:{ "henchman1": {

   "Str": 10,
   "Dex": 12,
   "Con": 10,
   "Int": 10,
   "Wis": 8,
   "Chr": 12
 },
      "henchman2":   {
   "Str": 11,
   "Dex": 10,
   "Con": 7,
   "Int": 13,
   "Wis": 9,
   "Chr": 7
 },
      "henchman3":   {
   "Str": 10,
   "Dex": 10,
   "Con": 10,
   "Int": 12,
   "Wis": 15,
   "Chr": 13
 }}


{json.indent(json.objrolls("['henchman1', 'henchman2', 'henchman3']", "['Str', 'Dex', 'Con', 'Int', 'Wis', 'Chr']", "['3d6+1', '3d6', '3d6', '3d6-2', '3d6', '2d6']"),2)}

code:{ "henchman1": {

   "Str": 11,
   "Dex": 12,
   "Con": 13,
   "Int": 8,
   "Wis": 10,
   "Chr": 11
 },
       "henchman2":   {
   "Str": 12,
   "Dex": 11,
   "Con": 12,
   "Int": 8,
   "Wis": 12,
   "Chr": 3
 },
       "henchman3":   {
   "Str": 12,
   "Dex": 13,
   "Con": 9,
   "Int": 8,
   "Wis": 13,
   "Chr": 7
 }}