v2099 Posted September 7, 2022 Posted September 7, 2022 Hello everyone, Â I'm relatively new to Skyrim modding and Papyrus, but sometimes I feel like I just can't find reference info about some really basic things. I'm trying to parse a string that contains a Hexadecimal number into an int value (eg. "0x10" -> 16). Basically, I'm reading Form ID values from a config file, and I want to use them for Game.GetFormFromFile but I just can't figure out how to parse the string as a hex int. I've tried casting to int, but that just seems to parse it as 0 (maybe because of the leading 0? If I pass "123" to sampleText it makes it to the message properly): String sampleText = "0xF" Debug.MessageBox(sampleText as int) ; Outputs 0 Â I'm running out of ideas about how to handle this, and I really don't want to write my own parser. Does anyone know of a string hex number parser either built in or in SKSE or PapyrusUtil? I'm hoping this is just a noob question with a really simple answer. Â Thanks, v
Yakub Posted September 7, 2022 Posted September 7, 2022 I am not good at papyrus, but perhaps it parses '0x' as 0 and stops at that? Can it parse hex strings without '0x'?
v2099 Posted September 7, 2022 Author Posted September 7, 2022 (edited) 59 minutes ago, Yakub said: I am not good at papyrus, but perhaps it parses '0x' as 0 and stops at that? Can it parse hex strings without '0x'? I tried removing the "0x", and it still fails for letter values (I tried just passing "F", but it didn't parse it to 15). I'm just troubleshooting my parser code now, so at this point I might just finish it lol. Still, thanks for the comment Edited September 7, 2022 by v2099
v2099 Posted September 8, 2022 Author Posted September 8, 2022 I just wrote a simple utility to do this. If anyone from the future runs into this issue, I published it on Nexus as HexUtil. Cheers, everyone! 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now