[RM2K3] SCORE SHOWING HELP
Posts
Pages:
1
So basically, I have a small window in the bottom-right of the screen that shows the points for the player.
The problem is I need a little help on the coding part..
I need it to show in the screen (the max is 9999999) and at the end, add it all up to the money.
So can anyone help me out? :(
The problem is I need a little help on the coding part..
I need it to show in the screen (the max is 9999999) and at the end, add it all up to the money.
So can anyone help me out? :(
Haha just short of 10 million? Epic.
Parallel process: Take total score variable have it equal a variable we'll use for math. We'll call it COMPUTE. COMPUTE now equals your score.
Divide COMPUTE by 1 million. This'll leave you with the million digit (RM gets rid of decimals). Use this variable to make 10 conditionals for all the digit options (i.e. if COMPUTE = 8, then show a picture of an 8 where your millions place is on the screen somewhere, do this for all 10 digits).
Have a variable called COMPUTE2 = COMPUTE. Multiply COMPUTE2 by 1 million.
Make COMPUTE equal the total score again, but then subtract COMPUTE2 from COMPUTE. You should have a six digit number now. Divide COMPUTE by 100,000 to get your hundred-thousand digit and show that picture.
Continue cycling with COMPUTE and COMPUTE2 down to the ones digit and you're set.
Note: There may be a much easier way to do this.
Parallel process: Take total score variable have it equal a variable we'll use for math. We'll call it COMPUTE. COMPUTE now equals your score.
Divide COMPUTE by 1 million. This'll leave you with the million digit (RM gets rid of decimals). Use this variable to make 10 conditionals for all the digit options (i.e. if COMPUTE = 8, then show a picture of an 8 where your millions place is on the screen somewhere, do this for all 10 digits).
Have a variable called COMPUTE2 = COMPUTE. Multiply COMPUTE2 by 1 million.
Make COMPUTE equal the total score again, but then subtract COMPUTE2 from COMPUTE. You should have a six digit number now. Divide COMPUTE by 100,000 to get your hundred-thousand digit and show that picture.
Continue cycling with COMPUTE and COMPUTE2 down to the ones digit and you're set.
Note: There may be a much easier way to do this.
I do it differently. Make a common event to call. I use an unrolling technique (the numbers in my game go up to 9,999,999 too). Here's the preamble
var DisplayNumber = (the number to display)
var StartX = (Starting location for the rightmost digit in X)
var StartY = (Starting location for the rightmost digit in Y)
(Note that startx and starty can be values you set yourself before common event call)
Now here's the iteration
var DisplayDigit = DisplayNumber MOD 10 (rpgmaker 2003 has the MOD command)
if DisplayNumber <= 0 then end process
if DisplayDigit == 0 then show picture (StartX,StartY)
if DisplayDigit == 1 then show picture (StartX,StartY)
...
if DisplayDigit == 9 then show picture (StartX,StartY)
StartX -= (Width of each number)
DisplayNumber /= 10
Copy and paste that code 7 times (not the preamble). All you have to do each paste is change the picture number so it is a different picture which can't be done by variable. This is precisely what I did in my game for the DP display. Took me moments to even make several of these.
var DisplayNumber = (the number to display)
var StartX = (Starting location for the rightmost digit in X)
var StartY = (Starting location for the rightmost digit in Y)
(Note that startx and starty can be values you set yourself before common event call)
Now here's the iteration
var DisplayDigit = DisplayNumber MOD 10 (rpgmaker 2003 has the MOD command)
if DisplayNumber <= 0 then end process
if DisplayDigit == 0 then show picture (StartX,StartY)
if DisplayDigit == 1 then show picture (StartX,StartY)
...
if DisplayDigit == 9 then show picture (StartX,StartY)
StartX -= (Width of each number)
DisplayNumber /= 10
Copy and paste that code 7 times (not the preamble). All you have to do each paste is change the picture number so it is a different picture which can't be done by variable. This is precisely what I did in my game for the DP display. Took me moments to even make several of these.
post=96072
var DisplayDigit = DisplayNumber MOD 10 (rpgmaker 2003 has the MOD command)
Y-you actually know how to use a modulus... So happy... ;_;
Hmm I do understand what you told me WolfCoder, but do you have an example you can show me? (Yes, Im still a beginner at RM2K3 unfortunately.) If you don't, don't sweat it! I'll try to make it work.
If I just showed you the code I'm not sure you would understand what I'm getting at here. Despite taking me a moment to assemble, the code itself is huge. The thing here is that I made a section of code I can copy and paste. The variables and everything make each pasting automatically work.
I could use a loop if it weren't for the fact you can't Show a Picture of a number stored in a variable. You have to go in there and change the picture number.
As for the modulus, it's very simple. Modulus is another term for Remainder.
x = n*q+m
Where m is the modulus. If you MOD 13 by 10, m will be 3 because 1*10+3 = 13 and you had to put 3 for m. The result will always be from 0 to q-1, so m could only be 0...9 which is what we needed.
In the above example, I reduce the displaying number by 10 (divide by 10) to destroy the last digit. Before showing the next picture, it checks to see if the displaying number is 0. We don't want to display zeroes after the highest digit, so we just quit to save processing power using the END EVENT PROCESSING command.
You then MOD the display number by 10 to get the current digit. 1s, 10s, 100s, 1000s, 10000s, 100000s, and 1000000s. You stop after seven iterations because that's all the digits you want to display.
When you paste, you just need to change the picture number to the next picture you want to use for that digit. You can speed the creation up even faster by double clicking on each show picture command and just typing the new number in, and hitting enter. The cursor is on the picture number in the form at default and enter hits the OK button.
Remember your picture limit too, I think you can get two 7-digit numbers up before you start using up a ton of pictures. Also, don't call the show number common event command more than once per map load or number change. It will slow things down a ton, so only call it if you're on a new map or need to make it show a different number.
( Oh and just for the record, I'm actually kind of bad at math ^^ )
I could use a loop if it weren't for the fact you can't Show a Picture of a number stored in a variable. You have to go in there and change the picture number.
As for the modulus, it's very simple. Modulus is another term for Remainder.
x = n*q+m
Where m is the modulus. If you MOD 13 by 10, m will be 3 because 1*10+3 = 13 and you had to put 3 for m. The result will always be from 0 to q-1, so m could only be 0...9 which is what we needed.
In the above example, I reduce the displaying number by 10 (divide by 10) to destroy the last digit. Before showing the next picture, it checks to see if the displaying number is 0. We don't want to display zeroes after the highest digit, so we just quit to save processing power using the END EVENT PROCESSING command.
You then MOD the display number by 10 to get the current digit. 1s, 10s, 100s, 1000s, 10000s, 100000s, and 1000000s. You stop after seven iterations because that's all the digits you want to display.
When you paste, you just need to change the picture number to the next picture you want to use for that digit. You can speed the creation up even faster by double clicking on each show picture command and just typing the new number in, and hitting enter. The cursor is on the picture number in the form at default and enter hits the OK button.
Remember your picture limit too, I think you can get two 7-digit numbers up before you start using up a ton of pictures. Also, don't call the show number common event command more than once per map load or number change. It will slow things down a ton, so only call it if you're on a new map or need to make it show a different number.
( Oh and just for the record, I'm actually kind of bad at math ^^ )
Pages:
1















