• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Mouse button

Kleston

New Member
Joined
Oct 28, 2013
Messages
31
Reaction score
3
Which functions are responsible for invoking mouse actions?
I mean the left and right button. When u use the right button this is something to happen.
And when the left is something else.

And how it will be in otui with onClick. Because I think it only works on one button
 
Lua:
someWidget.onMouseRelease = function(widget, mousePos, mouseButton)
    if (widget:containsPoint(mousePos) and mouseButton == MouseLeftButton) then
      
    elseif (widget:containsPoint(mousePos) and mouseButton == MouseRightButton) then

end
 
How can I hook up a list of spells under PopMenu?



Lua:
function onSkillEdit(widget, mousePos, mouseButton)
  if mouseButton ~= MouseRightButton then return end
  local skillMenu = g_ui.createWidget('PopupMenu')
  skillMenu:setGameMenu(true)
  skillMenu:addOption(tr('Pos1'), function() createAddWindow() end)
  skillMenu:display(mousePos)
  return true
end
 
Last edited:
You need to make functions for that.
 
Could you tell me what functions?
I have a suggestion for a hint. How to get there?
 
Simply you need to make those functions, functions to add/edit and clear the button.
 
How to display a loop using something from the array
array = {'1', '5', '10' ...etc}

Show on this code.
Lua:
function onSkillEdit(widget, mousePos, mouseButton)
  if mouseButton ~= MouseRightButton then return end
  local skillMenu = g_ui.createWidget('PopupMenu')
  skillMenu:setGameMenu(true)
  skillMenu:addOption(tr('Pos1'), function() createAddWindow() end)
  skillMenu:display(mousePos)
  return true
end
 
Why there is only one icon???

tq8b7c4h39wz.jpg


Lua:
function initializeSkilllist(widget, mousePos, mouseButton)
  if mouseButton ~= MouseRightButton then return end
  local skillMenu = g_ui.createWidget('PopupMenu')
  skillMenu:setGameMenu(true)
  for i = 1, #SkilllistSettings.skillName do
    local skill = SkilllistSettings.skillName[i]
    local info = SkillsInfo[skill]
    skillMenu:setId(spell)
    skillMenu:setPhantom(false)
    local iconId = tonumber(info.icon)
    if not iconId and SkillsIcons[info.icon] then
      iconId = SkillsIcons[info.icon][1]
    end
 
    if not(iconId) then
      perror('Skill icon \'' .. info.icon .. '\' nie znaleziono.')
    end
 
    skillMenu:setHeight(SkilllistSettings.iconSize.height + 4)
    skillMenu:setTextOffset(topoint((SkilllistSettings.iconSize.width + 10) .. ' ' .. (SkilllistSettings.iconSize.height - 32)/2 + 3))
    skillMenu:setImageSource(SkilllistSettings.iconFile)
    skillMenu:setImageClip(Skills.getImageClip(iconId))
    skillMenu:setImageSize(tosize(SkilllistSettings.iconSize.width .. ' ' .. SkilllistSettings.iconSize.height))
    skillMenu:addOption(SkilllistSettings.skillName[i])
  end
  skillMenu:display(mousePos)
  return true
end
 
Back
Top