Please fix in file help

Place to get help with not working mods / modding interface.
Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Please fix in file help

Post by Airat9000 »

I am fix galactic trade mod

Code: Select all

script.makefile("GalacticTrade/TroubleItems.txt",s)
				game.get_player(1).print("There are "..#global.gt_items_without_cost.." base resoureces (items without recipies) without cost (listed above)")
				game.get_player(1).print("Go to your factorio directory, inside of the \"script-output\\GalacticTrade\\TroubleItems.txt\" file for more information.")
			end

Code: Select all

game.makefile("GalacticTrade/TroubleItems.txt",s)
				game.get_player(1).print("There are "..#global.gt_items_without_cost.." base resoureces (items without recipies) without cost (listed above)")
				game.get_player(1).print("Go to your factorio directory, inside of the \"script-output\\GalacticTrade\\TroubleItems.txt\" file for more information.")
			end
file
Attachments
2015-11-10_11-05-02.jpg
2015-11-10_11-05-02.jpg (19.09 KiB) Viewed 8956 times
control.lua
(59.7 KiB) Downloaded 243 times

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Please fix in file help

Post by daniel34 »

FactorioBot (Version 0.12.11) wrote:Changed LuaGameScript::makefile to LuaGameScript::write_file and added an optional third parameter bool to append.
They renamed the makefile function for 0.12.11, it is now called write_file.
quick links: log file | graphical issues | wiki

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

daniel34 wrote:
FactorioBot (Version 0.12.11) wrote:Changed LuaGameScript::makefile to LuaGameScript::write_file and added an optional third parameter bool to append.
They renamed the makefile function for 0.12.11, it is now called write_file.
thanks! fix it!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

daniel34 wrote:
FactorioBot (Version 0.12.11) wrote:Changed LuaGameScript::makefile to LuaGameScript::write_file and added an optional third parameter bool to append.
They renamed the makefile function for 0.12.11, it is now called write_file.
2 bug

Code: Select all

function create_loading_gui(player_index)
	p = game.get_player(player_index)
	p.gui.center.add{type="frame", name="item_value_loading_frame", caption = 'Loading Item Values for Galactic Trade...', style='frame_style', direction='vertical'}
	p.gui.center.item_value_loading_frame.add{name="item_value_loading_table", type="table", colspan=1}
	p.gui.center.item_value_loading_frame.item_value_loading_table.add{name="item_value_loading_progress", type="progressbar", size=global.gt_total_items_unfiltered, value = 0}
	p.gui.center.item_value_loading_frame.item_value_loading_table.add{name="item_value_loading_label", type="label", caption = "0/"..global.gt_total_items_unfiltered}
end

Code: Select all

		for s, item in pairs(game.item_prototypes) do
		if event.element.name == item.name.."_selection_button" then

			item_index = get_opened_buyingchest_index(event.player_index)

			global.buyingtradingchests.item_selected[item_index] = item.name
			if item.name ~= "blank" then
				p.gui.left.tradingchest_buy.item_view_table.item_label.caption = script.get_localised_item_name(item.name)
			else
				p.gui.left.tradingchest_buy.item_view_table.item_label.caption = "blank"
			end
			p.gui.left.tradingchest_buy.item_view_table.current_item_button.style = item.name.."_gt_button_style"
			tmp_values = {}
			p.gui.left.tradingchest_buy.item_view_table.current_ppu_table.item_ppu_label.caption=comma_value(gt_get_item_value(item.name,1))
			if not(global.gt_auto_update_info) then
				gt_update_opened_buying_chest_info(event.player_index)
			end
			break
Attachments
trading-chest.lua
(18.43 KiB) Downloaded 256 times
2015-11-10_14-54-00.jpg
2015-11-10_14-54-00.jpg (18.55 KiB) Viewed 8917 times
2015-11-10_13-23-03.jpg
2015-11-10_13-23-03.jpg (33.14 KiB) Viewed 8927 times

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

daniel34 wrote:
FactorioBot (Version 0.12.11) wrote:Changed LuaGameScript::makefile to LuaGameScript::write_file and added an optional third parameter bool to append.
They renamed the makefile function for 0.12.11, it is now called write_file.
2 files fix



new problem
Attachments
GalacticTrade_0.6.5.rar
(151.43 KiB) Downloaded 487 times
2015-11-12_15-02-48.jpg
2015-11-12_15-02-48.jpg (22.62 KiB) Viewed 8894 times

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

That function doesn't exist anymore, items and entities nowadays have a localised_name property.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:That function doesn't exist anymore, items and entities nowadays have a localised_name property.
and what and how do I change it?

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

game.get_localised_item_name(item.name) -> item.localised_name
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:game.get_localised_item_name(item.name) -> item.localised_name
not work!!

Code: Select all

	item_index = get_opened_buyingchest_index(event.player_index)

			global.buyingtradingchests.item_selected[item_index] = item.name
			if item.name ~= "blank" then
				p.gui.left.tradingchest_buy.item_view_table.item_label.caption = item.get_localised_item_name(item.name)
			else
				p.gui.left.tradingchest_buy.item_view_table.item_label.caption = "blank"
			end
			p.gui.left.tradingchest_buy.item_view_table.current_item_button.style = item.name.."_gt_button_style"
			tmp_values = {}
			p.gui.left.tradingchest_buy.item_view_table.current_ppu_table.item_ppu_label.caption=comma_value(gt_get_item_value(item.name,1))
			if not(global.gt_auto_update_info) then
				gt_update_opened_buying_chest_info(event.player_index)
			end
			break

Code: Select all

	global.buyingtradingchests.item_selected[item_index] = item.name
			if item.name ~= "blank" then
				p.gui.left.tradingchest_buy.item_view_table.item_label.caption = item.localised_name(item.name)
			else
				p.gui.left.tradingchest_buy.item_view_table.item_label.caption = "blank"
			end
			p.gui.left.tradingchest_buy.item_view_table.current_item_button.style = item.name.."_gt_button_style"
			tmp_values = {}
			p.gui.left.tradingchest_buy.item_view_table.current_ppu_table.item_ppu_label.caption=comma_value(gt_get_item_value(item.name,1))
			if not(global.gt_auto_update_info) then
				gt_update_opened_buying_chest_info(event.player_index)
			end
			break
Attachments
2015-11-13_3-43-44.jpg
2015-11-13_3-43-44.jpg (17.6 KiB) Viewed 8846 times
2015-11-13_3-42-34.jpg
2015-11-13_3-42-34.jpg (26.13 KiB) Viewed 8846 times

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:game.get_localised_item_name(item.name) -> item.localised_name
work

new bug((

Code: Select all

p.gui.left.tradingchest_buy.item_view_table.add{type="checkbox",name="buyingchest_enabled_checkbox",state=global.buyingtradingchests.enabled[item_index], caption="Enabled"}
					if global.buyingtradingchests.item_selected[item_index] ~= "blank" then
						p.gui.left.tradingchest_buy.item_view_table.add{type="label",name="item_label",caption=script.get_localised_item_name(global.buyingtradingchests.item_selected[item_index])}
					else
						p.gui.left.tradingchest_buy.item_view_table.add{type="label",name="item_label",caption="blank"}
					end
Attachments
2015-11-13_3-49-46.jpg
2015-11-13_3-49-46.jpg (21.13 KiB) Viewed 8845 times

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

Well you're still trying to call get_localised_item_name, this time in script, where it never existed in the first place. You need to get the localised name out of the item prototype.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:Well you're still trying to call get_localised_item_name, this time in script, where it never existed in the first place. You need to get the localised name out of the item prototype.
;) please code

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

Well let's see... global.buyingtradingchests.item_selected[item_index] seems to contain the non-localised item name. We can use that to get at the prototype in game.item_prototypes which then contains the localised name. Try game.item_prototypes[global.buyingtradingchests.item_selected[item_index]].localised_name instead of the script.get_localised_item_name() thing.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:Well let's see... global.buyingtradingchests.item_selected[item_index] seems to contain the non-localised item name. We can use that to get at the prototype in game.item_prototypes which then contains the localised name. Try game.item_prototypes[global.buyingtradingchests.item_selected[item_index]].localised_name instead of the script.get_localised_item_name() thing.
ou thanks!!! worked all
release new version mod! big thanks!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:Well let's see... global.buyingtradingchests.item_selected[item_index] seems to contain the non-localised item name. We can use that to get at the prototype in game.item_prototypes which then contains the localised name. Try game.item_prototypes[global.buyingtradingchests.item_selected[item_index]].localised_name instead of the script.get_localised_item_name() thing.
new bug )))
]

