Jump to content

How do you get a script variable number in a message?


KingShelby

Recommended Posts

I'm wanting to have a message box pop up and tell the player what the winning number was.

 

Something like: The winning number was "67".

 

I'll be using an int variable like: int winningnumber

 

The winning number will be randomly generated with getrandompercent

 

I'm looking to get that random number into the message.

Link to comment
Share on other sites

Yea I saw that, and its what I need but I'm not sure on how to script it in. I done a bunch of scripting but this will be my first time using %.f. I'll try a few things tonight when I get home.

 

If anyone has tips I'm sure it'll save me some headache.

Link to comment
Share on other sites

Include the formatting switch in the text in the message form, like this:

 

"The winning number was %g."

 

Then pass the script variable to the ShowMessage function along with the message, like this:

set iWinningNumber to GetRandomPercent
ShowMessage WinnerMessage, iWinningNumber

Here's an example with NVSE, which allows you to show messages without creating a new message form. NVSE also supports a number of extra switches that can't be used in ordinary message forms.

MessageBoxEx "The winning number was %g.", iWinningNumber
Link to comment
Share on other sites

 

Include the formatting switch in the text in the message form, like this:

 

"The winning number was %g."

 

Then pass the script variable to the ShowMessage function along with the message, like this:

set iWinningNumber to GetRandomPercent
ShowMessage WinnerMessage, iWinningNumber

Here's an example with NVSE, which allows you to show messages without creating a new message form. NVSE also supports a number of extra switches that can't be used in ordinary message forms.

MessageBoxEx "The winning number was %g.", iWinningNumber

 

Thanks a ton for the the info, it worked like a charm. I had initially put the variable after the formatting switch in the message. I had about 3 things all tying in together with the message popping up in the middle of other messages, so I just put the info in like you suggested and had no problems with it at all. This MessageBoxEx looks pretty interesting too.

 

I usually don't ask for much help, but figured it might help me get it figured out quicker so I decided to ask here. Your quick response is very much appreciated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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