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

OTClient [TFS 0.X] Using ActionBar with custom items

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,458
Solutions
17
Reaction score
175
Location
Brazil
Hello,

I'm trying to use custom items i've made in my server with OTCv8 action bar, but seems to be not possible. I'm trying to add some scrolls, fluids and got those errors:
Code:
ERROR: protected lua call failed: /modules/game_actionbar/actionbar.lua:618: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    /modules/game_actionbar/actionbar.lua:618: in function 'okFunc'
    /modules/game_actionbar/actionbar.lua:645: in function </modules/game_actionbar/actionbar.lua:645>
ERROR: protected lua call failed: /modules/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/game_actionbar/actionbar.lua:639: in function </modules/game_actionbar/actionbar.lua:638>
ERROR: /modules/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
ERROR: /modules/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
Connecting to: play.extremeot.com.br:7171
Login to 131.196.196.94:7172
ERROR: protected lua call failed: /modules/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/game_actionbar/actionbar.lua:163: in function </modules/game_actionbar/actionbar.lua:154>
WARNING: attempt to destroy widget 'widget1268' two times

After this i'm not able to add anything on action bar and got this error on log:

Code:
ERROR: protected lua call failed: /modules/game_actionbar/actionbar.lua:966: attempt to call global 'cancelFunc' (a nil value)
stack traceback:
    [C]: in function 'cancelFunc'
    /modules/game_actionbar/actionbar.lua:966: in function 'assignHotkey'
    /modules/game_actionbar/actionbar.lua:432: in function 'optionCallback'
    /modules/corelib/ui/uipopupmenu.lua:63: in function </modules/corelib/ui/uipopupmenu.lua:61>
ERROR: protected lua call failed: /modules/game_actionbar/actionbar.lua:945: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    /modules/game_actionbar/actionbar.lua:945: in function </modules/game_actionbar/actionbar.lua:941>

Now action bar seems totally bugged. Im using OTXServer 2 as engine and 7.72 protocol, action bar was working for runes. Can anyone help me to fix?
 

Attachments

It surprises me how you've posted on this forum 1400 times yet still haven't learned anything.
The error even tells you. actionDesc is nil at line 489
 
It surprises me how you've posted on this forum 1400 times yet still haven't learned anything.
The error even tells you. actionDesc is nil at line 489
I always respect everyone here and try to help when I can. I read the rules again and didn't see that there is a maximum number of topics per member. I read the error, but I believe the solution is not so simple, as it happens with specific types of item.
I kindly ask that, if you are unable to help, do not offend or disturb anyone seeking help.
 
I always respect everyone here and try to help when I can. I read the rules again and didn't see that there is a maximum number of topics per member. I read the error, but I believe the solution is not so simple, as it happens with specific types of item.
I kindly ask that, if you are unable to help, do not offend or disturb anyone seeking help.
Dont sweat it people love to throw statements around like they know what they're doing but then just repeat the error with no flex of actual knowledge. I actually just discovered I have this issue in my tibia/cipsoft themed layout as well and personally, Ive been here for years and dont fully grasp OTCv8 structure yet but can work fine with TFS. Its a matter of skill sets and if the previous user was aware of that he wouldn't be so hasty to judge; especially to someone openly asking for help.

Anyways, after finding this issue today Ive started to test around to see what errors happen during which actions.

(When opening the client + logging in for the first time + having an item set in the action bar)
Code:
ERROR: protected lua call failed: /modules/tibia/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/tibia/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/tibia/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/tibia/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/tibia/game_actionbar/actionbar.lua:163: in function </modules/tibia/game_actionbar/actionbar.lua:154>

(When trying to click ok, apply or cancel)
Code:
ERROR: protected lua call failed: /modules/tibia/game_actionbar/actionbar.lua:618: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    /modules/tibia/game_actionbar/actionbar.lua:618: in function 'okFunc'
    /modules/tibia/game_actionbar/actionbar.lua:647: in function </modules/tibia/game_actionbar/actionbar.lua:647>
ERROR: protected lua call failed: /modules/tibia/game_actionbar/actionbar.lua:618: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    /modules/tibia/game_actionbar/actionbar.lua:618: in function 'okFunc'
    /modules/tibia/game_actionbar/actionbar.lua:645: in function </modules/tibia/game_actionbar/actionbar.lua:645>

