Jump to content

Recommended Posts

I know that there's a bracketing issue with one of my mod files. The problem is, I've checked all the parentheses and brackets and all of them appear to be paired.

another file with an issue involves the eater component, but even if I untag the entire eater component I still get the error.

 

flameguinbrain.lua bracket issue

gilbo.lua eater component issue

Vector3(self.inst.Transform:GetWorldPosition())))

This line is, unsuprisingly, the culprit. Here's the (hopefully correctly) corrected code portion:

Spoiler

WhileNode(
    function()
        return self.inst.components.teamattacker.teamleader == nil
    end,
    "No Leader Wander Action",
    Wander(self.inst,
        self.inst.components.knownlocations:GetLocation("myegg")
        or self.inst.components.knownlocations:GetLocation("herd")
        or self.inst.Traansform:GetWorldPosition(),
        Vector3(self.inst.Transform:GetWorldPosition()),
        GetWanderDistFn,
    )
)

Here's some style tips I came up with to avoid this kind of scenario:

Spoiler
  • Python taught me to use increase indent for every loop, function or open paranthese that takes up more than one line. This makes it easy to spot missing or misplaced "end"s in Lua too.
  • Always write "and" and "or" at the beginning of the next line, not at the end of the previous one. This makes it immediate whether or not the next line is linked to the previous one.
  • Fill long blocks like this one with comments to make them easier to grasp after working on a different portion of code. The larger your project gets, the faster you'll lose your own footsteps. At some point you'll feel like past-you is giving you advice.

Also, the end of the root node might have ) and } switched. Just as a forewarning.

On a side note, Notepad++ has a special syntax reader that allows you to check parenthesis by clicking on them. There's also a block-grouper next to the line numbers, letting you hide code chunks.

 

11 hours ago, Mobbstar said:

On a side note, Notepad++ has a special syntax reader that allows you to check parenthesis by clicking on them. There's also a block-grouper next to the line numbers, letting you hide code chunks.

 

I checked that with notepad and couldn't find anything which is why I posted here. Thanks for helping me find it :)

On 2/27/2016 at 11:19 PM, Mobbstar said:

If this is a DS mod (not DST), then you need to assign the foodprefs and oneatfn directly, as there are no access functions.

I have no idea what the absorbtion bit is about, but there's no such function either.

oops, I think I meant to post this in the dst mod section, these are for DST.

the only thing I really did to either of these files were delete, deactivate (tag), or rename stuff, so if the absorbtion thing isn't supposed to be there I have no clue. Is there a way I can just get rid of or tag the code that isn't working to stop the error?

On 2/26/2016 at 10:09 AM, Mobbstar said:

On a side note, Notepad++ has a special syntax reader that allows you to check parenthesis by clicking on them. There's also a block-grouper next to the line numbers, letting you hide code chunks.

Sublime also has this, along with most coding environments.

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...