Overlord Scenario Playtest Thread

Status
Not open for further replies.
Another pokemon appears!

Unit Type Parameters entry 5 has invalid parameter: 1
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:299: Unit Type Parameters has invalid parameters. See the list printed above.
stack traceback:
[C]: in function 'error'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:299: in upvalue 'parameterTableErrorCheck'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:315: in function 'canBuild.supplyUnitTypeParameters'
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:269: in main chunk
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk

Not sure if this is my Object file, or something in the "canbuild" Lua file? Entry 5 would be the USAirborne...Can't see what is up?
 
Can you upload your latest canBuildSettings? The one I have doesn't go to line 269.
 
Hm. There is something about the parameter table for that isn't formatted correctly. But I'm not sure what.

Not sure if Objects is looking for stuff I haven't added yet?

I think objects is kind of a feeder system - it doesn't so much look for stuff as stuff looks for it. But if you didn't have something in the objects file, you'd get a different error telling you that there wasn't any entry for "object.whatever."

This error I think is saying that there is something in your table that isn't formatted correctly. Unfortunately, I am stuck, but hopefully @Prof. Garfield can shed some light on how to read this error. Sorry!
 
No probs, in the meantime - I will build up the homecity and special recruitment tables for the civs...It's good fun...!
Once I get things running, I am going to look at getting the invasions working right, using Lua.

I realise the Lua system removes the need for half the tech-tree "twice removed" tinkering...In that units can only
be built where they are told to be. Simply excellent pontential. My brain is working overtime at the possibilities. :)
 
Lua is exceptionally powerful indeed. There's almost no need for house rules any more if you don't want them. You can simply design out weird issues using it. The biggest problem with lua is it's almost impossible to call a scenario finished because of it. in the old days, there were only so many fields you could fill, and so many events that you could have. Now you can dream up almost anything.
 
Unit Type Parameters entry 5 has invalid parameter: 1
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:299: Unit Type Parameters has invalid parameters. See the list printed above.
Not sure if this is my Object file, or something in the "canbuild" Lua file? Entry 5 would be the USAirborne...Can't see what is up?

This is part of a programmatic check of the table you supply, to hopefully catch errors without having to actually playtest.

Code:
unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}

Should be
Code:
unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements={object.iArmyBase,object.iAirbase}}

The problem is that object.iAirbase was in the table with keys 'location' and 'allImprovements' (instead of in a table of improvements under the key allImprovements), and since it wasn't given a key, lua automatically assigned it with key '1', hence, the invalid parameter was '1'. (I probably designed this to catch spelling errors, so I wasn't thinking of numbers.)

Key value pairs in Lua tables don't really have an order, so you have to enclose the lists in braces to form new tables if you have more than one item. (Sometimes you'll need the braces even for only one item, but in most cases in canBuild, I added them in programmatically during processing.)

I've attached an update that fixes the mistake checking. Now, all the spotted mistakes will be listed before showing the error, rather than throwing an error after the first spotted mistake. Also, a bit of a better explanation will be given for this particular type of error. All I've changed is the code to catch mistakes in making your canBuildSettings, so this update is unnecessary for any already completed scenario.
 

Attachments

  • canBuild.lua-Update.zip
    5 KB · Views: 39
@Prof. Garfield
Hi, sir!
I'm getting confused here. I followed your advice and added one extra bracket to the Airborne values. Just to test it.
Now Lua keeps telling me it has unexpected symbols (guess which!), I remove the brackets, and it seems the
Canbuild tracker thinks my entire UnitParameters are wrong...:)

I attach my current CanBuildSettings file, just so I can show how things are. I am sure I am doing something quite wrong with using
the location and allImprovements data together. I read your explanation and note that I do have the locations in their own tables too.
I appreciate your patience with my neophyte flailings...!

The error is listed here too...

Unit Type Parameters entry 5 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 6 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 12 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 13 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 16 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 17 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 25 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 28 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 29 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 45 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 47 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 50 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 51 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 52 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 53 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 55 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 56 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 57 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 58 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 59 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 60 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 62 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 63 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 64 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 65 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 66 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 67 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 68 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 69 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 70 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 71 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 72 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 73 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 74 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 75 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 76 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 77 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 78 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 79 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 80 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 81 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 82 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 83 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 84 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 85 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 86 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 87 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 88 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 89 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 90 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 91 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 92 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 93 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 94 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 95 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 96 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 97 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 98 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 99 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 100 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 101 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 102 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 103 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 104 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 105 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 106 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 107 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 108 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 109 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 110 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 111 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 112 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 113 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 114 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 115 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 116 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 117 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 118 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 119 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 120 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 121 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 122 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 123 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
Unit Type Parameters entry 124 has invalid parameter: 1
Note: having numbers as invalid parameters usually means you've forgotten to use { and } to make a table for another parameter.
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:307: Unit Type Parameters has invalid parameters. See the list printed above.
stack traceback:
[C]: in function 'error'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:307: in upvalue 'parameterTableErrorCheck'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:322: in function 'canBuild.supplyUnitTypeParameters'
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:385: in main chunk
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk
 

