There were a number of errors I found with a quick look at your script. The critical one was in your 'player lands' part - the if statement was wrong - whenn the first choice is 'if' then the next must be 'elseif'(or 'else' if it will be the last choice). 'else' can be used in an if statement only as the last choice (referring to every other choice other than the ones already specified). In addition, the 'endif' in this if statement must be before the closing bracket.
The script will genereate to some degree if only these features are fixed, but the following are other errors that affect the script:
*extra bracket in the primary Patch section
*missing bracket in creating Knights
*at end of Wolf creation, missing endif
*elevation - several mistakes...cannot use non-land terrains as a base_terrain for elevation, by this I mean terrains laid down only in the terrain generation portion of the script. Any terrain type can be used for elevation, but it must be placed in the Land Generation part of the script, as a 'create_land' or 'create_player_lands' command. Terrains laid down on top of these 'lands' can show elevation, but it is the underlying 'land' which is changed by the elevation generation part of the script. The if statement in the elevation is also messed up - you cannot use the 'else' in here as you have done - if else is used it must be the final choice.
*connection - missing an 'endif' and a bracket. Ideally you should also add terrain size as a condition, but I think there is a default size of 1 tile if none is specified.
I replied to you by email with an attached script with the above corrections made, but no terrain size added in connections. It works fine, though you will need to determine if you like your script as it is.
Let me know if you have further questions.
RF_Gandalf