Jump to content

Recommended Posts

@SethR I am sure THIS is very useful, but unfortunately I have no idea on how to implement it in my mod.

The existing solution created by @simplex is not an option right now, since it causes the game to crash whenever we hover the mouse pointer on a Wet Stalagmite(not the tall one), and I can't seem to contact him right now.

So I was wondering if I could get some quick examples or answers from the devs or from someone skilled enough to briefly explain the code usage.

EDIT: Now I'm even more confused after reading this from the API Version 6 Update:

Quote

Moddable String Construction has been added (only used in Reign of Giants). The file in question here is dlcsupport_strings.lua. The new functions will make it easier (and more correct!) to localize the construction of phrases with adjectives that occurs when an entity is smoldering, withered or wet. By default, these adjectives are added before the name of the entity. Unless set otherwise, the table that tracks this is just a series of true or false (prefix and suffix style construction, respectively) values that are mapped to names and adjectives. There are three functions here that are worth covering:

  • MakeAllSuffixes(fn) is a function that will make all phrases constructed with the adjective coming AFTER the entity name. The fn parameter is optional: if you just want to make all phrases use a suffix style of string construction, then you do not need to enter a parameter. The parameter is there in case you want to make a more involved function for deciding how to construct the phrase.

  • MakeAllPrefixes(fn) is a function that will make all phrases constructed with the adjective coming BEFORE the entity name. The fn parameter is optional: if you just want to make all phrases use a prefix style of string construction, then you do not need to enter a parameter. The parameter is there in case you want to make a more involved function for deciding how to construct the phrase.

  • SetUsesPrefix(item, usePrefix) is a function that allows you to set special cases for individual items. The item parameter should be the name or the adjective that you’re concerned with. The usePrefix parameter should either be a bool (true or false as above) or a function (more involved decision as above).

What should I do? Someone said "GLOBAL.MakeAllSuffixes()" would do, but yet no confirmation at all. I tried it and had no luck.

Edited by SrJardel
Was moved.

Just to make things clear to everyone, this was originally posted on DS thread, but then I realized the crash with @simplex's workaround only happens on DST client, so it was moved here.

So, I don't know what is the big deal between the two games that makes it run smooth on DS but causes DST to crash in that specific condition. And also, I still don't know at all how, and IF can I implement the official alternative provided by @SethR in this case as well.

  • Developer
2 minutes ago, SrJardel said:

It feels like I'm asking too much, or maybe I'm not using this mention thing correctly...

You're using it right, but SethR has left Klei some time ago, and I don't think Simplex is active in these forums anymore...

1 hour ago, ImDaMisterL said:

You're using it right, but SethR has left Klei some time ago, and I don't think Simplex is active in these forums anymore...

Oh, if it was not by you, I would never guess that.

Thanks for the heads up my friend!

 

Maybe I should try @255, @V2C, @PeterA or @JanH

Edited by SrJardel
proper mention
1 hour ago, V2C said:

There appears to be a bug with the default behaviour of MakeAllSuffixes(), which should be fixed in our next update.

Thank you very much for the feedback.

It was driving me crazy as the code seemed to have no effect, no matter where and how I placed it.

Also in same file containing this MakeAllSuffixes() function ("scripts/dlcsupport_strings.lua")  changing "USE_PREFFIX" ...= true to false had no effect.

I don't know if it can be implemented, but since you guys are willing to fix this, there are a few more simple things that could be included in the USE_PREFFIX table, like Example's Collection in the wardrobe (should be "Coleção de Example" when translated to some languages, mine included) and a few more which I can provide you in a quick, short and organized list if requested.

Again, thank you very much @V2C for your support..

@SrJardel try this and tell me if it works or not.
Put the file in "... / mods / (your Mod) / scripts" folder and add the line:

GLOBAL.require  "suffixedAdjectives"

in "modmain.lua" file.

In the script I have only modified the function "ConstructAdjectivedName(...)"

Spoiler

function ConstructAdjectivedName(inst, name, adjective)
    if not name and inst and inst.prefab then 
        name = STRINGS.NAMES[string.upper(inst.prefab)]
    end

    local usePrefix = UsesPrefix(adjective) ~= nil and UsesPrefix(adjective) or UsesPrefix(name)

    local construction = nil

    if type(usePrefix) == "function" then
        local tryfunction = usePrefix(inst, name, adjective)
        if type(tryfunction) == "string" then
            construction = tryfunction
        end
    end

    if not construction then
        construction = name.." "..adjective <--
    end

    return construction
end

 

 

suffixedAdjectives.rar

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
×
  • Create New...