Page 1 of 1
getlocaliseditemname
Posted: Tue Nov 25, 2014 10:10 am
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
Re: getlocaliseditemname
Posted: Wed Nov 26, 2014 7:21 pm
by Rseding91
Code: Select all
game.player.print({"", "x ", game.getlocaliseditemname(event.itemstack.name)})
Re: getlocaliseditemname
Posted: Thu Nov 27, 2014 1:35 am
by L0771
Thank you very much

Re: getlocaliseditemname
Posted: Mon Dec 08, 2014 9:49 am
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.
Re: getlocaliseditemname
Posted: Mon Dec 08, 2014 7:52 pm
by L0771
I add this

Is a big problem for my mod, i want to post today but with this problem i can't do anything =(
Re: getlocaliseditemname
Posted: Tue Dec 09, 2014 8:08 am
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"}})
Re: getlocaliseditemname
Posted: Tue Dec 09, 2014 8:36 am
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 ""
Re: getlocaliseditemname
Posted: Tue Dec 09, 2014 11:53 am
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} })
Re: getlocaliseditemname
Posted: Tue Dec 09, 2014 2:20 pm
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
Re: getlocaliseditemname
Posted: Tue Dec 09, 2014 8:18 pm
by rk84
You really must be grinding in iron ore field to reach that high hemoglobin level haha.
Re: getlocaliseditemname
Posted: Tue Dec 09, 2014 8:28 pm
by L0771
jajaja
next update
