
Hi, I'm hoping to capture two different events in a single repeater. I already have a worker picking up changes in a dropdown (all thanks to GiGs), and that works perfectly now. However I'm hoping to capture changes in a number field, and then apply a second set of values to some of the fields in the repeater (over-writing the values placed in those same fields by the first repeater). What I've tried so far doesn't seem to capture the value change in the number field.on("change:repeating_meleeWeapons:meleeweapontype", function() { //when the WeaponType dropdown changes
getAttrs(["repeating_meleeweapons_MeleeWeaponType"], function(values) { //read the value of the selected entry in the WeaponType dropdown
const meleeWeapons = {
none: {meleeconceal: 0, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Knife: {meleeconceal: -4, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Sword_small: {meleeconceal: -1, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Sword_medium: {meleeconceal: 1, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Sword_large: {meleeconceal: 3, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Club: {meleeconceal: 1, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Staff: {meleeconceal: 5, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Spear: {meleeconceal: 6, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Polearm: {meleeconceal: 7, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0}
};
const MeleeWeaponType = values.MeleeWeaponType; //make a temp variable called "RangedWeaponTypeValue" and store the value of RangedWeaponType in it. If not selected, 0
const thisMeleeWeapon = meleeWeapons[values.repeating_meleeweapons_MeleeWeaponType] || meleeweapons['none'];
setAttrs({
"repeating_meleeWeapons_MeleeConceal": thisMeleeWeapon.meleeconceal,
"repeating_meleeWeapons_MeleeDamageD": thisMeleeWeapon.meleedamaged,
"repeating_meleeWeapons_MeleeDamageC": thisMeleeWeapon.meleedamagec,
"repeating_meleeWeapons_MeleeDamageB": thisMeleeWeapon.meleedamageb,
"repeating_meleeWeapons_MeleeDamageA": thisMeleeWeapon.meleedamagea
});
});
});
on("change:repeating_meleeWeapons:meleeweaponrating", function() { //when the weapon rating changes
getAttrs(["repeating_meleeweapons_MeleeWeaponType"], function(values) { //read the value of the selected entry in the WeaponType dropdown
const meleeWeapons = {
none: {meleeconceal: 0, meleedamaged: 0, meleedamagec: 0, meleedamageb: 0, meleedamagea: 0},
Knife: {meleeconceal: -4, meleedamaged: 1, meleedamagec: 2, meleedamageb: 3, meleedamagea: 4}
};
const MeleeWeaponType = values.MeleeWeaponType; //make a temp variable called "RangedWeaponTypeValue" and store the value of RangedWeaponType in it. If not selected, 0
const thisMeleeWeapon = meleeWeapons[values.repeating_meleeweapons_MeleeWeaponType] || meleeweapons['none'];
setAttrs({
"repeating_meleeWeapons_MeleeConceal": thisMeleeWeapon.meleeconceal,
"repeating_meleeWeapons_MeleeDamageD": thisMeleeWeapon.meleedamaged,
"repeating_meleeWeapons_MeleeDamageC": thisMeleeWeapon.meleedamagec,
"repeating_meleeWeapons_MeleeDamageB": thisMeleeWeapon.meleedamageb,
"repeating_meleeWeapons_MeleeDamageA": thisMeleeWeapon.meleedamagea
});
});
}); So the idea is that selecting the weapon gives you zero values, then defining your skill rating gives you actual values (which need to be calculated from that skill rating... another challenge) What I'm hoping to do here is something like this- Knife: {meleeconceal: -4, meleedamaged: (@{MeleeWeaponRating} * 0.25), meleedamagec: (@{MeleeWeaponRating} * 0.5), meleedamageb: (@{MeleeWeaponRating} * 0.75), meleedamagea: (@{MeleeWeaponRating})} Does that make sense?