Code: Select all

global.buyingtradingchests.chest[chest_index].get_inventory(1).insert({name = name, count = amount})
				if name ~= global.buyingtradingchests.item_selected[chest_index] then
					slots_available = slots_available - math.ceil(amount/script.item_prototypes[global.buyingtradingchests.item_selected[chest_index]].stack_size)
				end
			end
Attachments
2015-11-13_5-21-52.jpg
2015-11-13_5-21-52.jpg (23.67 KiB) Viewed 7198 times

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

What the message says... script doesn't contain item_prototypes. But game does. We've already used that earlier.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:What the message says... script doesn't contain item_prototypes. But game does. We've already used that earlier.

Code: Select all

	if slots_available>0 then  
						max_buy_amount = (slots_available * game.item_prototypes[global.buyingtradingchests.item_selected[item_selected]].stack_size) - item_count
						if item_difference > max_buy_amount then
							item_difference = max_buy_amount
						end
					else
						slots_available = 0
					end

Code: Select all

	if slots_available>0 then
						max_buy_amount = (slots_available * script.item_prototypes[global.buyingtradingchests.item_selected[i]].stack_size) - item_count
						if item_difference > max_buy_amount then
							item_difference = max_buy_amount
						end
					else
						slots_available = 0
					end
Attachments
2015-11-13_9-05-18.jpg
2015-11-13_9-05-18.jpg (26.37 KiB) Viewed 7183 times

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

You not only changed script back to game, but also replaced the index i with item_selected? That doesn't seem like a valid index for itself.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: Please fix in file help

Post by Airat9000 »

prg wrote:You not only changed script back to game, but also replaced the index i with item_selected? That doesn't seem like a valid index for itself.
not understant what problem

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Please fix in file help

Post by prg »

The original code was

Code: Select all

max_buy_amount = (slots_available * script.item_prototypes[global.buyingtradingchests.item_selected[i]].stack_size) - item_count
You replaced that with

Code: Select all

max_buy_amount = (slots_available * game.item_prototypes[global.buyingtradingchests.item_selected[item_selected]].stack_size) - item_count
right? There are two changes, only one of which seems to make sense to me.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Post Reply

Return to “Modding help”