getlocaliseditemname

Place to get help with not working mods / modding interface.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

getlocaliseditemname

Post by L0771 »

Hi, i have a problem with getlocaliseditemname.

This works

Code: Select all

game.player.print(game.getlocaliseditemname(event.itemstack.name)) --> return "Iron Plate" / type "table"
game.player.print(game.getlocaliseditemname(event.itemstack.name)[1]) --> return "item-name.iron-plate"  / type "string"

game.player.print("x " .. game.getlocaliseditemname(event.itemstack.name)[1]) --> return "x item-name.iron-plate"
Table game.getlocaliseditemname(event.itemstack.name) only have { "item-name.iron-plate" } -_-

This not works

Code: Select all

game.player.print("x " .. game.getlocaliseditemname(event.itemstack.name)) --> attemp to concatenate a table value
I want "x Iron Plate" is it possible?

Thanks for help
Rseding91
Factorio Staff
Factorio Staff
Posts: 14318
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: getlocaliseditemname

Post by Rseding91 »

Code: Select all

game.player.print({"", "x ", game.getlocaliseditemname(event.itemstack.name)})
If you want to get ahold of me I'm almost always on Discord.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: getlocaliseditemname

Post by L0771 »

Thank you very much :)
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: getlocaliseditemname

Post by L0771 »

I have a problem again, with this prints.

Code: Select all

player.print({"",{"msg-cursed"},": ",{"msg-mindonation"}})
player.print({"","x"})
returns nothing, without error, before update all my prints (30) was working, now i can hear the sound but without the print.

And i don't see anything in changelog of the game about this.

Thanks for help.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: getlocaliseditemname

Post by L0771 »

I add this
Image
Is a big problem for my mod, i want to post today but with this problem i can't do anything =(
Rseding91
Factorio Staff
Factorio Staff
Posts: 14318
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: getlocaliseditemname

Post by Rseding91 »

L0771 wrote:I have a problem again, with this prints.

Code: Select all

player.print({"",{"msg-cursed"},": ",{"msg-mindonation"}})
player.print({"","x"})
returns nothing, without error, before update all my prints (30) was working, now i can hear the sound but without the print.

And i don't see anything in changelog of the game about this.

Thanks for help.

It should be:

Code: Select all

player.print({{"msg-cursed"}, "", ": ", {"msg-mindonation"}})
If you want to get ahold of me I'm almost always on Discord.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: getlocaliseditemname

Post by L0771 »

bad argument #-1 to 'print' (string expected, got table)

The problem is that it takes only the first string, with player.print({"",{"msg-cursed"}}) this returns print only ""
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: getlocaliseditemname

Post by rk84 »

I guess concat does not work in latest release?

Anyway, I will post another way you could do localization.
locale.cfg:

Code: Select all

[msg]
template=Cursed: __1__
mindonation=Need __1__ health for make a blood donation.
Test:

Code: Select all

/c game.player.print({"msg.template", {"msg.mindonation", 50} })
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: getlocaliseditemname

Post by L0771 »

Test:

Code: Select all

/c game.player.print({"msg.template", {"msg.mindonation", game.getlocaliseditemname("iron-plate")} })
Cursed: Need Iron Plate health for make a blood donation.
:)
It works, now i start changing all texts (print & gui)

Thanks you very much
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: getlocaliseditemname

Post by rk84 »

You really must be grinding in iron ore field to reach that high hemoglobin level haha.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: getlocaliseditemname

Post by L0771 »

jajaja
+
next update :lol:
Post Reply

Return to “Modding help”