Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Adding percents to variables?

Adding percents to variables?

Adding percents to variables?

If you have an integer variable, how can you change the variable, so the number is a percentage?


RE: Adding percents to variables?

Please clarify what you want.
Kind of "We have variable X holding value 105; and we want..."
As for now I can't get what exactly you want to do.

RE: Adding percents to variables?

divide by 100

RE: Adding percents to variables?

wouldnt this work:

dim n as integer
dim z as long
n = 50  'integer that you want to change

z = n   'you just put the integer into a              
        'percentage variable

im not sure if this example will work so dont trust me.
if im wrong about this then would somebody who nos better then me please tell me my mistake

RE: Adding percents to variables?

There is no way to make something an actual percentage ie. Print z would display "50%". What you can do, however, is possible to go z=n/100 to get .5, which you could then use as a percentage, just like someone above said.

Remember, a huge part of programming is telling the computer how to do mundane things like display percentages, draw graphs or numbers, or add numbers together. You have to tell the computer everything, minus a couple things that the compiler handles for you. Since it seems this is probably for your game, could I again recommend playing around more with syntax and algorithms before tackling a full-scale RPG? Speaking from experience, I started a little higher than you seem to be when I stated coding the JRPG engine (http://djrpg.sourceforge.net), and the result has been years of problems that could have been solved by anyone of mediocre experience. Try setting up an action game to try various techniques on before you run full tilt into the single hardest genre to code, script, and otherwise create. You'll thank yourself later when you're coding away, hit a simple problem, and know the solution already from code you've already written. :)

RE: Adding percents to variables?

do you mean change the variable into a decimel like 5.267 or a percenage like 37%.

RE: Adding percents to variables?

TO kevcoles,

I've noticed you came back four other times; but you didn't participate in your own post.

Have you found your answer?
  1. If not, you should respond to the above inquiries.
  2. If yes, you should post something here so that we all know this post is done.
Please let us know.

RE: Adding percents to variables?

I have found what I need.

RE: Adding percents to variables?

could you post your answer cus id like to no how to do it

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close