Jump to content

Papyrus Convert Hex String to Int


skyrimisokiguess

Recommended Posts

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

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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