@StrawMan
Not sure why this doesn't work.. inc_dot_parse
calls CommandRollDMFI
, and for regular users, this executes the "roll" script.
if (!GetCommanderIsDM(oCommander)) {
// Non-DMs get the regular "roll" command
SetLocalString(oCommander, "roll", sArgs);
ExecuteScriptWithWarn("roll", oCommander);
return;
}
The roll
script then checks for ability and skill check rolls and defaults to figuring out if you sent it a "d8" or "d20". (I chopped this up to make it shorter for display purposes only).
//roll an ability check
if (sArgs == "str") { modifier = ABILITY_STRENGTH; }
else if (sArgs == "dex") { modifier = ABILITY_DEXTERITY; }
// ... etc ...
if(modifier > 0) {
// Do the roll and inform..
return;
}
if (StartsWith(sArgs, "appr")) { iSkill = SKILL_APPRAISE; }
else if (StartsWith(sArgs, "bluf")) { iSkill = SKILL_BLUFF; }
// ... etc...
// roll a skill check
// Not implemented yet cause I don't really have the time.
if(iSkill > 0) {
// Do the roll and inform..
return;
}
// Default is rolling a die if we didn't get out of the script before that.
rollDice(sArgs);
}
void rollDice(string roll) {
int dice = StringToInt(GetStringRight(roll, GetStringLength(roll) - 1)); //The type of dice to roll
int diceresult;
switch(dice) {
case 2: diceresult = d2(); break;
case 3: diceresult = d3(); break;
// .. etc ..
}
inform(roll, diceresult);
}