(When reloading using CTRL + SHIFT + R)
Code:
WARNING: attempt to destroy widget '0' two times
WARNING: attempt to destroy widget '1' two times
WARNING: attempt to destroy widget '2' two times
WARNING: attempt to destroy widget '3' two times
ERROR: Unable to load module 'game_actionbar': /modules/tibia/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/tibia/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/tibia/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/tibia/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/tibia/game_actionbar/actionbar.lua:163: in function 'online'
    /modules/tibia/game_actionbar/actionbar.lua:72: in function 'init'
    /modules/tibia/game_actionbar/actionbar.otmod:5:[@onLoad]:1: in main chunk
    [C]: in function 'reloadModules'
    /modules/tibia/client/client.lua:19: in function </modules/tibia/client/client.lua:13>
    [C]: in function 'pcall'
    /modules/tibia/corelib/util.lua:311: in function </modules/tibia/corelib/util.lua:309>
WARNING: widget 'widget1280' was not explicitly destroyed
ERROR: Unable to load module 'game_actionbar': /modules/tibia/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/tibia/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/tibia/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/tibia/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/tibia/game_actionbar/actionbar.lua:163: in function 'online'
    /modules/tibia/game_actionbar/actionbar.lua:72: in function 'init'
    /modules/tibia/game_actionbar/actionbar.otmod:5:[@onLoad]:1: in main chunk
    [C]: in function 'reloadModules'
    /modules/tibia/client/client.lua:19: in function </modules/tibia/client/client.lua:13>
    [C]: in function 'pcall'
    /modules/tibia/corelib/util.lua:311: in function </modules/tibia/corelib/util.lua:309>
All modules and scripts were reloaded.
ERROR: lua function callback failed: /modules/tibia/client_options/options.lua:389: attempt to index field 'game_actionbar' (a nil value)
stack traceback:
    [C]: in function '__index'
    /modules/tibia/client_options/options.lua:389: in function 'setOption'
    /modules/tibia/client_options/options.lua:162: in function 'setup'
    /modules/tibia/client_options/options.lua:141: in function </modules/tibia/client_options/options.lua:141>

Its funny actually, because it works with runes. For example, put a fire field rune in the slot - it works fine.
Heck, even a mana potion is working fine. A machete? Works fine.. but a brown mushroom? Doesnt work.
A blue robe, doesnt work.. A studded club does though? ... Like, what is going on haha!

One thing to mention @potinho - I assume like me; you've opted for the cipsoft styled layout rather the default otc layout to mimic the real tibia feel; I can almost positively say that before I made the switch from the standard otc style to tibias, hotkeys were working fine. So Ill continue to investigate and let you know what I find.
 
Last edited:
Dont sweat it people love to throw statements around like they know what they're doing but then just repeat the error with no flex of actual knowledge. I actually just discovered I have this issue in my tibia/cipsoft themed layout as well and personally, Ive been here for years and dont fully grasp OTCv8 structure yet but can work fine with TFS. Its a matter of skill sets and if the previous user was aware of that he wouldn't be so hasty to judge; especially to someone openly asking for help.

Anyways, after finding this issue today Ive started to test around to see what errors happen during which actions.

(When opening the client + logging in for the first time + having an item set in the action bar)
Code:
ERROR: protected lua call failed: /modules/tibia/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/tibia/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/tibia/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/tibia/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/tibia/game_actionbar/actionbar.lua:163: in function </modules/tibia/game_actionbar/actionbar.lua:154>

(When trying to click ok, apply or cancel)
Code:
ERROR: protected lua call failed: /modules/tibia/game_actionbar/actionbar.lua:618: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    /modules/tibia/game_actionbar/actionbar.lua:618: in function 'okFunc'
    /modules/tibia/game_actionbar/actionbar.lua:647: in function </modules/tibia/game_actionbar/actionbar.lua:647>
ERROR: protected lua call failed: /modules/tibia/game_actionbar/actionbar.lua:618: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    /modules/tibia/game_actionbar/actionbar.lua:618: in function 'okFunc'
    /modules/tibia/game_actionbar/actionbar.lua:645: in function </modules/tibia/game_actionbar/actionbar.lua:645>

