Jump to content

Display float as int


Recommended Posts

I have this code:

String msg4 = PlayerRef.GetValue(CarryWeightAV) As String

carryweight_display = msg3+" "+msg4

 

no matter what I do I cannot get msg4 to display without the decimal places i.e. instead of displaying 240 for carryweight, it shows 240.0000

it also shows that if I change the line to:

Int msg4 = PlayerRef.GetValue(CarryWeightAV) As Int

 

I can't find any string editing functions in the CK wiki.

Any suggestions?

 

diziet

Link to comment
Share on other sites

Could it be that the variables of the old script are persisting in the save that you're loading? "As int" *should* work. If this is the issue Math.floor() will obviously make no difference.

"...if the object's OnInit event has already run when the save was made, it will not be run again. Therefore, if you set up a new variable in the OnInit event, you cannot be guaranteed that that variable will have the proper value unless you are sure that object never existed in the save game before."

https://www.creationkit.com/index.php?title=Save_Files_Notes_(Papyrus)#Properties_and_Script_Variables

Link to comment
Share on other sites

  • Recently Browsing   0 members

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