I did something similar for Horsey. I ran your test code, and found a few changes that should get you going. First, none of the imports in your common file are reaching the later scripts. So I removed it altogether.
For your Main.lua
, I ended up with:
--Just for clarification on what I'm doing, changing name on
--the Turbine.Shell Command() to BSCommand
BSCommand = Turbine.ShellCommand();
--Could put this inside the Execute function but decided on having
--it here instead take a look at line 18 on how I'm using it
return "This is the Help Command"
--adds the commands /bs or /bagspaceleft to lotro
--Here comes the real adding of commands to the plugin. for example
--"/bs bagsize" will call the command BagspaceLeft:BagSize() that lies in
function BSCommand:Execute( command, arguments)
if (arguments=="getsize") then
elseif (arguments == "help") then
--Welcome Message when loading the plugin
Turbine.Shell.WriteLine("BagspaceLeft by Lerusius");
Changes in yellow. I moved the function include here, and the function call name didn't need the index.
For your BagspaceLeft.lua
local player = Turbine.Gameplay.LocalPlayer();
local backpack = player:GetBackpack();
Here I moved the Turbine.Gameplay
import to this script. Also, I changed the now shortened BagspaceLeftFunction()
name. Finally, the self.backpack index won't work here, so it's now a local variable too.
Running that, I get a return of "75" when I enter /bs getsize
Hope this helps!