Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   script/math question (https://forums.graalonline.com/forums/showthread.php?t=74150)

Chompy 05-23-2007 02:37 PM

script/math question
 
Well, I can't seem to find a algorithm/function for it.. :(
Like, if you have a music length, lets see 3mins and 2 secs

0 = 0 ---> 1 = 3.20mins
0 is 0 and 1 is max (3.20 mins)
like percentage, but with lower number (0 -> 1)

Or, if you have a rgb from a program (like paint) which is probably max 255 if I remember
0 = 0
1 = 255

Easy Example:
Max: 2

0 = 0
0.1 = 0.2
0.2 = 0.4
0.3 = 0.6
0.4 = 0.8
0.5 = 1
0.6 = 1.2
0.7 = 1.4
0.8 = 1.6
0.9 = 1.8
1 = 2

I'm using this for a GuiProgressCtrl control..

DustyPorViva 05-23-2007 02:52 PM

(currentnumber/maxnumber)
(rgbvalue/255)
(musicpos/musiclen)
Is that what you're looking for?

zokemon 05-23-2007 02:57 PM

Yeah, for percentages you always just do (currentnumber/highestnumber)
0/anything = 0
anything/anything = 1

Get it?

Chompy 05-23-2007 03:18 PM

Just what I needed, Thank you both :)

Quote:

Originally Posted by zokemon (Post 1311010)
Yeah, for percentages you always just do (currentnumber/highestnumber)
0/anything = 0
anything/anything = 1

Get it?

Thanks :)

zokemon 05-23-2007 03:36 PM

Not a problem!


All times are GMT +2. The time now is 03:18 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.