dizietemblesssma Posted September 6, 2022 Share Posted September 6, 2022 I have this code:String msg4 = PlayerRef.GetValue(CarryWeightAV) As Stringcarryweight_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.0000it 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 More sharing options...
DieFeM Posted September 6, 2022 Share Posted September 6, 2022 Check this function Math.Floor Link to comment Share on other sites More sharing options...
dylbill Posted September 7, 2022 Share Posted September 7, 2022 Math.Floor will work, or you can do String msg4 = (PlayerRef.GetValue(CarryWeightAV) As Int) You don't need to put As String as papyrus does this automatically. Putting As Int though is the same as Math.Floor Link to comment Share on other sites More sharing options...
RaidersClamoring Posted September 7, 2022 Share Posted September 7, 2022 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 More sharing options...
Recommended Posts