Page 1 of 9

[MOD 0.12.X] Galactic Trade

Posted: Sat Jul 18, 2015 2:15 am
by coopmaster
Type: Mod
Name: Galactic Trade
Description: Adds the ability to buy and sell items.
License: MIT
Version: 0.6.5
Release: 2015-07-17
Tested-With-Factorio-Version: 0.12.9
Category: Gameplay Enhancement
Tags: Trading, Market
Download-Url: https://forums.factorio.com/forum/dow ... ew&id=6083
Website: archive of older versions (because I don't have a website yet)
Important
License
Long description
Version history
media
Adding Support for Other Mods
Planned Features
Archive
Source

Re: [0.12]Galactic Trade

Posted: Sat Jul 18, 2015 3:48 am
by Devildog
Nice! You got it updated already.

Re: [0.12]Galactic Trade

Posted: Sat Jul 18, 2015 7:39 am
by coopmaster
Devildog wrote:Nice! You got it updated already.
Yes, most of what they changed with the api was just making functions more readable so it didn't take too long.

Re: [0.12]Galactic Trade

Posted: Sat Jul 18, 2015 8:26 am
by Koub
Hi coopmaster, can you please update your first post with the template provided here ?

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 12:41 am
by Airat9000
coopmaster wrote:
Devildog wrote:Nice! You got it updated already.
Yes, most of what they changed with the api was just making functions more readable so it didn't take too long.
list the mods you mod work?
Image

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 4:42 am
by coopmaster
Airat9000 wrote: list the mods you mod work?
Image
Sorry, I don't understand, what are you asking? Can you ask it in your native language, it seems like there is a translation error.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 7:19 am
by StanFear
hey,
have you though about using networks to know what to buy ? like - buy as much as there is on red cable

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 3:42 pm
by Shanix
Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 4:16 pm
by coopmaster
Shanix wrote:Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.
Do you have any other mods enabled? it sounds like an item doesn't have the correct localized variable name that is standard. I will try to make it to where it doesn't give an error in the next update.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 4:19 pm
by coopmaster
StanFear wrote:hey,
have you though about using networks to know what to buy ? like - buy as much as there is on red cable
I'll look into it, I thought about integrating with networks but I want to some other things first.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 4:36 pm
by Shanix
coopmaster wrote:
Shanix wrote:Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.
Do you have any other mods enabled? it sounds like an item doesn't have the correct localized variable name that is standard. I will try to make it to where it doesn't give an error in the next update.
I checked and gave names to two items, but it didn't fix them. So I removed the mods that had items that I couldn't add to the galactic network, and I still get the error. Guess I'm waiting for the next update.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 11:25 pm
by coopmaster
Shanix wrote:
coopmaster wrote:
Shanix wrote:Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.
Do you have any other mods enabled? it sounds like an item doesn't have the correct localized variable name that is standard. I will try to make it to where it doesn't give an error in the next update.
I checked and gave names to two items, but it didn't fix them. So I removed the mods that had items that I couldn't add to the galactic network, and I still get the error. Guess I'm waiting for the next update.
did you happen to edit the localization files of anything? It shouldn't have any errors like that if it's just my mod and vanilla.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 11:41 pm
by coopmaster
coopmaster wrote:
Shanix wrote:
coopmaster wrote:
Shanix wrote:Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.
Do you have any other mods enabled? it sounds like an item doesn't have the correct localized variable name that is standard. I will try to make it to where it doesn't give an error in the next update.
I checked and gave names to two items, but it didn't fix them. So I removed the mods that had items that I couldn't add to the galactic network, and I still get the error. Guess I'm waiting for the next update.
did you happen to edit the localization files of anything? It shouldn't have any errors like that if it's just my mod and vanilla.
So after some testing I think that the only way these errors can happen is if the code was edited, I suggest doing a fresh install of my mod to make sure everything is correct. The first error is because my mod doesn't have that chest stored (which happens when one is placed), the second one only happens if somehow the item selection frame gets removed before the other (which will be fixed in the next update). Let me know if problems still persist after a fresh install.

Re: [0.12]Galactic Trade

Posted: Wed Jul 22, 2015 11:52 pm
by coopmaster
coopmaster wrote:
coopmaster wrote:
Shanix wrote:
coopmaster wrote:
Shanix wrote:Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.
Do you have any other mods enabled? it sounds like an item doesn't have the correct localized variable name that is standard. I will try to make it to where it doesn't give an error in the next update.
I checked and gave names to two items, but it didn't fix them. So I removed the mods that had items that I couldn't add to the galactic network, and I still get the error. Guess I'm waiting for the next update.
did you happen to edit the localization files of anything? It shouldn't have any errors like that if it's just my mod and vanilla.
So after some testing I think that the only way these errors can happen is if the code was edited, I suggest doing a fresh install of my mod to make sure everything is correct. The first error is because my mod doesn't have that chest stored (which happens when one is placed), the second one only happens if somehow the item selection frame gets removed before the other (which will be fixed in the next update). Let me know if problems still persist after a fresh install.
Now that I think of it, there is one other way that this error could happen. If the trading chest was placed without my mod detecting it or the chest was moved after being placed without being picked up by mining it. If you tried to place it with a command or have a mod that somehow moves the chest, that might cause this error. Let me know if either of these are the case.

Re: [0.12]Galactic Trade

Posted: Thu Jul 23, 2015 12:05 am
by Shanix
coopmaster wrote:
coopmaster wrote:
Shanix wrote:
coopmaster wrote:
Shanix wrote:Anyone else having an error when opening the Buy Chest? I get an error that game.get_localised_item_name(gt_glob.buyingtradingchests_itemselected[item_index]) is a nil value when opening, and when closing I get an error saying game.player.gui.left.item_selection.destroy() is a nil value as well. Lines 394 and 529 respectively in control.lua.
Do you have any other mods enabled? it sounds like an item doesn't have the correct localized variable name that is standard. I will try to make it to where it doesn't give an error in the next update.
I checked and gave names to two items, but it didn't fix them. So I removed the mods that had items that I couldn't add to the galactic network, and I still get the error. Guess I'm waiting for the next update.
did you happen to edit the localization files of anything? It shouldn't have any errors like that if it's just my mod and vanilla.
So after some testing I think that the only way these errors can happen is if the code was edited, I suggest doing a fresh install of my mod to make sure everything is correct. The first error is because my mod doesn't have that chest stored (which happens when one is placed), the second one only happens if somehow the item selection frame gets removed before the other (which will be fixed in the next update). Let me know if problems still persist after a fresh install.
Well, I play a medium sized number of mods, so no it's not just your mod and vanilla. I had to edit the localization files for 5dim's Automization and Resource mod's localisations. With a fresh install of Galactic Trade, here's an overview of the errors I get.

I'm almost positive the error is in 5dim's localisations.

EDIT: In Sandbox, the trade ships come...

EDIT 2: Using the buy chest will disable ships and sell chest updating.
coopmaster wrote:Now that I think of it, there is one other way that this error could happen. If the trading chest was placed without my mod detecting it or the chest was moved after being placed without being picked up by mining it. If you tried to place it with a command or have a mod that somehow moves the chest, that might cause this error. Let me know if either of these are the case.
Nope, I didn't even know you could move chests without mining them. I'm not sure if I can tell you if your mod does or doesn't detect the chest when placed, sorry.

Re: [0.12]Galactic Trade

Posted: Thu Jul 23, 2015 3:38 pm
by coopmaster
So the problem is that you need to follow the steps on the thread about making other mods compatible with my mod,
1. go to galactic trade mod folder
2. copy styles.lua
3. go to mod you want to add support with (if it has extra items)
4. paste the styles.lua file
5. edit data.lua with a text editor
6. add

Code: Select all

require("styles")
to the end of the file
7. if it has any raw resources (resources that don't have crafting recipes, but are available) go back to galactic trade mod folder (otherwise you are done!)
8. make sure the mod isn't already supported (look below)
8. edit the config.lua file with a text editor
9. look for the line "--add raw resource values here (items which don't have crafting recipes) with their values, see examples below"
10. look at examples and make sure you know what the item name is inside the mod's files, it would look something like "iron-plate"
(there are also some mods which already have support, all you need to do is remove the --[[ and --]] that surrounds the mod you want support for)
11. put the new line in and if it is smelted then also look slightly lower down (it also has instructions)
12. if you have done all of those steps then the items from the mod should show up in the buying trading chest with the correct credit values
13. if you want to help others not do steps 7-12, post to the forum thread and tell me the mod it was, and the lines you added to the files.

Re: [0.12]Galactic Trade

Posted: Thu Jul 23, 2015 4:09 pm
by Shanix
Alright, I guess only doing it for some wasn't good enough, I'll try it for all my mods and see what happens.

EDIT: Yep, I'm just dumb and didn't set everything to be compatible. What a twist.

Re: [0.12]Galactic Trade

Posted: Fri Jul 24, 2015 7:23 am
by darkshadow1809
FreekillX1Alpha wrote:
Found a bug with the Galatic Trade mod, when opening a buying chest i get the error:
Error while running the event handler: __GalacticTrade__/prototypes/scripts/trading-chest.lua:397: Unknown style gas-canister_gt_button_style

The game then crashes to the main menu.

Using mod pack 0-0-1 for 0.12 (single player version).

Factorio Build 103; Windows 64 bit

update: upon further inspection i find that there is another window that opens behind the main window; cannot copy the text so ill try and write it out manually:
Error when running the event handler: __GalacticTrade__/control.lua.394: bad argument #-1 to get_localised_tem_name' string expected, got nil

Update 2: been trying to fix this myself, haven't yet but i have managed to change the error. If you set dytech to enabled in the galactic trade config file, you get the error from my previous update (still in the back ground) and my original error is placed by: Error while running the event handler: __GalacticTrade__/control.lua:529: attempt to index field 'item_selection' (a nil value)
===============================================================================================================================================================

Hi there :) Someone reported this to me when hes using my modpack :) Could you look into it? Thanks!

