Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[API Howto] How can I access attributes that are defined on the sheet?

April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Hi,

I'm trying to set the bars of tokens - the current, max, and link.
I normally find the attribute by using:
var objOfParsebar = findObjs({
    name: 'HP',
    _type: 'attribute',
    _characterid: characterId
}, {caseInsensitive: true})[0];
But this does not work for attributes created by the sheet.

Is it possible to access those? I'm obviously able to do so manually.

Thanks!
April 22 (10 years ago)
The Aaron
Pro
API Scripter
If I understand what you're after, attributes created for the sheet only exist if they are given a value. (Possibly a value other than the default?)

If you look for it by name and character ID and don't find it, you can create it and the sheet will use it.

Is that what you're after?
April 22 (10 years ago)

Edited April 22 (10 years ago)
The Aaron
Pro
API Scripter

Mark said:

I'm trying to set the bars of tokens - the current, max, and link.
Wait, you're talking about token properties, not attributes?

Can you be more specific about what you're trying to do? I seem to recall done weirdness around bar links and values when adding it into TokenMod (Line 820 if you want to look).

April 22 (10 years ago)
The Aaron
Pro
API Scripter
I caught up on your thread, are you maybe trying to link a bar to the result of a auto calc cell on the character?
April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
This is for my 5e Shaped import. You can see the script here https://github.com/mlenser/roll20/blob/master/scri...

In this script I allow the user to change which bars are set on the token. For instance they can set "hp" to appear in bar 3, show the maximum value, and be linked.

This works perfectly for all attributes that are set under "Attributes and Abilities". This does not work for attributes that are on the sheet and have not been modified. passive_perception for instance:
<input class="sheet-passive-skill-score sheet-center sheet-no-spin" type="number" name="attr_passive_perception" value="10 + @{perception}" disabled="disabled">
But if I'm on roll20 itself I can link passive_perception and everything works.

I'd like to be able to access these type of things that are set on the sheet, but not set under "Attributes and Abilities".

Thanks Aaron.
April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

I caught up on your thread, are you maybe trying to link a bar to the result of a auto calc cell on the character?
Exactly. Or even get the value. JF got the value by printing it out to the gm and then parsing it. That's an option, but cumbersome and wouldn't allow linking.
April 22 (10 years ago)
The Aaron
Pro
API Scripter
There's a note about that situation here: https://wiki.roll20.net/API:Objects#Working_with_C...

I would be tempted to follow this process:
  • findObjs() for the attribute
  • Failing that, get the value and max with getAttrByName and create an attribute with the right name, char id, value, and max.
You might also find that calling getAttrByName() causes the attribute to be created, so fire up a simple test script and find out.

April 22 (10 years ago)
The Aaron
Pro
API Scripter
And I'll probably add that into TokenMod at some point... :)

I've got ideas about tying to a formula field too, but need to explore them. =D
April 22 (10 years ago)

Edited April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

There's a note about that situation here: https://wiki.roll20.net/API:Objects#Working_with_C...

I would be tempted to follow this process:
  • findObjs() for the attribute
  • Failing that, get the value and max with getAttrByName and create an attribute with the right name, char id, value, and max.
You might also find that calling getAttrByName() causes the attribute to be created, so fire up a simple test script and find out.
That prints the script value. For instance
10 + @{perception}
For passive perception.

I'd then have to do JF's trick to print it out and parse it from there.

Plus that wouldn't allow linking. :(


EDIT: Looking at the html I believe I can simply set the link to the name. See here:
<select class="bar2_link" style="width: 125px;">
  <option value="">None</option>
  <option value="-Jn1hj1jXAQZ8xOs76sE">HP</option>
  <option value="sheetattr_ac">ac</option>
  <option value="sheetattr_passive_perception">passive_perception</option>
</select>

I'll try that.
April 22 (10 years ago)
I have tried several times in scripts the past to bar_link to autocalculated fields and it simply doesn't work, ends up crashing each time. Never could get it to work properly.
April 22 (10 years ago)

Edited April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

Mark said:

EDIT: Looking at the html I believe I can simply set the link to the name. See here:
<select class="bar2_link" style="width: 125px;">
  <option value="">None</option>
  <option value="-Jn1hj1jXAQZ8xOs76sE">HP</option>
  <option value="sheetattr_ac">ac</option>
  <option value="sheetattr_passive_perception">passive_perception</option>
