Page 1 of 2
Please fix in file help
Posted: Tue Nov 10, 2015 8:07 am
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
Re: Please fix in file help
Posted: Tue Nov 10, 2015 8:34 am
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.
Re: Please fix in file help
Posted: Tue Nov 10, 2015 9:00 am
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!
Re: Please fix in file help
Posted: Tue Nov 10, 2015 10:24 am
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
Re: Please fix in file help
Posted: Thu Nov 12, 2015 12:05 pm
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
Re: Please fix in file help
Posted: Thu Nov 12, 2015 2:25 pm
by prg
That function doesn't exist anymore, items and entities nowadays have a localised_name property.
Re: Please fix in file help
Posted: Thu Nov 12, 2015 10:56 pm
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?
Re: Please fix in file help
Posted: Thu Nov 12, 2015 11:37 pm
by prg
game.get_localised_item_name(item.name) -> item.localised_name
Re: Please fix in file help
Posted: Fri Nov 13, 2015 12:44 am
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
Re: Please fix in file help
Posted: Fri Nov 13, 2015 12:50 am
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
Re: Please fix in file help
Posted: Fri Nov 13, 2015 12:56 am
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.
Re: Please fix in file help
Posted: Fri Nov 13, 2015 1:11 am
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
Re: Please fix in file help
Posted: Fri Nov 13, 2015 1:31 am
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.
Re: Please fix in file help
Posted: Fri Nov 13, 2015 1:49 am
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!
Re: Please fix in file help
Posted: Fri Nov 13, 2015 2:23 am
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
Re: Please fix in file help
Posted: Fri Nov 13, 2015 2:31 am
by prg
What the message says... script doesn't contain item_prototypes. But game does. We've already used that earlier.
Re: Please fix in file help
Posted: Fri Nov 13, 2015 6:05 am
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
Re: Please fix in file help
Posted: Fri Nov 13, 2015 11:42 am
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.
Re: Please fix in file help
Posted: Fri Nov 13, 2015 11:54 am
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
Re: Please fix in file help
Posted: Fri Nov 13, 2015 12:04 pm
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.