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

skill error in terminal

GregoryJ

New Member
Joined
Sep 8, 2013
Messages
21
Reaction score
0
Hello people,

I'm trying to add a new skill under fishing so that we have 7 skills instead of the base 6. But
the client is returning the following error.

Code:
ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:102: attempt to index local 'skill' (a nil value)
stack trackback:
[C]: ?
  /game_skills/skills.lua:102: in function 'setSkillValue'
/game_skills/skills.lua:377: in function 'onSkillChange'
/game_skills/skills.lua:208: in function </game_skills/skills.lua:188>

ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:102: attempt to index local 'skill' (a nil value)
[C]: ?
  /game_skills/skills.lua:102: in function 'setSkillValue'
/game_skills/skills.lua:377: in function </game_skills/skills.lua:376>

ERROR: protected lua call failed: LUA ERROR:
/game_skills/skills.lua:86: attempt to index local 'skill' (a nil value)
stack trackback:
[C]: ?
/game_skills/skills.lua:86: in function 'setSkillBase'
/game_skills/skills.lua:384: in function </game_skills/skills.lua:383>

my skills.lua:

line 102

Code:
function setSkillValue(id, value)
  local skill = skillsWindow:recursiveGetChildById(id)
  local widget = skill:getChildById('value')
  widget:setText(value)
end

line 377

Code:
function onSkillChange(localPlayer, id, level, percent)
  setSkillValue('skillId' .. id, level)
  setSkillPercent('skillId' .. id, percent, tr('You have %s percent to go', 100 - percent))

  onBaseSkillChange(localPlayer, id, localPlayer:getSkillBaseLevel(id))
end

line 208

Code:
  for i=0,7 do
  onSkillChange(player, i, player:getSkillLevel(i), player:getSkillLevelPercent(i))
  onBaseSkillChange(player, i, player:getSkillBaseLevel(i))
  end

  update()

  local contentsPanel = skillsWindow:getChildById('contentsPanel')
  skillsWindow:setContentMinimumHeight(50)
  skillsWindow:setContentMaximumHeight(390)
end

line 86

Code:
function setSkillBase(id, value, baseValue)
  if baseValue <= 0 or value < 0 then
  return
  end
  local skill = skillsWindow:recursiveGetChildById(id)
  local widget = skill:getChildById('value')

  if value > baseValue then
  widget:setColor('#008b00') -- green
  skill:setTooltip(baseValue .. ' +' .. (value - baseValue))
  elseif value < baseValue then
  widget:setColor('#b22222') -- red
  skill:setTooltip(baseValue .. ' ' .. (value - baseValue))
  else
  widget:setColor('#bbbbbb') -- default
  skill:removeTooltip()
  end
end

and line 384

Code:
function onBaseSkillChange(localPlayer, id, baseLevel)
  setSkillBase('skillId'..id, localPlayer:getSkillLevel(id), baseLevel)
end



I have changed this in the enum Skills on my client source files like so:

Code:
  enum Skill {
  Fist = 0,
  Club,
  Sword,
  Axe,
  Distance,
  Shielding,
  Fishing,
  Cooking,
  LastSkill
  };

and also in my sever files (enums.h)

Code:
enum skills_t {
   SKILL_FIRST = 0,
   SKILL_FIST = SKILL_FIRST,
   SKILL_CLUB = 1,
   SKILL_SWORD = 2,
   SKILL_AXE = 3,
   SKILL_DISTANCE = 4,
   SKILL_SHIELD = 5,
   SKILL_FISHING = 6,
   SKILL_COOKING = 7,
   SKILL_MAGLEVEL = 8,
   SKILL_LEVEL = 9,
   SKILL_LAST = SKILL_COOKING
};

I've also added "cooking" under all of the other skill occurrences (Condition_params in condition.cpp, AddPlayerSkills in protocolgame.cpp, getSkillName in tools.cpp and registerEnum in luascript.cpp)


If someone could give me a pointer on what I'm doing wrong it would be greatly appreciated.

Thanks alot
 
Last edited:
Back
Top