</select>

I'll try that.
This works!
token.set('bar2_link', 'sheetattr_' + name);
Woohoo!

Example:
token.set('bar2_link', 'sheetattr_passive_perception');

The values I'll still have to print out and parse though... :(
April 22 (10 years ago)
The Aaron
Pro
API Scripter
Cool!

Print and parse: You're talking about sendChat() with a callback, right?
April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Having some issues parsing the values from SendChat:

/roll 10 + @{Ankheg|perception}
works perfectly fine when using it via chat.

When I try to use it via API:
log('----');
sendChat('GM', '/roll 10 + @{Ankheg|perception}', function(ops) {
    log('ops: ' + ops);
it fails with this message:

"----"
{}
"Parsing was incomplete due to error(s)"
"TypeError: Object 1 has no method 'replace'"

Any ideas why this is? How can I make this happen?

I get the value as "10 + @{perception}". Do I need to first parse any values in @{} and then roll them? That would be a pain. Though so is adding name to each @{}
April 22 (10 years ago)
The Aaron
Pro
API Scripter
Hmm. Try it as an inline roll?
April 22 (10 years ago)
The Aaron
Pro
API Scripter
Also, I assume there's a }); hanging out below that sendChat()?
April 22 (10 years ago)
The Aaron
Pro
API Scripter
Actually, try this:
sendChat('GM', '/roll 10 + [[@{Ankheg|perception}]]', function(ops) {
    log('ops: ' + ops);

April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

Also, I assume there's a }); hanging out below that sendChat()?

Ya, full test script:
log('----');
sendChat('GM', '/roll (10 + @{Ankheg|perception})', function(ops) {
    log('ops: ' + ops);
    var rollResult = JSON.parse(ops[0].content);
    if(_.has(rollResult, 'total')) {
        log('rollResult.total: ' + rollResult.total);
        return rollResult.total;
    }
});

maybe you have a better example that I can emulate?
April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

Actually, try this:
sendChat('GM', '/roll 10 + [[@{Ankheg|perception}]]', function(ops) {
    log('ops: ' + ops);
Same problem.
April 22 (10 years ago)
The Aaron
Pro
API Scripter
Can you log the contents of the attribute?

I'd be more help if my laptop wasn't endlessly installing the latest version of the OS... :/
April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

Can you log the contents of the attribute?

I'd be more help if my laptop wasn't endlessly installing the latest version of the OS... :/
Ya, the contents of passive_perception are "10 + @{perception}"

The contents of perception are "@{perception_prof_exp} + @{perception_attribute} + @{perception_bonus}"

It keeps going. @{perception_prof_exp} is "@{jack_of_all_trades}", "@{PB}", or "(2*@{PB})"
@{perception_attribute} is "@{strength_mod}", "@{dexterity_mod}", "@{constitution_mod}", "@{intelligence_mod}", "@{wisdom_mod}", or "@{charisma_mod}"
@{perception_bonus} is luckily a non-calculated input.

Fun, right?
April 22 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
FYI here is the code that JF uses:
var command = "\\w GM [[@{Ankheg|passive_perception}]]";
sendChat("JF", command, function(ops) {
    var res = ops[0].inlinerolls["1"].results.total;
});
It seems to have the same problems
April 22 (10 years ago)
The Aaron
Pro
API Scripter
The whisper to GM is not required. Providing a callback intercepts the result of parsing the message instead of sending it to the chat.
April 23 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Updated Script:
sendChat('GM', '[[10 + @{Ankheg|perception}]]', function(ops) {
 log('ops: ' + ops);
 var rollResult = JSON.parse(ops[0].content);
 log('rollResult: ' + rollResult);
 if(_.has(rollResult, 'total')) {
    log('rollResult.total: ' + rollResult.total);
    return rollResult.total;
   }
 });

Getting new error:
undefined:1 $[[1]] ^ SyntaxError: Unexpected token $ at Object.parse (native) at evalmachine.<anonymous>:1618:26 at checkFinishedOps (

Any ideas?
April 23 (10 years ago)

Edited April 23 (10 years ago)
The Aaron
Pro
API Scripter
You won't need to JSON parse the results of an inline roll. The example in the wiki for sending dice expressions is using /roll (I should really expand that page...), for which the API receives the result as a JSON string. With inline rolls, you don't need to deal with the JSON as the roll data is all stored as an object in the inlinerolls property.

Try both of these and look at the difference in the output:
sendChat('', '/roll 1d4+3',function(msg){
log(msg);
});
sendChat('', '[[1d4+3]]',function(msg){
log(msg);
});

The first one will have a msg.type of 'rollresult' and the msg.content will be a string which is a JSON encoded object:
[
    {
        "who": "",
        "type": "rollresult",
        "content": "{\"type\":\"V\",\"rolls\":[{\"type\":\"R\",\"dice\":1,\"sides\":4,\"mods\":{},\"results\":[{\"v\":1}]},{\"type\":\"M\",\"expr\":\"+3\"}],\"resultType\":\"sum\",\"total\":4}",
        "playerid": "API",
        "avatar": false,
        "inlinerolls": {
            
        },
        "origRoll": "1d4+3",
        "signature": "7068d6aeb53e7cda5f2143b3b77153cfc9f2366d9b7917d4febb280086e87c4efe2cdaaa2b45dd0e8fdb45dd9d2741e9909e9b41a559653f56af5073404d5c9c",
        "_fbid": "-Jnbf4Mgdcb-t3SQVnmO"
    }
]

The second one will have a msg.type of 'general' and the mesg.content will be the string '$[[1]]'. Additionally, it will have a msg.inlinerolls that contains the details of the roll. The $[[1]] is a placeholder for where the roll should go, the 1 is the index into msg.inlinerolls:
[
    {
        "who": "",
        "type": "general",
        "content": "$[[1]]",
        "playerid": "API",
        "avatar": false,
        "inlinerolls": {
            "1": {
                "expression": "1d4+3",
                "results": {
                    "type": "V",
                    "rolls": [
                        {
                            "type": "R",
                            "dice": 1,
                            "sides": 4,
                            "mods": {
                                
                            },
                            "results": [
                                {
                                    "v": 1
                                }
                            ]
                        },
                        {
                            "type": "M",
                            "expr": "+3"
                        }
                    ],
                    "resultType": "sum",
                    "total": 4
                },
                "signature": "3c61313b9f7e929f90ef212b4849ff0e364f1ffe02d287469a5e13dca58e52bb38d22f70ff9b2d8cc1d1a71d53f8a82d06f5119064c65b680197e05b475a5785",
                "rollid": "-Jnbf4MmCx_MIb55wopD"
            }
        }
    }
]

(BTW, when you run this, the inline rolls returns much faster so actually appears in the log sooner, at least for me.)
April 23 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Because the log is not a real console I see a lot of "[object Object]" which requires me to loop through each item and log it. It's a pain. Any way to see the whole thing?

I very much prefer inline, so that's good that it has the object structure straight away.

"[[1d4+3]]" works, but if I put in
sendChat('', '[[10 + @{Ankheg|perception}]]',function(msg){
then the total becomes 0.
April 23 (10 years ago)
The Aaron
Pro
API Scripter
You'll get the [object Object] when you try to put a variable that is an object in a string context and pass it off to log() or put it in a string.
log('my message was '+msg);  // this will implicitly convert msg to a string with the Object.toString() function
The conversion happens as part of the String.concat() function, for which the + is syntactic sugar.

If you just use log() on the bare variable, you will get a JSON representation of it.
log('my message was:');  // output a string label to the console
log(msg); // outputs the object as JSON

What is the value of @{Ankheg|perception} ?
sendChat('', '[[10 + @{Ankheg|perception}]] [[@{Ankheg|perception}]] @{Ankheg|perception}',function(msg){
log(msg);
});
That should let you see it in several different contexts. =D

April 23 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Riiiiight! I always use comma - been ages since I've used "+" but roll20 doesn't allow it. Duh! Thanks!

{"name":"SyntaxError","expected":["\"[\"","[ |\\t]"],"found":"+","message":"Expected \"[\" or [ |\\t] but \"+\" found.","offset":1,"line":1,"column":2}
"Parsing was incomplete due to error(s)"
"SyntaxError: Expected \"[\" or [ |\\t] but \"+\" found."
is the result.

  • attr_peception = @{perception_prof_exp} + @{perception_attribute} + @{perception_bonus}
    • @{perception_prof_exp} = @{jack_of_all_trades}
      • @{jack_of_all_trades} = floor(@{PB} / 2)
        • @{PB} = (2 + floor(abs((@{level}-1)/4)))
          • @{level} = ((@{is_pc} * @{pc_level}) + (@{is_npc} * @{challenge}))
            • @{is_pc} = 0
            • @{pc_level} = 0
            • @{is_npc} = 1
            • @{challenge} = 2
    • @{perception_attribute} = @{wisdom_mod}
      • @{wisdom_mod} = (floor((@{wisdom}-10)/2))
        • @{wisdom} = 13
    • @{perception_bonus} = input with value "0"

Hopefully that helps...
April 23 (10 years ago)
The Aaron
Pro
API Scripter
That is weird. Is this on Dev or Prod?

I'll have to try later tonight and see if I can duplicate this.
April 23 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Prod.

If you use my sheet https://github.com/mlenser/roll20-character-sheets...
you can test all the appropriate values.
and my importer https://github.com/mlenser/roll20/blob/master/scri... and run "!shaped-import" on an Ankheg.

I threw your sendChat into my "parseValuesViaSendChat" function which I've been using for testing.

Ankheg Stats for import if you need it:
ANKHEG
Large monstrosity,. unaligned
Armor Class 14 (natural armor), 11 while prone
Hit Points 39 (6d10 + 6)
Speed 30 ft., burrow 10 ft.
STR
17 (+3)
DEX
11 (+0)
CON
13 (+1)
INT
1 (- 5)
WIS
13 (+1)
CHA
6 (-2)
Senses darkvision 60ft., tremorsense 60ft.,
passive Perception 11
Languages-
Challenge 2 (450 XP)
ACTIONS
Bite. Melee Weapon Attack: +5 to hit, reach 5 ft., one target.
Hit: 9 (2d6 + 3) slashing damage plus 3 (1d6) acid damage. If
the target is a Large or smaller creature, it is grappled (escape
DC 13). Until this grapple ends, the ankheg can bite only the
grappled creature and has advantage on attack rolls to do so.
Acid Spray (Recharge 6). The ankheg spits acid in a line that is
30 feet long and 5 feet wide, provided that it has no creature
grappled. Each creature in that line must make a DC 13
Dexterity saving throw, taking 10 (3d6) acid damage on a failed
save, or half as much damage on a successful one.


Thanks Aaron!
April 23 (10 years ago)
The Aaron
Pro
API Scripter
Sounds good, I'll give it a try later. =D

I do love mysteries.. =D (In fact, one of my daughters has a middle name of "Mystery" =D )
April 23 (10 years ago)
Completely off topic, but that sir is an awesome middle name!
April 24 (10 years ago)
The Aaron
Pro
API Scripter
Ok. I ran that command and I didn't get that error.

"msg.content: !shaped-import"
"---- Parsing statblock ----"
"parsed statblock: ANKHEG#Large monstrosity, unaligned#Armor Class 14 (natural armor), 11 while prone#Hit Points 39 (6d10 + 6)#Speed 30 ft, burrow 10 ft#STR#17 (+3)#DEX#11 (+0)#CON#13 (+1)#INT#1 (- 5)#WIS#13 (+1)#CHA#6 (-2)#Senses darkvision 60ft, tremorsense 60ft, passive Perception 11#Languages-#Challenge 2 (450 XP)#ACTIONS#Bite. Melee Weapon Attack: +5 to hit, reach 5 ft, one target.Hit: 9 (2d6 + 3) slashing damage plus 3 (1d6) acid damage. If the target is a Large or smaller creature, it is grappled (escape DC 13). Until this grapple ends, the ankheg can bite only the grappled creature and has advantage on attack rolls to do so.#Acid Spray (Recharge 6). The ankheg spits acid in a line that is#30 feet long and 5 feet wide, provided that it has no creature grappled. Each creature in that line must make a DC 13#Dexterity saving throw, taking 10 (3d6) acid damage on a failed save, or half as much damage on a successful one.#"
"ERROR: You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info."
"Ability Init created"
"ERROR: Unable to find character repeating_actions_0_var_attack in chat command."
"ERROR: Unable to find character repeating_actions_0_var_attack in chat command."
"ERROR: Unable to find character repeating_actions_0_var_crit in chat command."
"ERROR: Unable to find character repeating_actions_0_var_crit in chat command."
"ERROR: Unable to find character repeating_actions_0_var_damage in chat command."
"ERROR: Unable to find character repeating_actions_0_var_damage in chat command."
"ERROR: Unable to find character repeating_actions_0_var_second_damage in chat command."
"ERROR: Unable to find character repeating_actions_0_var_second_damage in chat command."
"ERROR: Unable to find character repeating_actions_0_var_effects in chat command."
"ERROR: Unable to find character repeating_actions_0_var_effects in chat command."
"ERROR: Unable to find character repeating_actions_0_var_details in chat command."
"ERROR: Unable to find character repeating_actions_0_var_details in chat command."
"Ability Bite created"
"ERROR: Unable to find character repeating_actions_1_var_recharge in chat command."
"ERROR: Unable to find character repeating_actions_1_var_recharge in chat command."
"ERROR: Unable to find character repeating_actions_1_var_effects in chat command."
"ERROR: Unable to find character repeating_actions_1_var_effects in chat command."
"Ability Acid Spray created"
"ERROR: Unable to find character selected in chat command."
"ERROR: Unable to find character selected in chat command."
"bar1: setting link to: -JnctY43et1xcYMLnUyu"
"bar1: setting current to: 14"
"bar2: setting current to: "
"bar3: setting current to: 39"
"bar3: setting max to: 39"
"Ankheg created"

April 24 (10 years ago)
The Aaron
Pro
API Scripter

Kevin said:

Completely off topic, but that sir is an awesome middle name!

Hahahaha, yup. We're not a family that picks run of the mill names. =D Aeris, Guinevere, Rowan, Griffin, Zephyr, Dresden and Corwin so far. =D
April 24 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Looks like you didn't use the latest html.

But that's unrelated. Did it log perception? I don't see it in the log.
April 24 (10 years ago)
The Aaron
Pro
API Scripter
Ah, I missed that it was updated. It created perception. I'll delete it and try again with the new html
April 24 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
It should put perception in the bar. Try logging passive_perception in the "parseValuesViaSendChat" function. That's where my error was showing.
April 25 (10 years ago)
The Aaron
Pro
API Scripter
Ok. loaded and ran again with the right HTML, and messed around a bit. If you use getAttrByName, the value you get from the perception attribute is this:
perception_prof_exp + perception_attribute + perception_bonus
When that gets combine with 10 in an inline formula the words drop out and you get:
[[ 10 + + + 0 ]]
not sure where the 0 comes from, probably some code designed to fill in blanks being added.

So, I have no idea why this is happening. My guess is something to do with the way the HTML portion of the sheet is setup for that attribute. I'd take a look at the other character sheets with similar behavior and see if anything jumps out at you. You might also consider describing the problem in the Character Sheets forum and see if someone pipes up with an answer.

April 25 (10 years ago)

Edited April 25 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Yup, I see the issue as well.

Both "perception_attribute" and "perception_prof_exp" are empty
"perception_attribute"
[{"who":"","type":"general","content":"[[]]","playerid":"API","avatar":false,"inlinerolls":{}}]
"perception_prof_exp"
[{"who":"","type":"general","content":"[[]]","playerid":"API","avatar":false,"inlinerolls":{}}]
This is what a working roll looks like:
"wisdom_mod"
[{"who":"","type":"general","content":"$[[1]]","playerid":"API","avatar":false,"inlinerolls":{"1":{"expression":"(floor((13-10)/2))","results":{"type":"V","rolls":[{"type":"M","expr":"(floor((13-10)/2))"}],"resultType":"M","total":1},"signature":"03b4ca6ab4325c0788c57a51fb8ae2b2587e69d99dcc81685e0113106233ac0278998908c74845f8d077cd8e1bbb1faa44ad03779f4e1476260078fd7219a925","rollid":"-JnjoDVH_CC3bd1gLgoO"}}}]

Coincidentally both "perception_attribute" and "perception_prof_exp" are selects that have not been manually edited (therefore creating an attribute)

<select name="attr_perception_attribute" class="sheet-skills-attribute-selector">
  <option value="@{strength_mod}">Str</option>
  <option value="@{dexterity_mod}">Dex</option>
  <option value="@{constitution_mod}">Con</option>
  <option value="@{intelligence_mod}">Int</option>
  <option value="@{wisdom_mod}" selected="selected">Wis</option>
  <option value="@{charisma_mod}">Cha</option>
</select>
<select name="attr_perception_prof_exp">
    <option value="@{jack_of_all_trades}">—    Unproficient</option>
    <option value="@{PB}"> +    Proficient</option>
    <option value="@{exp}">++    Expertise</option>
</select>
So it looks like a select does not have a default value. If I manually edit them then it gets the values without issue. Maybe there is something wrong with how I've setup the select? It follows normal convention and works for everything else.


It also seems like a checkbox is not working as well:
"TypeError: Object 1 has no method 'replace'"
when only testing
sendChat('', '[[@{Ankheg|is_npc}]]',function(msg){
    log('is_npc');
    log(msg);
});
which is defined on the sheet as
<input class="sheet-tab-is-npc" type="checkbox" name="attr_is_npc" value="1">
It prints out fine when I try it in roll20 itself.
It still fails even if I manually define it.


Conclusion: If I manually edit the selects to have a value and avoid using a checkbox in formulas it works without a problem.
April 26 (10 years ago)

Edited April 26 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Aaron,

Any insights here? I'm sure you're a bit tired of this one too, but do you know why the select boxes do not return the selected value by default (or how to set a default value returned on select boxes).
Checkboxes, even if they are checked, do not seem to return the value on them.

Thanks so much!
April 26 (10 years ago)
The Aaron
Pro
API Scripter
I actually already posted this thread for review by the devs, but they are quite busy, so I don't know that you'll get insight from them too soon. You might want to try posting a question in the Character Sheets forum and see if anyone else has run into this issue.

In the interim, you could try something like:
sendChat('', '[[10 + '+
    (getAttrByName(
        (findObjs({
            type:'character',
            name:'Ankheg'
        })[0] || {id: -0}).id,
    'perception') || '')
        .replace(/(\w+)/g,'@{Ankheg|$1}')
    +']]',function(msg){
        log(msg);
    });
Not pretty, but should work... =D
April 26 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

In the interim, you could try something like:
sendChat('', '[[10 + '+
    (getAttrByName(
        (findObjs({
            type:'character',
            name:'Ankheg'
        })[0] || {id: -0}).id,
    'perception') || '')
        .replace(/(\w+)/g,'@{Ankheg|$1}')
    +']]',function(msg){
        log(msg);
    });

Perception was just a test case. I need it to read an attribute which would have a variable amount of referencing attributes.

But it looks like I may be able to replace perception with those attributes. I can test tomorrow.


Should I post a bug referencing this thread about selects and checkboxes or will your review accomplish the same thing? I don't need it as it's a small feature of a much larger script, but it'd be nice to have. If your alternative works for all cases then it's less of a priority as well.
April 26 (10 years ago)
The Aaron
Pro
API Scripter
What I posted is probably sufficient for dev attention, but a minimal repeatable case might be useful.

My hack above should work in all cases, which of course means there's a case it misses. :)
April 28 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Aaron,

The hack won't work.

It gets to "@{Ankheg|perception_prof_exp} + @{Ankheg|perception_attribute} + @{Ankheg|perception_bonus}", but each of those attributes has sub attributes which needs to be parsed as well. I'd have to dive down every level until I got a real value.

More work than I want to do today with my session later and some sheet priorities.
April 28 (10 years ago)
The Aaron
Pro
API Scripter
Yeah, I can see how that would be a problem. Steve asked for a minimal reproducible case, which I'll try to work on soon. I'm figuring the barest simple "character sheet" with 2-3 fields and a script that sets them and uses them in a calculation like you have above. If you want to throw that together, less work for me. =D
April 28 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

The Aaron said:

Yeah, I can see how that would be a problem. Steve asked for a minimal reproducible case, which I'll try to work on soon. I'm figuring the barest simple "character sheet" with 2-3 fields and a script that sets them and uses them in a calculation like you have above. If you want to throw that together, less work for me. =D
I can't today, but maybe tomorrow or Thursday.