• 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!

Ping System (OTHire)

yes men i did
Code:
ERROR: lua function callback failed: LUA ERROR:
/client_options/options.lua:203: attempt to call field 'setPingVisible' (a nil value)
stack traceback:
    [C]: in function 'setPingVisible'
    /client_options/options.lua:203: in function 'setOption'
    /client_options/options.lua:143: in function 'setup'
    /client_options/options.lua:115: in function </client_options/options.lua:115>.

could you show me your option.lua file? pls
 
yes men i did
Code:
ERROR: lua function callback failed: LUA ERROR:
/client_options/options.lua:203: attempt to call field 'setPingVisible' (a nil value)
stack traceback:
    [C]: in function 'setPingVisible'
    /client_options/options.lua:203: in function 'setOption'
    /client_options/options.lua:143: in function 'setup'
    /client_options/options.lua:115: in function </client_options/options.lua:115>.

could you show me your option.lua file? pls
Code:
local defaultOptions = {
  vsync = true,
  showFps = false,
  showPing = false,
  fullscreen = false,
  classicControl = false,
  autoChaseOverride = true,
  showStatusMessagesInConsole = true,
  showEventMessagesInConsole = true,
  showInfoMessagesInConsole = true,
  showTimestampsInConsole = true,
  showPrivateMessagesInConsole = true,
  showPrivateMessagesOnScreen = true,
  showLeftPanel = false,
  foregroundFrameRate = 61,
  backgroundFrameRate = 201,
  painterEngine = 0,
  displayNames = true,
  displayHealth = true,
  displayText = true,
  dontStretchShrink = false,
  smoothWalk = true,
  walkingRepeatDelayScrollBar = 100,
  walkingSensitivityScrollBar = 50,
  bouncingKeys = true,
  bouncingKeysDelayScrollBar = 100,
  smartWalk = false,
  blueNpc = true,
  expBar = false,
}

local optionsWindow
local optionsButton
local hotkeysButton
local optionsTabBar
local options = {}
local generalPanel
local consolePanel
local graphicsPanel
local keyboardPanel
local soundPanel

local function setupGraphicsEngines()
  local enginesRadioGroup = UIRadioGroup.create()
  local ogl1 = graphicsPanel:getChildById('opengl1')
  local ogl2 = graphicsPanel:getChildById('opengl2')
  local dx9 = graphicsPanel:getChildById('directx9')
  enginesRadioGroup:addWidget(ogl1)
  enginesRadioGroup:addWidget(ogl2)
  enginesRadioGroup:addWidget(dx9)

  if g_window.getPlatformType() == 'WIN32-EGL' then
    enginesRadioGroup:selectWidget(dx9)
    ogl1:setEnabled(false)
    ogl2:setEnabled(false)
    dx9:setEnabled(true)
  else
    ogl1:setEnabled(g_graphics.isPainterEngineAvailable(1))
    ogl2:setEnabled(g_graphics.isPainterEngineAvailable(2))
    dx9:setEnabled(false)
    if g_graphics.getPainterEngine() == 2 then
      enginesRadioGroup:selectWidget(ogl2)
    else
      enginesRadioGroup:selectWidget(ogl1)
    end

    if g_app.getOs() ~= 'windows' then
      dx9:hide()
    end
  end

  enginesRadioGroup.onSelectionChange = function(self, selected)
    if selected == ogl1 then
      setOption('painterEngine', 1)
    elseif selected == ogl2 then
      setOption('painterEngine', 2)
    end
  end

  --[[--]]if not g_graphics.canCacheBackbuffer() then
    graphicsPanel:getChildById('foregroundFrameRate'):disable()
    graphicsPanel:getChildById('foregroundFrameRateLabel'):disable()
  end--
end

function init()
  for k,v in pairs(defaultOptions) do
    g_settings.setDefault(k, v)
    options[k] = v
  end

  optionsWindow = g_ui.displayUI('options')
  optionsWindow:hide()

  optionsTabBar = optionsWindow:getChildById('optionsTabBar')
  optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent'))

  g_keyboard.bindKeyDown('Ctrl+F', function() toggleFullScreen() end)
  g_keyboard.bindKeyDown('Ctrl+N', toggleDisplays)

  hotkeysButton = optionsWindow:getChildById('hotkeysButton')

  generalPanel = g_ui.loadUI('game')
  optionsTabBar:addTab(tr('General'), generalPanel, '/images/optionstab/option_button')

  consolePanel = g_ui.loadUI('Console')
  optionsTabBar:addTab(tr('Console'), consolePanel, '/images/optionstab/option_button')

  graphicsPanel = g_ui.loadUI('Graphics')
  optionsTabBar:addTab(tr('Graphics'), graphicsPanel, '/images/optionstab/option_button')
 
  keyboardPanel = g_ui.loadUI('keyboard')
  optionsTabBar:addTab(tr('Keyboard'), keyboardPanel, '/images/optionstab/option_button')
  g_app.setForegroundPaneMaxFps(0)
 
  addEvent(function() setup() end)
end

function toggleFullScreen()
  local screenButton = modules.game_playerbars.fullScreenButton
   if not g_window.isFullscreen() then
     screenButton:setChecked(true)
     g_window.setFullscreen(true)
   else
     g_window.setFullscreen(false)
     screenButton:setChecked(false)
   end
end

function setup()
  local gameMapPanel = modules.game_interface.getMapPanel()
  --gameMapPanel:setDrawLights(false)
  setupGraphicsEngines()
  -- load options
  for k,v in pairs(defaultOptions) do
    if type(v) == 'boolean' then
      setOption(k, g_settings.getBoolean(k), true)
    elseif type(v) == 'number' then
      setOption(k, g_settings.getNumber(k), true)
    end
  end
