Why are all vitals set in hundredths?

Open discussion forum. For topics that do not fit anywhere else.

Moderator: POL Developer

Post Reply
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Why are all vitals set in hundredths?

Post by MontuZ »

Just curious, I can't seem to find any real point to it.

Clarify it for me?
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Why are all vitals set in hundredths?

Post by Luth »

So that vitals can be incremented by fractions instead of whole numbers.

For example, a game is level based, and each level, the character's hitpoints go up by 1.5.

Level 1: 10 (10)
Level 2: 11 (11.5)
Level 3: 13 (13)
Level 4: 14 (14.5)
andenix
New User
Posts: 19
Joined: Thu Nov 06, 2008 8:39 am

Re: Why are all vitals set in hundredths?

Post by andenix »

That one puzzles me greatly. Why couldn't they just be float or something.
Actually I came across numerous of bugs because of this.
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Why are all vitals set in hundredths?

Post by Luth »

Came across, or caused? If its "came across" then let us know so we can fix them in the Distro.

In POL, reals are stored as doubles, integers as longs. The size required by each variable is thus half, and the computing time of int math is much faster than float math. Still, if using hundredths is confusing, I would suggest a function like the following:

Code: Select all

function ToVitalValue(val)
    return CInt(CDbl(val) *  100);
endfunction
Pass it a whole number or float, and you wont have to worry about it. :)
andenix
New User
Posts: 19
Joined: Thu Nov 06, 2008 8:39 am

Re: Why are all vitals set in hundredths?

Post by andenix »

We aren't based on distro, so I can't really know if there are any problems in it. I just wanted to point out that thats probably the most confusing thing I ever encountered and leads to many scripters with POL92 background (me including) to creating bugs. Anyway if you beleive in such things as computing time these days, doesn't it make it even slower if you convert values via escript?

-Cheers

PS: Thanks for the tips Luth.
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Why are all vitals set in hundredths?

Post by Luth »

Having made games for handheld systems like the DS, which uses fixed-point math for its calculations, yes, I believe in computing speed. ;) But that's me.

Please remember that its entirely possible, and likely a good idea, to write wrapper functions for many of these operations. I, and likely most others I would think, have an "attributes.inc" file that has such functions as "SetHp" which take floats and convert them to hundredths-ints internally. It allows for the bug-free and easy-to-understand coding everywhere else in the project that you desire. If you dont have one of these available, I'm sure either Distro has one, or I can send you mine to edit to your needs.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Why are all vitals set in hundredths?

Post by Yukiko »

I am glad there are still programmers who are concerned with "time", ie. processor cycles.
andenix
New User
Posts: 19
Joined: Thu Nov 06, 2008 8:39 am

Re: Why are all vitals set in hundredths?

Post by andenix »

Well I am concerned about CPU cycles as well, but if I choose between getting something done (probably not the fastest way possble), or posponding it to laters because it will take forever to do it the elegant way. I'd choose to have it now. Isn't that the reason they actually invented high level languages, like Java or Python?
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Why are all vitals set in hundredths?

Post by Luth »

Well first remember that POL is 12 years old. Do you remember what we were running on 12 years ago? :)

Second, what you want is fully at your disposal, by either writing it (5 mins, tops) or downloading it (30 secs, tops). Either way, you're covered by what POL and its community has provided. Cheers! :D
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Re: Why are all vitals set in hundredths?

Post by MontuZ »

I just get confused with the vital functions;
Oh shit, what do I have to divide/multiply this by again? 100, 1000? *Checks docs*
Do I have to do any extra math with this vital function? *Checks docs*

I mainly rely on short term memory when scripting, I forget things =)
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Why are all vitals set in hundredths?

Post by Luth »

Well then do what us old guys do, write a function to do that stuff for us, and never mess with Vitals directly again! :D
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Why are all vitals set in hundredths?

Post by Yukiko »

Oh Luth!
You have an answer for everything don't you?
*grins*
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Why are all vitals set in hundredths?

Post by Luth »

I... I don't know. ;)
Post Reply