[mod 0.12.30] {BB} - Belt Brush

Topics and discussion about specific mods
matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by matjojo »

Jierdan wrote:So, got this from testing just version 0.0.3 in SP: Error while running the event handler: __BeltBrush__/control.lua:156: attempt to index global 'BB_glob_amount' (a nil value)
Also, the folder path wasn't correct(Zip needs the files inside a BeltBrush_0.0.3 folder).

Thanks for the report, here I was thinking I tested everything. Lemme just edit that.

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by matjojo »

Just uploaded BeltBrush to 0.0.4:

Version 0.0.4 (2016-03-26): Fixed a game-breaking bug.

I should have tested .3 better, sorry. Also, after a little push from some people here on the forum, I finally set up Git and uploaded the mod to Github: You can check it out here.

Darloth
Fast Inserter
Fast Inserter
Posts: 117
Joined: Sun Jun 08, 2014 3:57 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by Darloth »

In 0.0.4, I'm now sometimes getting the same "attempt to index global 'BB_glob_amount' ( a nil value)" errors but on line 103 of control.lua. Line 103 seems to just be when clicking on the checkboxes.

Weirdly, it worked fine for a while. This is about the third load of that game before it happened.

Maybe you're correctly setting it on first run, but not on subsequent game loads? (I might not have placed any belts during the second session).

Edit: I'm going to try shoving the BB_glob_amount into script.on_load - it might reset the glob size every time the game is loaded, but if it works I won't care :) (Alas, it resets it on every autosave as well)

Edit2: For that matter, in a multiplayer context, on line 156ish, won't setting BB_glob_amount = {} once for any player in the game that doesn't have the glob toolbar setup also silently break all other players?

Edit3: Okay, after some reading of the modding documentation I believe you're meant to store this sort of thing in the global data object, so that it gets saved and loaded with the mod. Then you just need a migration from version 0 (no mod installed) to any other version that initializes the global object with a BB_glob_amount, and then the ontick handler that adds players interface bar widgets can also set the BB_glob_amount[playerIndex] to 0? Trying that now...

Edit4: This is approaching the limit of effort I'll put in to get something to work, I'm just gonna uninstall this mod (useful as it is) if this doesn't work. Plus, I mostly just wanted an up to date easybelt anyway...

Here, this seems to work for me. If I had git installed on this computer / I could be bothered, I'd submit a pull request. As it is, you can paste it in yourself :)

First you'll need to find-and-replace all instances of BB_glob_amount with global.BB_glob_amount

Then paste this in wherever you feel appropriate. Then just increment the version number to higher than 0.0.4... hmm, speaking of, if you're being considerate you might also want to consider migrations for people who aren't on 0.0.4, though I feel they'll probably be the most affected.

Code: Select all

script.on_configuration_changed(function(data)
	
	if data.mod_changes ~= nil 
		and data.mod_changes["BeltBrush"] ~= nil 
		and (data.mod_changes["BeltBrush"].old_version == nil or data.mod_changes["BeltBrush"].old_version == "0.0.4")
		then
			global.BB_glob_amount = {}
			for i in ipairs(game.players) do
				global.BB_glob_amount[i] = 0
			end
    end
	
end)

script.on_init(function()
	if not global.BB_glob_amount then
		global.BB_glob_amount = {}
	end
end)

Geisel
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 24, 2016 5:41 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by Geisel »

Happy Easter!

i created a QuickFix as github Pull Requset :)
https://github.com/matjojo/BeltBrush/pulls

not even Clean Code, but works to begin with ;)

best reagrds

"It's stupid and it works, its not stupid!" Arumba

EDIT: Darloth i understand you so much :D this gobal handling isn't cool at all, is see confilcts ahead :(
Last edited by Geisel on Sun Mar 27, 2016 12:33 pm, edited 1 time in total.

Geisel
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 24, 2016 5:41 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by Geisel »

Hmm when you have 50 belts in your "hand" and place a "4Liner" (50 % 4 !==0) leads to a line with just 3 belts at the end ... that could be annoying :?

May be the available amount of belts should be calculated including the inventory to prevent this ? ;) just as idea

best regards

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by matjojo »

Geisel wrote:Hmm when you have 50 belts in your "hand" and place a "4Liner" (50 % 4 !==0) leads to a line with just 3 belts at the end ... that could be annoying :?

May be the available amount of belts should be calculated including the inventory to prevent this ? ;) just as idea