end

function toggle()
  if optionsWindow:isVisible() then
    hide()
  else
    show()
  end
  if g_game.isOnline() then
     hotkeysButton:enable()
     hotkeysButton:setOpacity(1)
  else
     hotkeysButton:disable()
  end
end

function show()
  optionsWindow:show()
  optionsWindow:raise()
  optionsWindow:focus()
end

function hide()
  optionsWindow:hide()
end

function toggleDisplays()
  if options['displayNames'] and options['displayHealth'] then
    setOption('displayNames', false)
  elseif options['displayHealth'] then
    setOption('displayHealth', false)
  else
    if not options['displayNames'] and not options['displayHealth'] then
      setOption('displayNames', true)
    else
      setOption('displayHealth', true)
    end
  end
end

function toggleOption(key)
  setOption(key, not getOption(key))
end

function setOption(key, value, force)
  if not force and options[key] == value then return end
  local gameMapPanel = modules.game_interface.getMapPanel()
  if key == 'vsync' then
    g_window.setVerticalSync(value)
  elseif key == 'showFps' then
    modules.game_interface.setFpsVisible(value)
  elseif key == 'showPing' then
    modules.game_interface.setPingVisible(value)
  elseif key == 'showLeftPanel' then
    modules.game_interface.getLeftPanel():setOn(value)
  elseif key == 'backgroundFrameRate' then
    local text, v = value, value
    if value <= 0 or value >= 201 then text = 'max' v = 0 end
    graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text))
    g_app.setBackgroundPaneMaxFps(v)
   
  elseif key == 'bouncingKeysDelayScrollBar' then
    keyboardPanel:getChildById('bouncingKeysDelayLabel'):setText(tr('Auto bouncing keys interval: %s ms', value))
  elseif key == 'walkingSensitivityScrollBar' then
    keyboardPanel:getChildById('walkingSensitivityLabel'):setText(tr('Walking keys sensitivity: %s%%', value))
  elseif key == 'walkingRepeatDelayScrollBar' then
    keyboardPanel:getChildById('walkingRepeatDelayLabel'):setText(tr('Walking keys auto-repeat delay: %s ms', value))
    local scrollBar = keyboardPanel:getChildById('walkingRepeatDelayScrollBar')
    modules.game_interface.setWalkingRepeatDelay(value)
  elseif key == 'smoothWalk' then
    keyboardPanel:getChildById('walkingSensitivityScrollBar'):setEnabled(value)
    keyboardPanel:getChildById('walkingSensitivityLabel'):setEnabled(value)
  elseif key == 'bouncingKeys' then
    keyboardPanel:getChildById('bouncingKeysDelayScrollBar'):setEnabled(value)
    keyboardPanel:getChildById('bouncingKeysDelayLabel'):setEnabled(value)

  elseif key == 'painterEngine' then
    g_graphics.selectPainterEngine(value)
  elseif key == 'displayNames' then
    gameMapPanel:setDrawNames(value)
  elseif key == 'displayHealth' then
    gameMapPanel:setDrawHealthBars(value)
  elseif key == 'expBar' then
    modules.game_healthinfo.toggleExpBar(value)
   
  elseif key == 'blueNpc' then
    if value then
         g_game.enableFeature(GameBlueNpcNameColor)
    else
       g_game.disableFeature(GameBlueNpcNameColor)
    end
    modules.game_battle.checkCreatures()
  elseif key == 'displayText' then
    gameMapPanel:setDrawTexts(value)
  elseif key == 'dontStretchShrink' then
    addEvent(function()
      modules.game_interface.updateStretchShrink()
    end)
  end

  -- change value for keybind updates
  for _,panel in pairs(optionsTabBar:getTabsPanel()) do
    local widget = panel:recursiveGetChildById(key)
    if widget then
      if widget:getStyle().__class == 'UICheckBox' then
        widget:setChecked(value)
      elseif widget:getStyle().__class == 'UIScrollBar' then
        widget:setValue(value)
      end
      break
    end
  end

  g_settings.set(key, value)
  options[key] = value
end

function getOption(key)
  return options[key]
end

function addTab(name, panel, icon)
  optionsTabBar:addTab(name, panel, icon)
end

function addButton(name, func, icon)
  optionsTabBar:addButton(name, func, icon)
end
 
here you go guys the code is working and tested by me i make the tutorial easy for you guys so follow it and you wont have any problems


Hey Olddies! The ping it's working, i'd tryed with the long sources editing, but I dont know if I did it right.
The case is that I was usgin a local conection (you know; 127.0.0.1) and my ping was between 1000 and - 1800 and starts to kick me every 2 minutes more or less, is this normal? Because it wasn't an internet connection, logically the ping should be 0 with local or i'm wrong?

Anybody else know what is this about or have a similar experience?
 
Hey Olddies! The ping it's working, i'd tryed with the long sources editing, but I dont know if I did it right.
The case is that I was usgin a local conection (you know; 127.0.0.1) and my ping was between 1000 and - 1800 and starts to kick me every 2 minutes more or less, is this normal? Because it wasn't an internet connection, logically the ping should be 0 with local or i'm wrong?

Anybody else know what is this about or have a similar experience?

logically the ping should be 0 with local or i'm wrong?

R: no it shouldn't be showing as 0 thats why you have icmp disabled at your computer to enable its
put at google " how to enable icmp"
regarding to your kick issues something is wrong, because it shouldn't be kicking you out
 
Back
Top