Jump to content

Lions, Namespaces and Callables, Oh My!


fordhamflash

Recommended Posts

Just when I thought I was making a ton of progress - whammy!

 

I keep getting the "command is uncallable from remote" error even though I have added callable(namespace."blah blah") command. Even when I try to make the function callable, I am still getting the uncallable error message and broken function.

 

Any ideas?

Link to comment
Share on other sites

Also, when it seems that I get past the "callable" error, I am then getting a "nil value" in the function error. Basically, using the "debug" menu as a template, I've created a window with two combo boxes - one for torpedo type and the other for warhead type.

 

torpedoBodyCombo = tab:createComboBox(Rect(vec2(100, 100), vec2(350, 125)), "onTorpedoBodySelect")
    torpedoWarheadCombo = tab:createComboBox(Rect(vec2(450, 100), vec2(700, 125)), "onTorpedoWarheadSelect")

function AdvancedCommands.onTorpedoBodySelect()
local torpedoBodyType = torpedoBodyCombo.selectedIndex + 1
print(torpedoBodyType)

end

function AdvancedCommands.onTorpedoWarheadSelect()
local torpedoWarheadType = torpedoWarheadCombo.selectedIndex + 1
print(torpedoWarheadType)
end

function AdvancedCommands.onTorpedoBuildPressed()
invokeServerFunction("onTorpedoBodySelect", "onTorpedoWarheadSelect")
local torpedoBodyType = torpedoBodyCombo.selectedIndex + 1
local torpedoWarheadType = torpedoWarheadCombo.selectedIndex + 1
print(torpedoWarheadType)
print(torpedoBodyType)

local ship = Entity()
local launcher = TorpedoLauncher(ship.index)
if launcher == nil then return end
local x, y = Sector():getCoordinates()

local torpedo = AdvancedTorpedoGenerator.generate(x, y, nil, nil, torpedoWarheadType, torpedoBodyType)
--for i = 1, 10 do
launcher:addTorpedo(torpedo)
--end
end
callable(AdvancedCommands, "onTorpedoBodySelect")
callable(AdvancedCommands, "onTorpedoWarheadSelect")

Link to comment
Share on other sites

Of course. Just a frustrating few days.

 

So I went back and started reading about entity component systems basics. Clearly the source of my problems.

 

I have figured out how to generate torpedoes and load up my ship no problem. I have made "custom torpedoes" which are a heck of a lot of fun. But I can only generate "pre-determined" combinations of torpedo types and warheads.

 

So I am trying to create an interface where the player can select a torpedo type and warhead type and then build torpedoes. I think my struggles relate to the very nature of the entity component systems itself.

 

(1) My lua file contains a function for a UI with combo boxes and build button.

 

(2) My lua file contains a function for generating the torpedoes.

 

Is each function a separate script which are attached to different objects? Is the entire lua file a single script that is attached to an object?  To which object(s) are they attached and how the heck is that done? How do I get variables from one function to another?

 

Anyway, I am going to continue to read on to try to get a better grasp on this.

Link to comment
Share on other sites

So I have attached my two most recent client logs and server logs from tonight. Reading up on ECS was VERY helpful. At this point, I stil have the problem of the torpedo launcher not loading.

 

In looking over the logs, it looks like "MY" torpedo generator is creating some type of object error while the ENTITYDBG generator does not. I suspect this explains the problem but is over my head at this time.

 

Any help would be greatly appreciated. I think I'm on hour 184 on this little project of mine!

clientlog_2019-07-24_02-43-53.txt

clientlog_2019-07-24_00-06-58.txt

serverlog_2019-07-24_02-44-11.txt

serverlog_2019-07-24_02-40-08.txt

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...