Jump to content

How do i get an integer variable to show up in a string?


HailHell

Recommended Posts

Natively?

newstring = oldstringprefix + iValue + oldstringsuffix

 

I ended up writing a string substitution script that would do the trick.

 

 

  Reveal hidden contents

 

 

That way you could just do:

Notification(StringSubst("You have # arrows left", "#", iNumArrows)

 

Would be great if we had a C version of this in StringUtil. It would be a simple passthrough to the native function and much faster.

 

Hope that helps.

Link to comment
Share on other sites

That sure looks complicated.... Glad I have no need to do that.

 

@HailHell

Assuming you already have an integer or float that tracks the # killed...

For the example we'll call that variable NumKilled.

 

Debug.Notification("You have killed this enemy "+NumKilled+" times.")

Link to comment
Share on other sites

If you're going to be reusing the same text and only want to change the numerical value, you can use message.show(Number)

 

http://www.creationkit.com/Show_-_Message

 

And format the message according to the flags on that page. In your case it would look like:

 

"You killed this enemy %.0f times."

 

Preferable in my opinion to putting the string in your script.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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