Now i read in a bit about the mod compatibility fix.. But I don't think thats related to this o.o

If I am stupid and you already fixed it please tell me so xD haha. Sorry I've been crazy busy getting things ready for 0.12

Link to modpack: https://forums.factorio.com/forum/vie ... 60&t=13591 DL for all mods that are in there that may cause an issue with your mod :p Sorry I haven't done the credits section yet since I am still hourly removing/adding mods to make it work together.

Re: [0.12]Galactic Trade

Posted: Fri Jul 24, 2015 9:49 am
by ssilk
Moved thread to convenience, I think this is not just a new item. :)

Re: [0.12]Galactic Trade

Posted: Fri Jul 24, 2015 4:19 pm
by Shanix
darkshadow1809 wrote:Hi there :) Someone reported this to me when hes using my modpack :) Could you look into it? Thanks!

Now i read in a bit about the mod compatibility fix.. But I don't think thats related to this o.o

If I am stupid and you already fixed it please tell me so xD haha. Sorry I've been crazy busy getting things ready for 0.12

Link to modpack: https://forums.factorio.com/forum/vie ... 60&t=13591 DL for all mods that are in there that may cause an issue with your mod :p Sorry I haven't done the credits section yet since I am still hourly removing/adding mods to make it work together.
Oh actually I literally just had this error. You have to enable compatibility for all mods in your modpack, and it will sort of work. I did that and now the only error is every time I load my save, I lose all credits and have to place all of my chests again.