Page 2 of 2

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

Posted: Sat Mar 26, 2016 1:02 pm
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.

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

Posted: Sat Mar 26, 2016 1:16 pm
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.

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

Posted: Sun Mar 27, 2016 10:22 am
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)

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

Posted: Sun Mar 27, 2016 12:22 pm
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 :(

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

Posted: Sun Mar 27, 2016 12:31 pm
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

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

Posted: Sun Mar 27, 2016 1:53 pm
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.

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

Posted: Sun Mar 27, 2016 3:02 pm
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

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

Posted: Thu Mar 31, 2016 8:00 am
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)

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

Posted: Sun Apr 03, 2016 3:06 am
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.

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

Posted: Thu Apr 07, 2016 12:26 am
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.

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

Posted: Sat Apr 09, 2016 10:15 pm
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.

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

Posted: Mon Apr 11, 2016 2:13 pm
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.

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

Posted: Sat Apr 16, 2016 8:48 am
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.

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

Posted: Fri Sep 23, 2016 9:45 am
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

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

Posted: Fri Sep 23, 2016 11:57 am
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.