Jump to content

STRINGS problem.


Recommended Posts

Hey everyone! I'm making the shop mod, that'll support translations. For this I have to use STRINGS. I've used this in my strings.lua:

STRINGS.MODS.HUM_SHOP.ANNOUNCE_PURCHASETEXT = {
"Thanks, pal.",
"Thanks for your money, pal!",
"You're such a generous! Thanks!",
}

and this in my prefab:

inst.components.talker:Say(GetString(inst, "ANNOUNCE_PURCHASETEXT"))

But it's crushing with:

[00:06:31]: [string "../mods/foxy's mod 0.2/scripts/strings.lua"]:142: attempt to index field 'HUM_SHOP' (a nil value)

So I realy don't know what to do, and I need some help. Thanks everyone for your replyes! :D 

  • Like 1
Link to comment
Share on other sites

you have to define

STRINGS.MODS.HUM_SHOP

somewhere before you can fill it.
So just put

if not STRINGS.MODS.HUM_SHOP then
    STRINGS.MODS.HUM_SHOP = {}
end

you can leave out the "if then" stuff, if you are sure you do not delete the content of it.

 

Edited by Serpens
Link to comment
Share on other sites

17 hours ago, Serpens said:

you have to define


STRINGS.MODS.HUM_SHOP

somewhere before you can fill it.
So just put


if not STRINGS.MODS.HUM_SHOP then
    STRINGS.MODS.HUM_SHOP = {}
end

you can leave out the "if then" stuff, if you are sure you do not delete the content of it.

 

Okay, so it stoped crashing, but it looks like this now...

Безымянный.png

my strings are here:

if not STRINGS.MODS.HUM_SHOP then
    STRINGS.MODS.HUM_SHOP = {}
end

STRINGS.MODS.HUM_SHOP.ANNOUNCE_PURCHASETEXT = {
"Thanks, pal.",
"Thanks for your money, pal!",
"You're such a generous! Thanks!",
}

STRINGS.MODS.HUM_SHOP.ANNOUNCE_GONETEXT = {
"You'll come back later, right?",
"Come back again, and buy something, pal!",
"Find some money, and come back later, pal.",
}

STRINGS.MODS.HUM_SHOP.ANNOUNCE_CLOSETEXT = {
"Hey, pal! Wana buy something?",
"Oh, you're still alive? Wana buy something?",
"Firemerm scales - best currency in this world!",
"Do you have any money? If so, I can give you something!",
"My prices are the lowest! Come and get it while it's hot, pal!",
}

STRINGS.MODS.HUM_SHOP.ANNOUNCE_SPAWNS**** = {
"You want some money, right? Get ready to fight!",
"Ready or not, prepare to fight!",
"Money doesn't grow on trees, pal. Fight for them!",
}

STRINGS.MODS.HUM_SHOP.ANNOUNCE_TPTEXT1 = "So you want to enter the dungeon? I've got something for you, pal."
STRINGS.MODS.HUM_SHOP.ANNOUNCE_TPTEXT2 = "It'll teleport you into the dungeon. Be as careful as possible. If you enter this place, you won't be able to come back!"
STRINGS.MODS.HUM_SHOP.ANNOUNCE_TPTEXT3 = "You'll need to pick up the nightmare key, and open rooms with it."
STRINGS.MODS.HUM_SHOP.ANNOUNCE_TPTEXT4 = "Be careful. When you enter room, diffrent monsters will spawn, and'll try to kill you. But in the end you'll get lot of cool godies!"

STRINGS.MODS.HUM_SHOP.ANNOUNCE_REFUSE = "Pal, I don't need this.\nGive me spear, if you want to fight for money \nAnd if you want to talk about dungeon, give me papyrus!"

I've used this:

inst.components.talker:Say(GetString(inst, "ANNOUNCE_GONETEXT"))

Anyway, thanks for you reply!

  • Like 1
Link to comment
Share on other sites

I think when you use this "GetString" function for wilson, then it is searching for a string that contains "WILSON"... but I'm not 100% sure.
So maybe you should use instead Say(GetRanomdItem(STRINGS.MODS.HUM_SHOP.ANNOUNCE_GONETEXT))

May I ask what kind of mod you are working on?
Cause the mod I'm actually working on, a Quest-Mod, does also contain this guy as a shop :D
You can get coins from doing quests (or find then while looting sth) and then you can buy some basic stuff at this guy. The questgiver is the pigking, but I also thought about giving this shopguy a few quests.

Do you plan something similiar? If so we could work together. I build an "Quest-API" mod (90% finished), where anyone can simply add his custom quests and rewards. Maybe this could be helpful to you?

Edited by Serpens
Link to comment
Share on other sites

14 hours ago, Serpens said:

I think when you use this "GetString" function for wilson, then it is searching for a string that contains "WILSON"... but I'm not 100% sure.
So maybe you should use instead Say(GetRanomdItem(STRINGS.MODS.HUM_SHOP.ANNOUNCE_GONETEXT))

May I ask what kind of mod you are working on?
Cause the mod I'm actually working on, a Quest-Mod, does also contain this guy as a shop :D
You can get coins from doing quests (or find then while looting sth) and then you can buy some basic stuff at this guy. The questgiver is the pigking, but I also thought about giving this shopguy a few quests.

Do you plan something similiar? If so we could work together. I build an "Quest-API" mod (90% finished), where anyone can simply add his custom quests and rewards. Maybe this could be helpful to you?

Oh, I won't upload my mod to the workshop. It's for my server only

  • Like 1
Link to comment
Share on other sites

15 hours ago, Serpens said:

I think when you use this "GetString" function for wilson, then it is searching for a string that contains "WILSON"... but I'm not 100% sure.
So maybe you should use instead Say(GetRanomdItem(STRINGS.MODS.HUM_SHOP.ANNOUNCE_GONETEXT))

May I ask what kind of mod you are working on?
Cause the mod I'm actually working on, a Quest-Mod, does also contain this guy as a shop :D
You can get coins from doing quests (or find then while looting sth) and then you can buy some basic stuff at this guy. The questgiver is the pigking, but I also thought about giving this shopguy a few quests.

Do you plan something similiar? If so we could work together. I build an "Quest-API" mod (90% finished), where anyone can simply add his custom quests and rewards. Maybe this could be helpful to you?

So now it's working, but I've not testd it with translations. I'll say you if thometing'll go wrong. Thanks for your help! :D

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...