Talador
August 11th, 2013, 16:52
I am trying to understand how the Action Scripts in the 4e ruleset are working. I´ve got a question regarding the function "encodeActionForDrag(draginfo, rSource, sType, rRolls, rCustom)" inside scripts/manager_actions.lua .
As far as I understand, the function is called (among others) when somebody drags an field which contains an action.
The statement "draginfo.setIcon(aActionIcons[sType]);" should render a graphic at the mouse cursor. For example the icon "graphics\icons\action_roll.png". But everytime I drag a field towards the chatbox I only see a dice...
The function and the statement are both definetly called.
function encodeActionForDrag(draginfo, rSource, sType, rRolls, rCustom)
draginfo.setType(sType);
if aActionIcons[sType] then
draginfo.setIcon(aActionIcons[sType]);
end
if #rRolls == 1 then
draginfo.setDescription(rRolls[1].sDesc);
end
draginfo.setSlot(1);
draginfo.setNumberData(#rRolls);
if rSource then
if rSource.sCTNode ~= "" then
draginfo.setShortcutData("combattracker_entry", rSource.sCTNode);
elseif rSource.sCreatureNode ~= "" then
if rSource.sType == "pc" then
draginfo.setShortcutData("charsheet", rSource.sCreatureNode);
elseif rSource.sType == "npc" then
draginfo.setShortcutData("npc", rSource.sCreatureNode);
end
end
end
local nStart = 1;
for kRoll, vRoll in ipairs(rRolls) do
draginfo.setSlot(kRoll + nStart);
draginfo.setStringData(vRoll.sDesc);
draginfo.setDieList(vRoll.aDice);
draginfo.setNumberData(vRoll.nMod);
end
if rCustom then
nStart = nStart + #rRolls;
for kCustom, vCustom in ipairs(rCustom) do
draginfo.setSlot(kCustom + nStart);
draginfo.setStringData(vCustom.sDesc or "");
draginfo.setDieList(vCustom.aDice or {});
draginfo.setNumberData(vCustom.nMod or 0);
draginfo.setShortcutData(vCustom.sClass or "", vCustom.sRecord or "");
end
end
end
What am I missing?
Maybe I missunderstood how dragdata.setIcon() works...
Any help?
As far as I understand, the function is called (among others) when somebody drags an field which contains an action.
The statement "draginfo.setIcon(aActionIcons[sType]);" should render a graphic at the mouse cursor. For example the icon "graphics\icons\action_roll.png". But everytime I drag a field towards the chatbox I only see a dice...
The function and the statement are both definetly called.
function encodeActionForDrag(draginfo, rSource, sType, rRolls, rCustom)
draginfo.setType(sType);
if aActionIcons[sType] then
draginfo.setIcon(aActionIcons[sType]);
end
if #rRolls == 1 then
draginfo.setDescription(rRolls[1].sDesc);
end
draginfo.setSlot(1);
draginfo.setNumberData(#rRolls);
if rSource then
if rSource.sCTNode ~= "" then
draginfo.setShortcutData("combattracker_entry", rSource.sCTNode);
elseif rSource.sCreatureNode ~= "" then
if rSource.sType == "pc" then
draginfo.setShortcutData("charsheet", rSource.sCreatureNode);
elseif rSource.sType == "npc" then
draginfo.setShortcutData("npc", rSource.sCreatureNode);
end
end
end
local nStart = 1;
for kRoll, vRoll in ipairs(rRolls) do
draginfo.setSlot(kRoll + nStart);
draginfo.setStringData(vRoll.sDesc);
draginfo.setDieList(vRoll.aDice);
draginfo.setNumberData(vRoll.nMod);
end
if rCustom then
nStart = nStart + #rRolls;
for kCustom, vCustom in ipairs(rCustom) do
draginfo.setSlot(kCustom + nStart);
draginfo.setStringData(vCustom.sDesc or "");
draginfo.setDieList(vCustom.aDice or {});
draginfo.setNumberData(vCustom.nMod or 0);
draginfo.setShortcutData(vCustom.sClass or "", vCustom.sRecord or "");
end
end
end
What am I missing?
Maybe I missunderstood how dragdata.setIcon() works...
Any help?