Jump to content

Papyrus changing string cases?


Recommended Posts

I've run into what looks like a really odd quirk.

 

I am simply passing a string as a parameter into a function. It normally works as expected.

 

However, if I pass a number in word form (ie. "one", "two" or "three") Papyrus seems to convert the case of the string to capitalize the first letter like this: "One", "Two" or "Three". It does the same if I put the string through in all caps like "ONE", "TWO" or "THREE".

 

Has anyone seen this before? Any ideas on how to fix?

Link to comment
Share on other sites

You will want to post your code. But to answer your question, no, I have never seen that behavior from Papyrus.

Function OnSomeEvent()
    doSomething("one")
EndFunction

Function doSomething(string s)
    Debug.Notification("doSomething: " + s)
EndFunction
Link to comment
Share on other sites

  • 2 years later...

Sorry to revive a 2 year old thread but I can't see this discussed anywhere else and I'm having the same issue. For some strange reason, papyrus changes some strings to lower case and others to upper case with no apparent cause. Did you ever find an answer?

Link to comment
Share on other sites

Just ran some script tests and I am not seeing that string reformatting. What specific functions are re casing strings ?

;*********************************************************
Function PushStrings()  ; cqf SKK_tools "SKK_toolsScript.PushStrings"
   StringTest("UPPERCASE")	
   StringTest("lowercase")	
   StringTest("CamelCase")
   String sVariable = "Variable"
   StringTest(sVariable)
EndFunction
;*********************************************************
Function StringTest(String sString)
   Debug.Trace(" ")
   Debug.Trace("SKK_tools.StringTest received " + sString)
   If sString == "UPPERCASE"
	Debug.Trace("SKK_tools.StringTest UPPERCASE MATCH " + sString)
   ElseIf sString == "lowercase"	
	Debug.Trace("SKK_tools.StringTest lowercase MATCH " + sString)
   ElseIf sString == "CamelCase"
	Debug.Trace("SKK_tools.StringTest CamelCase MATCH " + sString)
   ElseIf sString == "Variable"
	Debug.Trace("SKK_tools.StringTest Variable  MATCH " + sString)	
   Else
	Debug.Trace("SKK_tools.StringTest NO MATCH " + sString)
   EndIf
EndFunction 
;*********************************************************
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest received UPPERCASE
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest UPPERCASE MATCH UPPERCASE
[10/09/2019 - 11:50:31AM]
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest received lowercase
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest lowercase MATCH lowercase
[10/09/2019 - 11:50:31AM]
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest received CamelCase
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest CamelCase MATCH CamelCase
[10/09/2019 - 11:50:31AM]
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest received Variable
[10/09/2019 - 11:50:31AM] SKK_tools.StringTest Variable MATCH Variable
Link to comment
Share on other sites

 

Just ran some script tests and I am not seeing that string reformatting. What specific functions are re casing strings ?

 

Thanks for providing that. In my case I have a string array:

String[] tierNames = new string[4]
tierNames[0] = "Platinum"
tierNames[1] = "Gold"
tierNames[2] = "Silver"
tierNames[3] = "Bronze"

When pulling the names ...

debug.notification("A " + tierNames[tier] + " medal!")

... each is correct apart from "Gold" which is always returned in full lowercase as "gold"

 

I am about to start some more testing however as I haven't done much yet. My main point in querying was to see if OP had an epiphany that would save me some time.

 

Thanks for your reply. I will update on findings as this is the first search that appears if anyone else sees the issue occur.

Link to comment
Share on other sites

It only seems to be the word "Gold" that gets dropped to lowercase! Wondering if this is an engine level implementation to allow string concatenation relating to gold pieces??? If so, that's really bizarre.

 

NOTE: I've just realised that this original post is sitting in the Fallout 4 area while I am speaking specifically of Skyrim. Apologies for the oversight in my original reply. If I find anything specific to Skyrim, I'll post the findings in the relevant area.

Link to comment
Share on other sites

It only seems to be changing the display case of "Gold", doesn't change any other elements or even "Glod".

 

I have noticed that sometimes the Quest Reference Alias form will change an upper case first letter in the alias name to lower case as it saves, so clearly there is some underlying case change glitch.

 

As there is no base game method to present a string variable to a user in the UI, and logical string evaluation is case insensitive we can infer why this was not seen as a problem to be fixed.

Link to comment
Share on other sites

  • 3 months later...

Yah I'm also facing this issue with the mod that I am currently working on that allows you to change the name of a npc by typing in your keyboard. once the name is changed the entire word gets UPPERCASE but not all of them, for example when I typed a new word like the name of a vanilla place like "Riften" or the name of a NPC like "Ralof" these words are not entirely capitalized only the first letter is.

 

Another case was when I typed a new word "orange" my get function returned this "orANGE". It makes me think that there might be a set of predefined words that don't suffer alteration while the remaining gets entirely capitalized.

 

If someone find out a solution to this problem please share it with the rest of us.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...