OK here is an update of the macro.

It check actions for skill, check for critical faliure and critical success, and calculate time needed to use skill.

For now just two skill, but is possible to add all the actions for all the skill ... just need time

In any case any advie is well accepted.

Luca

**Code:**

[H: action1Balance = "desc=7-12 inches wide;dc=10;critfail=5;critsuc=0;time=1d4;failT=you cannot move for 1 round;critfT=you fall"]

[H: action2Balance = "desc=2-6 inches wide;dc=15;critfail=5;critsuc=0;time=1d4;failT=you cannot move for 1 round;critfT=you fall"]

[H: action3Balance = "desc=Less than 2 inches wide;dc=20;critfail=5;critsuc=0;time=1d4;failT=you cannot move for 1 round;critfT=you fall"]

[H: action4Balance = "desc=Uneven flagstone;dc=10;critfail=5;critsuc=0;time=1d4;failT=you cannot move for 1 round;critfT=you fall"]

[H: action5Balance = "desc=Hewn stone floor;dc=10;critfail=5;critsuc=0;time=1d4;failT=you cannot move for 1 round;critfT=you fall"]

[H: action6Balance = "desc=Sloped or angled floor;dc=10;critfail=5;critsuc=0;time=1d4;failT=you cannot move for 1 round;critfT=you fall"]

[H: skillAction1= ";"]

[H: skillAction1 = setStrProp(skillAction1, "1", encode(action1Balance))]

[H: skillAction1 = setStrProp(skillAction1, "2", encode(action2Balance))]

[H: skillAction1 = setStrProp(skillAction1, "3", encode(action3Balance))]

[H: skillAction1 = setStrProp(skillAction1, "4", encode(action4Balance))]

[H: skillAction1 = setStrProp(skillAction1, "5", encode(action5Balance))]

[H: skillAction1 = setStrProp(skillAction1, "6", encode(action6Balance))]

[H: action1DD = "desc=Simple;dc=10;critfail=5;critsuc=10;time=1;failT=you can try again;critfT=Activates;critsT=you can bypass without disarm"]

[H: action2DD = "desc=Triky;dc=15;critfail=5;critsuc=10;time=1d4;failT=you can try again;critfT=Activates;critsT=you can bypass without disarm"]

[H: action3DD = "desc=Difficult;dc=20;critfail=5;critsuc=10;time=2d4;failT=you can try again;critfT=Activates;critsT=you can bypass without disarm"]

[H: action4DD = "desc=Wicked;dc=25;critfail=5;critsuc=10;time=2d4;failT=you can try again;critfT=Activates;critsT=you can bypass without disarm"]

[H: skillAction2= ";"]

[H: skillAction2 = setStrProp(skillAction2, "1", encode(action1DD))]

[H: skillAction2 = setStrProp(skillAction2, "2", encode(action2DD))]

[H: skillAction2 = setStrProp(skillAction2, "3", encode(action3DD))]

[H: skillAction2 = setStrProp(skillAction2, "4", encode(action4DD))]

[H: skillActions= ";"]

[H: skillActions = setStrProp(skillActions, "Balance", encode(skillAction1))]

[H: skillActions = setStrProp(skillActions, "DisableDevice", encode(skillAction2))]

[H: numSkills = countStrProp(Skills)]

[H: skillList = ""]

[H, C(numskills, ""): skillList = skillList + indexKeyStrProp(Skills, roll.count) + ", "]

[H: secret = getStrProp(Private, "SecretSkill")]

[H: secret = if(secret == "", 0, secret)]

[H: success = input(

"tempSkill | " + skillList + " | Select a skill | LIST | VALUE=STRING SELECT=" + listFind(skillList, getStrProp(Private, "LastSkill")),

"tempBonus | 0 | Temporary bonus",

"secret|Public, Secret|Secret?|RADIO|ORIENT=H SELECT=" + secret

)]

[H: abort(success)]

[H: tSkill = getStrProp(Skills, tempSkill)]

[H: tStatB = getStrProp(SkillStat, tempSkill)]

[H: tACP = ArmorCheckPenalty * getStrProp(SkillArmor, tempSkill)]

[H: tActions = getStrProp(skillActions,tempSkill)]

[H: tActions = decode(tActions)]

[H: numActions = countStrProp(tActions)]

[H: actionList = ""]

[COUNT(numActions, ""), CODE: {

[H: anAction = decode(indexValueStrProp(tActions, roll.count))]

[H: actionList = actionList + getStrProp(anAction,"desc") + ", "]

}]

[H: success1 = input(

"tempAction | " + actionList + " | Select an action for " + tempSkill + " | LIST | VALUE=NUMBER"

)]

[H: abort(success1)]

[H: theAction = decode(indexValueStrProp(tActions, tempAction))]

[H: actionDesc = getStrProp(theAction,"desc")]

[H: actionDC = getStrProp(theAction,"dc")]

[H: actionDCcf = getStrProp(theAction,"critfail")]

[H: actionDCcs = getStrProp(theAction,"critsuc")]

[H: actionTime = getStrProp(theAction,"time")]

[H: actionft = getStrProp(theAction,"failT")]

[H: actioncft = getStrProp(theAction,"critfT")]

[H: Private = setStrProp(Private, "LastSkill", tempSkill)]

[H: Private = setStrProp(Private, "SecretSkill", secret)]

[H: dieroll = 1d20]

[H: sCheck = dieroll + tSkill + tStatB + tACP + SkillMisc + tempBonus]

[H: resStr = ""]

[IF(sCheck>=actionDC), CODE:

{

[IF(actionDCcs!=0 && sCheck>(actionDC+actionDCcs)),CODE:

{

[H:resStr ="High Success: It takes " +eval(actionTime)+" rounds"]

};

{

[H:resStr ="Success: It takes " +eval(actionTime)+" rounds"]

}

]

};

{

[IF(actionDCcf!=0 && sCheck<(actionDC-actionDCcf)),CODE:

{

[H:resStr ="Critical Faliure: " +actioncft]

};

{

[H:resStr="Faliure: " +actionft]

}

]

}

]

[IF(secret == 1 && isGM()), CODE:

{

[H: success = input(

"junk|" + sCheck + "|" + tempSkill + "Check|LABEL",

"junk2|DieRoll=" + dieroll + " Skill=" + tSkill + " StatBonus=" + tStatB +" ACP=" + tACP +" SkillMisc=" + SkillMisc +" temp=" + tempBonus +"|Details|LABEL",

"junk3|"+actionDesc+" (DC="+")"+"|Action|LABEL"

)]

[H: abort(0)]

};

{

<b> [R: tempSkill] Check: </b> [T(sCheck): dieroll + tSkill + tStatB + tACP + SkillMisc + tempBonus]<br/>[R:resStr]<br/>[R:actionDesc] (DC[R:actionDC])<br/>

}

]