(When reloading using CTRL + SHIFT + R)
Code:
WARNING: attempt to destroy widget '0' two times
WARNING: attempt to destroy widget '1' two times
WARNING: attempt to destroy widget '2' two times
WARNING: attempt to destroy widget '3' two times
ERROR: Unable to load module 'game_actionbar': /modules/tibia/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/tibia/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/tibia/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/tibia/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/tibia/game_actionbar/actionbar.lua:163: in function 'online'
    /modules/tibia/game_actionbar/actionbar.lua:72: in function 'init'
    /modules/tibia/game_actionbar/actionbar.otmod:5:[@onLoad]:1: in main chunk
    [C]: in function 'reloadModules'
    /modules/tibia/client/client.lua:19: in function </modules/tibia/client/client.lua:13>
    [C]: in function 'pcall'
    /modules/tibia/corelib/util.lua:311: in function </modules/tibia/corelib/util.lua:309>
WARNING: widget 'widget1280' was not explicitly destroyed
ERROR: Unable to load module 'game_actionbar': /modules/tibia/game_actionbar/actionbar.lua:489: attempt to concatenate local 'actionDesc' (a nil value)
stack traceback:
    [C]: in function '__concat'
    /modules/tibia/game_actionbar/actionbar.lua:489: in function 'setupButton'
    /modules/tibia/game_actionbar/actionbar.lua:344: in function 'setupActionBar'
    /modules/tibia/game_actionbar/actionbar.lua:174: in function 'show'
    /modules/tibia/game_actionbar/actionbar.lua:163: in function 'online'
    /modules/tibia/game_actionbar/actionbar.lua:72: in function 'init'
    /modules/tibia/game_actionbar/actionbar.otmod:5:[@onLoad]:1: in main chunk
    [C]: in function 'reloadModules'
    /modules/tibia/client/client.lua:19: in function </modules/tibia/client/client.lua:13>
    [C]: in function 'pcall'
    /modules/tibia/corelib/util.lua:311: in function </modules/tibia/corelib/util.lua:309>
All modules and scripts were reloaded.
ERROR: lua function callback failed: /modules/tibia/client_options/options.lua:389: attempt to index field 'game_actionbar' (a nil value)
stack traceback:
    [C]: in function '__index'
    /modules/tibia/client_options/options.lua:389: in function 'setOption'
    /modules/tibia/client_options/options.lua:162: in function 'setup'
    /modules/tibia/client_options/options.lua:141: in function </modules/tibia/client_options/options.lua:141>

Its funny actually, because it works with runes. For example, put a fire field rune in the slot - it works fine.
Heck, even a mana potion is working fine. A machete? Works fine.. but a brown mushroom? Doesnt work.
A blue robe, doesnt work.. A studded club does though? ... Like, what is going on haha!

One thing to mention @potinho - I assume like me; you've opted for the cipsoft styled layout rather the default otc layout to mimic the real tibia feel; I can almost positively say that before I made the switch from the standard otc style to tibias, hotkeys were working fine. So Ill continue to investigate and let you know what I find.
Thanks bro, if i find something i will post here. Thanks for help!!!
 
I always respect everyone here and try to help when I can. I read the rules again and didn't see that there is a maximum number of topics per member. I read the error, but I believe the solution is not so simple, as it happens with specific types of item.
I kindly ask that, if you are unable to help, do not offend or disturb anyone seeking help.
Fair. Sorry for sounding so hostile in my earlier comment.
If you assign a hotkey with an item on a blank spot it goes to line 582 in actionbar.lua.
Here it's going to check if theres already an item assigned to the spot.
If there is an item already assigned then it's going to try and select the action that was there before as default. If not it doesn't select a radiobox.
Extrodus second console error is related to this. At line 618 when he tries to click apply, the code attempts to fetch the ID of the current selected radiobox. No radiobox is actually selected and causes an error because you're trying to use a function on a nil value.

That means that when setupButton is called your widget.action is blank. That causes itemAction to be nil at line 450.
Then on line 483 your widget.type should be TYPE.ITEM and sets actionDesc = itemAction.
This is the reason for actionDesc being nil and the cause of the error on line 489 because it tries to concatenate a nil value.

Easiest solution to this, just make sure a checkbox is actually set when hitting apply. Otherwise requires some code changes.
 
