Home
News Archives
Staff/Contact
About
Community
Forums
Gaming
Games
Resources
Articles
Articles
Tutorials
Game Reviews
Displaying Variables on Screen
      *Introduction*
This tutorial covers on how to enable variables to be viewed on screen without the use of a message box.
Several uses for this method includes: custom currency display, stat display, points (for a mini-game), etc.
The choices are endless, however, you decide what you want use it for.

*Materials*
Pictures: You will need a picture of the numbers 0-9. Be sure to keep each one in its own image file.
I suggest you copy the numbers from your system file so that it matches with your system graphics.
Variables: Make a new variable. Name it whatever suits you as long as you can identify it.
However, for this tutorial I'll name it "Copy". The variable will be the copy of the original variable that you are trying to display on the screen.

You must have this variable for two reasons:
1. This method will rewrite your original variable so you cannot get it back.
2. You need to have the original variable in order to completely use this method.

*Process*
1. You must make a variable operation. Set the "Copy" to the original variable.
2. Create another variable operation for "Copy" to modulus by 10.
3. Make a new conditional branch beneath concluding whether "Copy" is 0. If the condition is true, go to the show picture command and display the picture of the number zero.
4. Repeat this process for each other number.
5. Once you have gone up to 9, make another conditional branch stating whether the original variable is higher than 10.
6. If the condition is true, set a variable operation for "Copy" to the original variable.
7. You must modulus with 100 and also divide "Copy" by 10 after that.
8. Repeat steps 3-4.
9. For more than 2 digits, continue to use steps 5-8 however, increase the amount of 0s (on the dividing and modulus) by 1.
Ex. Showing 2nd digit: Modulus 100, Divide 10
Showing 3rd digit: Modulus 1000, Divide 100
Showing 4th digit: Modulus 10000, Divide 1000

Note: Ensure that all the pictures are in different X and Y screen relatives or else they will all be on top of each other if they are on the same X and Y.
For visual learners, here's how it should look like:

Variable Oper: Set, Var 's Value
Variable Oper: Mod, 10
Branch if Var is 0
Show Picture: 1, Number 0, (X,Y)
End
Branch if Var is 1
Show Picture: 1, Number 1, (X,Y)
End
Branch if Var is 2
Show Picture: 1, Number 2, (X,Y)
End
Branch if Var is 3
Show Picture: 1, Number 3, (X,Y)
End
Branch if Var is 4
Show Picture: 1, Number 4, (X,Y)
End
Branch if Var is 5
Show Picture: 1, Number 5, (X,Y)
End
Branch if Var is 6
Show Picture: 1, Number 6, (X,Y)
End
Branch if Var is 7
Show Picture: 1, Number 7, (X,Y)
End
Branch if Var is 8
Show Picture: 1, Number 8, (X,Y)
End
Branch if Var is 9
Show Picture: 1, Number 9, (X,Y)
End
Branch if Var is 10 or more
Variable Oper: Set, Var 's Value
Variable Oper: Mod 100
Variable Oper: /10
Branch if Var is 0
Show Picture: 2, Number 0, (X,Y)
End
Branch if Var is 1
Show Picture: 2, Number 1, (X,Y)
End
Branch if Var is 2
Show Picture: 2, Number 2, (X,Y)
End
Branch if Var is 3
Show Picture: 2, Number 3, (X,Y)
End
Branch if Var is 4
Show Picture: 2, Number 4, (X,Y)
End
Branch if Var is 5
Show Picture: 2, Number 5, (X,Y)
End
Branch if Var is 6
Show Picture: 2, Number 6, (X,Y)
End
Branch if Var is 7
Show Picture: 2, Number 7, (X,Y)
End
Branch if Var is 8
Show Picture: 2, Number 8, (X,Y)
End
Branch if Var is 9
Show Picture: 2, Number 9, (X,Y)
End
End

Enjoy!
 RM2K(3) tutorials



07/22/09
06:31 PM

Rate this Article

 1

 0

Comments :: 1

dragonheartman
07/25/09 04:06 PM
Yay, handy! However we need a [code] tag.
 
Add a Comment


Please LOGIN or REGISTER to post a comment!