Page 1 of 1

expected to close at line 108 ?

Posted: Thu Nov 21, 2019 5:35 pm
by Jean_Jaques
hello, uhm
so, this is my first time at modding on factorio and in lua.
was i wanted was just a simple turret that close the gab betwen the big arty and the small turrets
i mostly tried to do it myself and with a bit of stitching of already in game used code.

i got some error which luckely i could fix but i have no idea how to fix that

Code: Select all

data:extend{
{
	type = "ammo-turret",
    name = "shockwave-cannon",
    icon = "__base__/graphics/icons/gun-turret.png",
    icon_size = 32,
    flags = {"placeable-player", "player-creation"},
    minable = {mining_time = 0.5, result = "assult-turret"},
    max_health = 800,
    corpse = "medium-remnants",
    collision_box = {{-0.7, -0.7 }, {0.7, 0.7}},
    selection_box = {{-1, -1 }, {1, 1}},
    rotation_speed = 0.055,
    preparing_speed = 0.38,
    folding_speed = 0,
    dying_explosion = "medium-explosion",
    inventory_size = 2,
    automated_ammo_count = 10,
    attacking_speed = 0.1,
    alert_when_attacking = true,
    open_sound = { filename = "", volume = 0.85 },
    close_sound = { filename = "", volume = 0.75 },
    folded_animation =
    {
      layers =
      {
      }
    },
    preparing_animation =
    {
      layers =
      {
        shockwave_cannon_sheet{},
      }
    },
    prepared_animation = 
	{
      layers =
      {
        shockwave_cannon_sheet{},
      }
    },
    attacking_animation =
	{
      layers =
      {
        shockwave_cannon_sheet{},
      }
    },
    folding_animation =
    {
      layers =
      {
      }
    },
    base_picture =
    {
      layers =
      {
        {
          filename = "",
          priority = "high",
          width = 90,
          height = 75,
          axially_symmetrical = false,
          direction_count = 1,
          frame_count = 1,
          shift = {0, -0.046875},
        },
        {
          filename = "",
          flags = { "mask" },
          line_length = 1,
          width = 100,
          height = 100,
          axially_symmetrical = false,
          direction_count = 1,
          frame_count = 1,
          shift = {0, -0.234375},
          apply_runtime_tint = true
        }
      }
    },
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
	{                                                                                                                                 line 108
		type = "projectile",
		ammo_category = "cannon-shell"
		cooldown = 100,                                                                                                     line 111
		projectile_creation_distance = 2.0,
		projectile_center = {0.0, 0.5},
		damage_modifier = 1.5,
		min_range = 30.0,
		range = 100,
		turn_range = 1,
		shell_particle =
		{
			name = "shell-particle",
			direction_deviation = 0.1,
			speed = 0.1,
			speed_deviation = 0.03,
			center = {0, 0},
			creation_distance = -1.925,
			starting_frame_speed = 0.2,
			starting_frame_speed_deviation = 0.1
		},
		sound = 
		{
			{
				filename = "",
				volume = 0.75
			}
		}
	},
	call_for_help_radius = 40
}}
i did ask a friend, who work with lua a long time, and even he have no clue whats the problem is.
of corse i tried to look up the error in google but no solution.

thank you in advance

Re: expected to close at line 108 ?

Posted: Thu Nov 21, 2019 6:41 pm
by Hiladdar
I looked at your code, and the first place I would look at lines 82-87, specifically the highlighted part:

...
}
},
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
{ line 108
type = "projectile",
ammo_category = "cannon-shell"
...

Hiladdar

Re: expected to close at line 108 ?

Posted: Thu Nov 21, 2019 7:24 pm
by eradicator
key=value pairs in tables must be seperated by a comma.

Re: expected to close at line 108 ?

Posted: Sat Nov 23, 2019 3:24 am
by PyroFire
line 110 missing a comma
ammo_category = "cannon-shell" ,
cooldown = 100,
Your "lua friend" musn't be very savvy :O

Re: expected to close at line 108 ?

Posted: Sat Nov 23, 2019 10:47 am
by Jean_Jaques
to be honest im abit embarrassed because of this. but it works now.
thanks

Re: expected to close at line 108 ?

Posted: Sat Nov 23, 2019 3:09 pm
by eradicator
Btw i specifically didn't mention where exactly the comma is missing because the error is so common and basic that not being able to spot it yourself means you're essentially unable to write any lua at all. And frankly your friend is either a liar or he didn't actually look at the code.