onsole error is related to this. At line 618 when he tries to click apply, the code attemp
I guess i've got it.

After:
LUA:
local actionType = widget.action or 0
if actionType > ACTION.BLANK then
  local id
  if actionType == ACTION.USE_SELF then
    id = "useSelf"
  elseif actionType == ACTION.USE_TARGET then
    id = "useTarget"
  elseif actionType == ACTION.USE_CROSS then
    id = "useCross"
  elseif actionType == ACTION.EQUIP then
    id = "equip"
  elseif actionType == ACTION.USE then
    id = "use"
  end

  for i, child in ipairs(radio.widgets) do
    local childId = child:getId()
    if childId == id then
      radio:selectWidget(child)
      break
    end
  end
end

I've added:


LUA:
local selectedWidget = radio:getSelectedWidget()
if not selectedWidget then
  radio:selectWidget(radio.widgets[1])
end


And i've changed:

LUA:
local selected = radio:getSelectedWidget():getId()
if selected == "useSelf" then
  settings[widget:getId()].action = ACTION.USE_SELF
elseif selected == "useTarget" then
  settings[widget:getId()].action = ACTION.USE_TARGET
elseif selected == "useCross" then
  settings[widget:getId()].action = ACTION.USE_CROSS
elseif selected == "equip" then
  settings[widget:getId()].action = ACTION.EQUIP
else
  settings[widget:getId()].action = ACTION.USE
end

to

LUA:
local selectedWidget = radio:getSelectedWidget()
if not selectedWidget then
  print("None option selected.")
  return
end

local selected = selectedWidget:getId()
if selected == "useSelf" then
  settings[widget:getId()].action = ACTION.USE_SELF
elseif selected == "useTarget" then
  settings[widget:getId()].action = ACTION.USE_TARGET
elseif selected == "useCross" then
  settings[widget:getId()].action = ACTION.USE_CROSS
elseif selected == "equip" then
  settings[widget:getId()].action = ACTION.EQUIP
else
  settings[widget:getId()].action = ACTION.USE
end

Seems to work, i will do more tests.
 
I guess i've got it.

After:
LUA:
local actionType = widget.action or 0
if actionType > ACTION.BLANK then
  local id
  if actionType == ACTION.USE_SELF then
    id = "useSelf"
  elseif actionType == ACTION.USE_TARGET then
    id = "useTarget"
  elseif actionType == ACTION.USE_CROSS then
    id = "useCross"
  elseif actionType == ACTION.EQUIP then
    id = "equip"
  elseif actionType == ACTION.USE then
    id = "use"
  end

  for i, child in ipairs(radio.widgets) do
    local childId = child:getId()
    if childId == id then
      radio:selectWidget(child)
      break
    end
  end
end

I've added:


LUA:
local selectedWidget = radio:getSelectedWidget()
if not selectedWidget then
  radio:selectWidget(radio.widgets[1])
end


And i've changed:

LUA:
local selected = radio:getSelectedWidget():getId()
if selected == "useSelf" then
  settings[widget:getId()].action = ACTION.USE_SELF
elseif selected == "useTarget" then
  settings[widget:getId()].action = ACTION.USE_TARGET
elseif selected == "useCross" then
  settings[widget:getId()].action = ACTION.USE_CROSS
elseif selected == "equip" then
  settings[widget:getId()].action = ACTION.EQUIP
else
  settings[widget:getId()].action = ACTION.USE
end

to

LUA:
local selectedWidget = radio:getSelectedWidget()
if not selectedWidget then
  print("None option selected.")
  return
end

local selected = selectedWidget:getId()
if selected == "useSelf" then
  settings[widget:getId()].action = ACTION.USE_SELF
elseif selected == "useTarget" then
  settings[widget:getId()].action = ACTION.USE_TARGET
elseif selected == "useCross" then
  settings[widget:getId()].action = ACTION.USE_CROSS
elseif selected == "equip" then
  settings[widget:getId()].action = ACTION.EQUIP
else
  settings[widget:getId()].action = ACTION.USE
end

Seems to work, i will do more tests.

Just hopped on the computer to start more investigating and tested your patch and it seems to be working for the items I had issues with!
Great work brother, I'll do some further tests as well but so far so good!
 

Similar threads

Back
Top