Thomas_klei Posted July 23, 2018 Share Posted July 23, 2018 I've been trying to get this work for a while but I don't understand why It isn't working , every time I try and run my mod it comes up with the same problem. it says something about the (<eof>) this is the code I am using local function perdking_update( inst ) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then local x,y,z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, 15, {"berrythief"}) for k,v in pairs(ents) do if v.components.follower and not v.components.follower.leader and not owner.components.leader:IsFollower(v) and owner.components.leader.numfollowers < 10 then owner.components.leader:AddFollower(v) end end if owner and owner.components.leader then local x,y,z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, 15, {"berrythief"}) for k,v in pairs(ents) do if v.components.follower and not v.components.follower.leader and not owner.components.leader:IsFollower(v) and owner.components.leader.numfollowers < 10 then owner.components.leader:AddFollower(v) end end end end Link to comment https://forums.kleientertainment.com/forums/topic/93870-need-help-code-not-working/ Share on other sites More sharing options...
Lumina Posted July 23, 2018 Share Posted July 23, 2018 (edited) EoF means usually that you miss a "end" somewhere (it's short for "End of Function"). Maybe you need another "end" after this part local function perdking_update( inst ) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then local x,y,z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, 15, {"berrythief"}) for k,v in pairs(ents) do if v.components.follower and not v.components.follower.leader and not owner.components.leader:IsFollower(v) and owner.components.leader.numfollowers < 10 then owner.components.leader:AddFollower(v) end end If you don't do that already i suggest using a text editor that highlight the lua code, like notepad++. Sublime should work too since it's in the don't starve mod tool. It make the process of finding mistake a lot easier. Edited July 23, 2018 by Lumina Link to comment https://forums.kleientertainment.com/forums/topic/93870-need-help-code-not-working/#findComment-1067428 Share on other sites More sharing options...
Thomas_klei Posted July 23, 2018 Author Share Posted July 23, 2018 how do you find errors i'm using sublime but I don't know how to use that function sorry Link to comment https://forums.kleientertainment.com/forums/topic/93870-need-help-code-not-working/#findComment-1067486 Share on other sites More sharing options...
Lumina Posted July 23, 2018 Share Posted July 23, 2018 27 minutes ago, thomas4845 said: i'm using sublime but I don't know how to use that function sorry I don't use sublime so i don't know how to enable it. This is how it shows on notepad++ Here you can see the red line, showing where the function start ( local function perdking_update( inst ), line 1 ) and where it stop (end, line 23) Here you can see that you open a function (if owner and owner.components.leader then, line 4), that close only on line 23. But it's not possible since your main function too end in this line. It should probably close before, something like this : Here you can see that the function you open line 4 is closed line 12. Also, i'm not sure because i'm not good at spotting errors, but isn't the same code twice ? I don't see any difference between code for line 4 to 9 and 13 to 18. Link to comment https://forums.kleientertainment.com/forums/topic/93870-need-help-code-not-working/#findComment-1067494 Share on other sites More sharing options...
Thomas_klei Posted July 23, 2018 Author Share Posted July 23, 2018 ok I don't know how you did that right now but I will figure it out tomorrow because I don't know where you are but it's 1 am where I am Link to comment https://forums.kleientertainment.com/forums/topic/93870-need-help-code-not-working/#findComment-1067510 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