fordhamflash Posted July 28, 2019 Share Posted July 28, 2019 So I am basically working on a modified / customized version of the entitydbg script. I am trying to include an option for "custom torpedoes." Basically, a window with 1 combo box for torpedo type and another combo box for the warhead type and a button to build. Note: This uses a customized version of torpedogenerator.lua (advancedtorpedogenerator.lua). For the life of me, I cannot get this to work. I have LITERALLY spent an entire week working on this but I am missing something. Generating torpedoes themselves is not a problem IF the torpedo and warhead type are "hard-coded" into the command line. My problem occurs when trying to use the 2 pieces of information entered by the player into the combo boxes to generate torpedoes. Pressing the button starts a function that is supposed to generate the torpedos. No matter what I do or how I do it, the following problem occurs in the torpedo generating function: (1) Before I include the invokeServerFunction language, I have no problem getting the two variables from the combo box function to the torpedo generating function. (I am currently using global variables because I don't know how to pass local variables through the "createButton" string.) I am then able to generate the torpedoes. HOWEVER, THE TORPEDOES DON'T WORK. They don't fire. Upon restart of the game, the torpedoes are gone. It's as if it looks like they are going into the torpedo launcher but for some reason they really are not really there. Even if I "hard code" the torpedo type and warhead type, the torpedoes will NOT work after being generated. (2) Then I add the invokeServerFunction (making it callable). If I "hard code" the torpedo type and warhead type here, I CAN get the torpedoes to generate and work properly. However, if I use the combo boxes and enter the torpedo type and warhead type from the game window, I get an error message which says I am attempting to "index" the combo box variable (a nil value). This is driving me nuts. Seriously, if any of you would like to see a grown man cry, well here I am. I would be SO thankful for any help anyone can provide. I am attaching the following. Text versions of... modinfo.lua init.lua advancedcommands.lua advancedtorpedogenerator.lua Since there is a 4 attachment limit, I am attaching my most recent client and server logs to my reply. modinfo.txt init.txt advancedcommands.txt advancedtorpedogenerator.txt Link to comment Share on other sites More sharing options...
fordhamflash Posted July 28, 2019 Author Share Posted July 28, 2019 Client and server logs... serverlog_2019-07-28_15-10-29.txt clientlog_2019-07-28_15-02-04.txt Link to comment Share on other sites More sharing options...
fordhamflash Posted July 30, 2019 Author Share Posted July 30, 2019 I FIGURED IT OUT! I FIGURED IT OUT! WOO HOOO WOO HOOO I FIGURED IT OUT! I was actually re-writing the script to make a "lesser" functioning script in the meantime. I was looking at entitydbg.lua to look at formatting for labels and buttons, etc. I noticed some similar language in there dealing with adding and removing player scripts. There it was! So, player selected Torpedo Type & Warhead Type. Press of a button starts a function to put the combo box selection into a local variable and then pass that into a function to generate the torpedoes. Not sure if it's 100% correct, but I am now launching custom torpedoes. Watch out Galaxy!!! This is just the beginning of a small project, but I am attaching the lua file just in case my ramblings can help anyone in a similar spot. advancedcommands.txt Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now