best regards

I don't really get what you mean with this, I never use that, when placing the other 3 belts of a 4liner, I have a for loop that is three long that every run checks if the stack in hand is larger then 0, so there would be no using % as that would indeed not always work.

Geisel
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 24, 2016 5:41 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by Geisel »

ah sry, yes let me try to explain.

What "%" meas https://en.wikipedia.org/wiki/Euclidean_division
so 50 divided by 4 is 48, and 2 left

When you have 7 Belts in you hand and place two 4liners rows the second one has just 3 belts.

e.g
Belt : <=>

<=>
<=><=>
<=><=>
<=><=>

best regards

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by matjojo »

Geisel wrote:ah sry, yes let me try to explain.

What "%" meas https://en.wikipedia.org/wiki/Euclidean_division
so 50 divided by 4 is 48, and 2 left

When you have 7 Belts in you hand and place two 4liners rows the second one has just 3 belts.

e.g
Belt : <=>

<=>
<=><=>
<=><=>
<=><=>

best regards
Yes, that SHOULD happen, add up all the belts you have placed, it's 7, if you have 7 belts in your hand, you should only be able to place 7 belts.


BUT, ways to take belts from the main inventory is in the works. (if you do have belts in the main inventory)

EnderTheXenocide
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 02, 2016 6:23 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by EnderTheXenocide »

Sorry if this has already been expressed. I also get the error (glob nil value whatever) causing game crash. For me, both times it was when I placed a belt at the output arrow of a chemical plant. Disabled the mod for now, but will watch this thread.

Griffon0129
Inserter
Inserter
Posts: 33
Joined: Mon Mar 07, 2016 5:54 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by Griffon0129 »

I like the idea of this mod, but v0.0.1 is the only version that worked for me without any "nil" errors and without the ability to upgrade previously placed belts it's not that useful since I have to upgrade them 1 row at a time still. Keep working on it though and hope you get it working correctly.

Shadkillz
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Apr 09, 2016 4:49 am
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by Shadkillz »

Hi, so i just downloaded this mode and went to a new world, it worked perfect, but then after an hour or so of playing where i haven't placed transport belt in a while it gives me this error:
http://prntscr.com/aq9v4h

it's only in that one map and im not sure why


UPDATE:

so i tried to join another map where it worked, i then saved the map so it had the mod saved in it aswell, and now i get the same error in that map

im getting a different error if i try to change how many belts i would like to place, that error occurs in control.lua string 103, but i can't seem to find the problem.

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.29] {BB} - Belt Brush

Post by matjojo »

Shadkillz wrote:Hi, so i just downloaded this mode and went to a new world, it worked perfect, but then after an hour or so of playing where i haven't placed transport belt in a while it gives me this error:
http://prntscr.com/aq9v4h

it's only in that one map and im not sure why


UPDATE:

so i tried to join another map where it worked, i then saved the map so it had the mod saved in it aswell, and now i get the same error in that map

im getting a different error if i try to change how many belts i would like to place, that error occurs in control.lua string 103, but i can't seem to find the problem.
BeltBrush is currently not working well, I have had a busy time last weeks and was not able to work on it. But I am working on it again, and should not have such busy days in the near future.

EDIT: version 0.0.5 fixes this problem.
Last edited by matjojo on Sat Apr 16, 2016 8:49 am, edited 1 time in total.

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.30] {BB} - Belt Brush

Post by matjojo »

Just uploaded version 0.0.5, now with a lot more testing and a lot less bugs.

Version 0.0.5 (2016-04-16): Fixed a LOT of bugs. Belt Brush now features migration script's for all versions, updating should not cause problems.

Download in Original Post.

FumblerX
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Mar 06, 2015 12:44 am
Contact:

Re: [mod 0.12.30] {BB} - Belt Brush

Post by FumblerX »

I wish you could see where the all the belt where going to place before placing like a ghost. like or an arrow on the icon of the belt you are holding

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: [mod 0.12.30] {BB} - Belt Brush

Post by matjojo »

FumblerX wrote:I wish you could see where the all the belt where going to place before placing like a ghost. like or an arrow on the icon of the belt you are holding

I'm currently working on adding hotkeys, as that would increase the flow of the game a lot, the arrow seems not all too useful as the direction is always the same, so it'll be a bit of training, but after that you should remember. I'll think about it.

Post Reply

Return to “Mods”