-- classic control
else
if useThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton and not g_mouse.isPressed(MouseLeftButton) then
local player = g_game.getLocalPlayer()
print(""..useThing:getId().."")
for example in gameinterface.lua find this part:
Code:-- classic control else if useThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton and not g_mouse.isPressed(MouseLeftButton) then local player = g_game.getLocalPlayer() print(""..useThing:getId().."")
Now just right click on item you want to check id
function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing, attackCreature)
local keyboardModifiers = g_keyboard.getModifiers()
if (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
local player = g_game.getLocalPlayer()
print(""..useThing:getId().."")
end
if (mouseButton == MouseLeftButton and mouseButton == MouseRightButton) then
function customFunction(mousePos, mouseButton)
if mouseButton ~= MouseRightButton then return end
--ur code where u use right mouse button
return true
end
&onMousePress: modules.game_interface.customFunction
LUA:function customFunction(mousePos, mouseButton) if mouseButton ~= MouseRightButton then return end --ur code where u use right mouse button return true end
And add otui file
Code:&onMousePress: modules.game_interface.customFunction
ERROR: failed to load UI from 'gameinterface.otui': cannot have multiple main widgets in otui files
ERROR: Unable to load module 'game_interface': LUA ERROR:
/game_interface/gameinterface.lua:40: attempt to index global 'gameRootPanel' (a nil value)
stack traceback:
[C]: ?
/game_interface/gameinterface.lua:40: in function 'init'
/game_interface/interface.otmod:34:[@onLoad]:1: in main chunk
[C]: in function 'ensureModuleLoaded'
/init.lua:46: in main chunk
FATAL ERROR: Unable to load 'game_interface' module
Look on my code
Mouse button
Because of LOGIC. There is no detection of clicking both buttons in same time. This event (processMouseAction) executes when you click some mouse button: left or right (anyone also 'middle').Why this is working:
Code:function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing, attackCreature) local keyboardModifiers = g_keyboard.getModifiers() if (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then local player = g_game.getLocalPlayer() print(""..useThing:getId().."") end
And this not:
Code:if (mouseButton == MouseLeftButton and mouseButton == MouseRightButton) then
Because of LOGIC. There is no detection of clicking both buttons in same time. This event (processMouseAction) executes when you click some mouse button: left or right (anyone also 'middle').
If you check if button is 'right' AND is 'left' it's always FALSE, because button cannot be left and right in same time.
Because of LOGIC. There is no detection of clicking both buttons in same time. This event (processMouseAction) executes when you click some mouse button: left or right (anyone also 'middle').
If you check if button is 'right' AND is 'left' it's always FALSE, because button cannot be left and right in same time.