Paul Pratt
August 21st, 2009, 00:13
Hello,
I have added to my charsheet a window control that allows me to drag an "armor" link from a library reference, drop it, and have the shortcut cut information populate some pre-exisitng windows.
So far this works fine.
When you left mouse single click the shortcut it opens the shortcut information window, and on a left mouse double click clears the information that was set.
Middle mouse button clears the link from the control.
Again, this portion works, but not exactly how I wanted. I would like the control to be cleared of the link by single click middle mouse, and the information cleared either at the same time, or on a double click, leaving the left mouse button free to do default actions.
I have the script I am using below. How can I change it to do double middle click? My coding skills are "hacktastic" at best, basically I can get away with changing code to get the tweaks I want, this time I am a bit over my head.
Surprised I have it working quite frankly- I am just trying to make sure I am not doing something I can or should avoid doing while scripting too.
(thanks Foen, by searching the boards, some of your old posts lead me down the "click" path...lol you guys are great btw)
function onDrop(x, y, draginfo)
if draginfo.isType("shortcut") then
local link = draginfo.getShortcutData();
if link == "referencearmor" then
local sourcenode = draginfo.getDatabaseNode();
local type = sourcenode.getChild("type").getValue();
if type == "Light armor" or type == "Medium armor" or type == "Heavy armor" then
window.armorshortcut.setValue(draginfo.getShortcut Data());
window.armorname.setValue(sourcenode.getChild("name").getValue());
window.armormaxdexbonus.setValue(sourcenode.getChi ld("maxdex").getValue());
window.armorcheckpenalty.setValue(sourcenode.getCh ild("checkpenalty").getValue());
window.drarmor.setValue(sourcenode.getChild("dr").getValue());
window.maxspeed.setValue(sourcenode.getChild("speed30").getValue());
end
return true;
end
end
end
function onClickDown(button, x, y)
return true;
end
function onDoubleClick(button, x)
window.armorname.setValue(armorname, "");
window.armormaxdexbonus.setValue(armormaxdexbonus, 0);
window.armorcheckpenalty.setValue(armorcheckpenalt y,0);
window.drarmor.setValue(drarmor, 0);
window.maxspeed.setValue(maxspeed, 0);
return true;
end
I have added to my charsheet a window control that allows me to drag an "armor" link from a library reference, drop it, and have the shortcut cut information populate some pre-exisitng windows.
So far this works fine.
When you left mouse single click the shortcut it opens the shortcut information window, and on a left mouse double click clears the information that was set.
Middle mouse button clears the link from the control.
Again, this portion works, but not exactly how I wanted. I would like the control to be cleared of the link by single click middle mouse, and the information cleared either at the same time, or on a double click, leaving the left mouse button free to do default actions.
I have the script I am using below. How can I change it to do double middle click? My coding skills are "hacktastic" at best, basically I can get away with changing code to get the tweaks I want, this time I am a bit over my head.
Surprised I have it working quite frankly- I am just trying to make sure I am not doing something I can or should avoid doing while scripting too.
(thanks Foen, by searching the boards, some of your old posts lead me down the "click" path...lol you guys are great btw)
function onDrop(x, y, draginfo)
if draginfo.isType("shortcut") then
local link = draginfo.getShortcutData();
if link == "referencearmor" then
local sourcenode = draginfo.getDatabaseNode();
local type = sourcenode.getChild("type").getValue();
if type == "Light armor" or type == "Medium armor" or type == "Heavy armor" then
window.armorshortcut.setValue(draginfo.getShortcut Data());
window.armorname.setValue(sourcenode.getChild("name").getValue());
window.armormaxdexbonus.setValue(sourcenode.getChi ld("maxdex").getValue());
window.armorcheckpenalty.setValue(sourcenode.getCh ild("checkpenalty").getValue());
window.drarmor.setValue(sourcenode.getChild("dr").getValue());
window.maxspeed.setValue(sourcenode.getChild("speed30").getValue());
end
return true;
end
end
end
function onClickDown(button, x, y)
return true;
end
function onDoubleClick(button, x)
window.armorname.setValue(armorname, "");
window.armormaxdexbonus.setValue(armormaxdexbonus, 0);
window.armorcheckpenalty.setValue(armorcheckpenalt y,0);
window.drarmor.setValue(drarmor, 0);
window.maxspeed.setValue(maxspeed, 0);
return true;
end