Archlyte
April 1st, 2015, 16:21
I have been modifying the classic traveler ruleset, and I wanted to do a runequest style damage modifier so I used the example on this site. The problem im getting is that nothing displays in the field, and I get Script Error: [string ""]:1: 'then' expected near '&'.
Is the setDice function the problem? I put in all of the customdice in the appropriate file. I'm not sure what is going wrong. Any help is appreciated. The script is as follows:
function recalc()
local siz = window.getDatabaseNode().
getChild("characteristics.C3.current").getValue();
local str = window.getDatabaseNode().
getChild("characteristics.C1.current").getValue();
local tot = siz+str;
if tot > 121 then
setDice({"d10","d10","d4"});
elseif tot > 111 then
setDice({"d10","d10","d2"});
elseif tot > 101 then
setDice({"d10","d10"});
elseif tot > 91 then
setDice({"d10","d8"});
elseif tot > 81 then
setDice({"d8","d8"});
elseif tot > 71 then
setDice({"d8","d6"});
elseif tot > 61 then
setDice({"d6","d6"});
elseif tot > 51 then
setDice({"d12"});
elseif tot > 46 then
setDice({"d10"});
elseif tot > 41 then
setDice({"d8"});
elseif tot > 36 then
setDice({"d6"});
elseif tot > 31 then
setDice({"d4"});
elseif tot > 26 then
setDice({"d2"});
elseif tot > 21 then
setDice({"d2","m2"});
elseif tot > 16 then
setDice({"m2"});
elseif tot > 11 then
setDice({"m4"});
elseif tot > 6 then
setDice({"m6"});
elseif tot > 1 then
setDice({"m8"});
end
end
function onInit()
local siznode = window.getDatabaseNode().
getChild("characteristics.C3.current");
local strnode = window.getDatabaseNode().
getChild("characteristics.C1.current");
if siznode and strnode then
siznode.onUpdate = recalc;
strnode.onUpdate = recalc;
end
recalc();
end
Is the setDice function the problem? I put in all of the customdice in the appropriate file. I'm not sure what is going wrong. Any help is appreciated. The script is as follows:
function recalc()
local siz = window.getDatabaseNode().
getChild("characteristics.C3.current").getValue();
local str = window.getDatabaseNode().
getChild("characteristics.C1.current").getValue();
local tot = siz+str;
if tot > 121 then
setDice({"d10","d10","d4"});
elseif tot > 111 then
setDice({"d10","d10","d2"});
elseif tot > 101 then
setDice({"d10","d10"});
elseif tot > 91 then
setDice({"d10","d8"});
elseif tot > 81 then
setDice({"d8","d8"});
elseif tot > 71 then
setDice({"d8","d6"});
elseif tot > 61 then
setDice({"d6","d6"});
elseif tot > 51 then
setDice({"d12"});
elseif tot > 46 then
setDice({"d10"});
elseif tot > 41 then
setDice({"d8"});
elseif tot > 36 then
setDice({"d6"});
elseif tot > 31 then
setDice({"d4"});
elseif tot > 26 then
setDice({"d2"});
elseif tot > 21 then
setDice({"d2","m2"});
elseif tot > 16 then
setDice({"m2"});
elseif tot > 11 then
setDice({"m4"});
elseif tot > 6 then
setDice({"m6"});
elseif tot > 1 then
setDice({"m8"});
end
end
function onInit()
local siznode = window.getDatabaseNode().
getChild("characteristics.C3.current");
local strnode = window.getDatabaseNode().
getChild("characteristics.C1.current");
if siznode and strnode then
siznode.onUpdate = recalc;
strnode.onUpdate = recalc;
end
recalc();
end