not sure if this is the spot to post this, but i was trying to use a mouseclick for the right mouse button, instead of left,
it doesnt seem like theres a function, or if there is, it isnt the obvious mouseclickR()
so i copied mouseclickL from player.lua:
Code: Select all
function CPlayer:mouseclickL(_x, _y, _wwide, _whigh)
if( foregroundWindow() ~= getWin() ) then
return;
end
detach(); -- Remove attach bindings
local wx,wy,wwide,whigh = windowRect(getWin());
local hf_x, hf_y;
-- recalulate clickpoints depending from the actual RoM windows size
-- only if we know the original windows size from the clickpoints
if(_wwide and _whigh) then
hf_x = wwide * _x / _wwide;
hf_y = whigh * _y / _whigh;
cprintf(cli.green, language[92], -- Mouseclick Left at %d,%d in %dx%d (recalculated
hf_x, hf_y, wwide, whigh, _x, _y, _wwide, _whigh);
else
hf_x = _x;
hf_y = _y;
cprintf(cli.green, language[93], -- Clicking mouseL at %d,%d in %dx%d\n
hf_x, hf_y, wwide, whigh);
end;
mouseSet(wx + hf_x, wy + hf_y);
yrest(100);
mouseLClick();
yrest(100);
attach(getWin()); -- Re-attach bindings
end
and made it a right click:
Code: Select all
function CPlayer:mouseclickR(_x, _y, _wwide, _whigh)
if( foregroundWindow() ~= getWin() ) then
return;
end
detach(); -- Remove attach bindings
local wx,wy,wwide,whigh = windowRect(getWin());
local hf_x, hf_y;
-- recalulate clickpoints depending from the actual RoM windows size
-- only if we know the original windows size from the clickpoints
if(_wwide and _whigh) then
hf_x = wwide * _x / _wwide;
hf_y = whigh * _y / _whigh;
cprintf(cli.green, language[141], -- Mouseclick Right at %d,%d in %dx%d (recalculated
hf_x, hf_y, wwide, whigh, _x, _y, _wwide, _whigh);
else
hf_x = _x;
hf_y = _y;
cprintf(cli.green, language[142], -- Clicking mouseR at %d,%d in %dx%d\n
hf_x, hf_y, wwide, whigh);
end;
mouseSet(wx + hf_x, wy + hf_y);
yrest(100);
mouseRClick();
yrest(100);
attach(getWin()); -- Re-attach bindings
end
it worked for what i needed, to sell off bag items when at a merchant
never worked with that kind of code, so i dont know a whole lot, but if it looks ok can u add it to future revisions
*edit* MM window still spouts out leftclick so addition language needs to be added too
Code: Select all
[141] = "Mouseclick Right at %d,%d in %dx%d (recalculated from %d,%d by %dx%d)\n",
[142] = "Mouseclick Right at %d,%d in %dx%d.\n",