Attachments

  • canBuildSettings.zip
    5.4 KB · Views: 37
In the one that you've attached you have several that don't look as Prof. Garfield stated. However, the thing that I don't understand is it is this:

Unit Type Parameters entry 5

What is "entry 5" and why does US Airborne keep getting brought up if the 5th line down in the unitTypeBuild is the submarine (which seems to be fine)?

unitTypeBuild[object.uSubmarine.id] = {allImprovements={object.iShipyard,object.iNavalBase}}

Other entries aren't accurate:

unitTypeBuild[object.uHeavyArtillery.id] = {allImprovements=object.iFactory,object.iMunitionsPlant}

But by my count, that's "entry 20" which is not listed as having an error.

@Prof. Garfield - is this entry reading the number of the unit from the rules file instead?

if so, Curt, U.S. Airborne still doesn't have the fix:

unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}

Also I'm not sure but I think lua is going to read down the line from top to bottom and U.S. airborne is quite a ways down. This may simply fix when you fix all of these.
 
When I have:

unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}}

(This is line 329)

I get this error:

error loading module 'canBuildSettings' from file 'N:\CIV2 TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua':
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:329: unexpected symbol near '}'
stack traceback:
[C]: in ?
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk


Lua can't make up it's mind. :)
 
Because "you're doing it wrong" :)

unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}}

^ the bold ones go together.

unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}}

^ This bold one is missing a friend, which should be right after the "=" that follows allImprovements​

I was never good at math so I hesitate to try and explain it like it's math, but it's basically math. You need to enclose the different equations. So, you have a "location" equation, and an "allImprovements" equation. The way you've written the above, it's as though it's all one equation (with an extra } thrown in there at the end).
 
Because "you're doing it wrong" :)

unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}}

^ the bold ones go together.

unitTypeBuild[object.uUSAirborne.id] = {location=USAHomeCities,allImprovements=object.iArmyBase,object.iAirbase}}

^ This bold one is missing a friend, which should be right after the "=" that follows allImprovements​

I was never good at math so I hesitate to try and explain it like it's math, but it's basically math. You need to enclose the different equations. So, you have a "location" equation, and an "allImprovements" equation. The way you've written the above, it's as though it's all one equation (with an extra } thrown in there at the end).

Like the monkey man in 2001 Space Odyssey - I see the light...!
When using code like this, I am mass copying data, and one missing bracket becomes many..:)

Sorry for such a newb mistake, sir!
 
Looks like all is working with the brackets, cheers, dude!
A new bug appeared, but might be to do with my city co-ord info:

N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\generalLibrary.lua:2474: ERROR: "getTileID" function called with an invalid tile or coordinates
stack traceback:
[C]: in function 'error'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\generalLibrary.lua:2474: in function 'generalLibrary.getTileId'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:180: in upvalue 'makeNewLocationParameters'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:207: in local 'postProcessParameters'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:240: in upvalue 'postProcessParameterTable'
N:\CIV2 TOT\1_OVERLORDS 1940\LuaCore\canBuild.lua:323: in function 'canBuild.supplyUnitTypeParameters'
...TOT\1_OVERLORDS 1940\LuaRulesEvents\canBuildSettings.lua:385: in main chunk
[C]: in function 'require'
N:\CIV2 TOT\1_OVERLORDS 1940\events.lua:35: in main chunk


The co-ords on line 180 (USA cities) all seem OK, this latest bug brings up something I wished to ask:

Here is line 180:
local USAHomeCities = {{160,92,0},{175,21,0},{183,27,0},{188,56,0},{189,47,0},{190,62,0},{192,66,0},

The zero after the two co-ords, should this zero instead be the map zone? These would be then zone 4 and 57...

EG:
local USAHomeCities = {{160,92,57},{175,21,4},{183,27,4},{188,56,4},{189,47,4},{190,62,4},{192,66,4},

I am barking up the wrong tree here?
 
A new bug appeared, but might be to do with my city co-ord info:

You do have an error with your tile coordinates. Somewhere, there is a tile coordinate that doesn't correspond to an actual tile, but it will not be at line 385 or 180. Unfortunately, this error occurs in such a way that I can't identify the location. I'll see what I can do to to make the message more helpful.

The zero after the two co-ords, should this zero instead be the map zone? These would be then zone 4 and 57...

No, it is supposed to me the map number, like you had before.
 
This canBuild update will print the current unit being processed by canBuild. Once again, if your scenario is working, you don't need this. This will tell you what item was being processed when the error happened, which will give a starting point for finding the mistake.

Add this line

Code:
-- canBuildFunctions.hideProcessingList() -- uncomment if you don't want the list of stuff being processed printed in the console

before these lines
Code:
canBuildFunctions.supplyUnitTypeParameters(unitTypeBuild)
canBuildFunctions.supplyImprovementParameters(improvementBuild)
canBuildFunctions.supplyWonderParameters(wonderBuild)
Once your canBuildSettings work properly, you can uncomment the line so that the processing list won't clutter the console.
 

Attachments

  • canBuild.lua-update-13-mar.zip
    5.2 KB · Views: 43
Status
Not open for further replies.
Top Bottom