Open alattalatta opened 3 years ago
Please note that I'm not the one in your Discord so it would be better if you may answer here directly. I asked them to relay my words but I'll write here as well for history keeping anyway.
"Fortunately we have unique ID for any given Def family: The defName" This is false. Initially we were using only defName. But then I found out there are many things that depend on label to be differentiated.
I suspect such "many things" are something like a trait and a skill sharing the same defName? But you can still specify the def family. As I said, unique ID for any given Def family, not the whole Def class.
INITIATOR_skill_*skillDefName*_level
INITIATOR_trait_*traitDefName*_level
Other than this I can't see why it can't be differentiated.
I do hope that you are aware of Thought_Memory#CurStageIndex
so that you may write in a way that you can differentiate and branch by a thought's severity.
Close this if you'd like.
Hi @alattalatta ! Thanks for your help. I just manage the XML part of SpeakUp.
Please consider this:
<!-- ===SleptInBedroom=== -->
<li>r_logentry(INITIATOR_thoughtDefName==SleptInBedroom,tag=ReactToThought_Bedroom)->[thought_bedroom] [what_about_yours]</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==awful bedroom)->My [swearword]room is [swearword_adverb][ugly] — but at least I don't have to share it.</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==decent bedroom)->I sleep in a [proper] bedroom.</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==slightly impressive bedroom)->I like my bedroom — it's a nice one.</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==impressive bedroom)->I sleep in an impressive bedroom. It's great!</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==very impressive bedroom)->I sleep in a very impressive bedroom. I just love it!</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==extremely impressive bedroom)->I get to sleep in an extremely impressive bedroom! </li>
<li>thought_bedroom(INITIATOR_thoughtLabel==unbelievably impressive bedroom)->My bedroom is truly astounding!</li>
<li>thought_bedroom(INITIATOR_thoughtLabel==wondrously impressive bedroom)->Sleeping in my bedroom feels like heaven. Just wondrous!</li>
Here you can see there is one thoughtDefName==SleptInBedroom. I'd love to use just one, this one. But it actually branches into many labels. So it's not about skill and trait, there are unique (as far as I know). It's about other mechanisms.
About Thought_Memory#CurStageIndex
, I don't know about C# details. But maybe @jptrrs can understand something.
One can argue that rules (in context of scripting that is
ruleStrings
in RimWorld) should be a thing of invariance. And as you may know it, labels do change, especially when the user is changing language of the game.https://github.com/jptrrs/SpeakUp/blob/bb8d7ed3ce960ee2548f1270331481b2d6489e8c/SpeakUp/ExtraGrammarUtility.cs#L99
https://github.com/jptrrs/SpeakUp/blob/bb8d7ed3ce960ee2548f1270331481b2d6489e8c/SpeakUp/ExtraGrammarUtility.cs#L114-L115
https://github.com/jptrrs/SpeakUp/blob/bb8d7ed3ce960ee2548f1270331481b2d6489e8c/SpeakUp/ExtraGrammarUtility.cs#L156
These rules all change when you change your language. Of course, translations should also include the rule in its whole form so one should be able to do this: (Note: Actually I can't, described below)
But in Korean (and supposedly almost all other languages), this does not work. See, this is
Verse.Grammar.Rule_String.pattern
:It indeed is weird, but nothing is relevant except this:
(?<paramname>[a-zA-Z0-9_/]+)
Parameters MUSE use ASCII alphabets. This makes it impossible to translate SpeakUp even to other latin alphabet languages with extra characters.Note that the parameter is obviously not just
INITIATOR_
. The regexp just couldn't recognize the rest.Fortunately we have unique ID for any given Def family: The
defName
. All four lines I linked at the beginning can simply usedefName
instead oflabel
orLabel
and all will be solved.Please do consider changing it. Thanks.