Release Getting the number after the point
#1
for @Tomsen1410

Code:
//iprintln("2.4 will be: " + Number_func(2.4)); //2.4 will be: 4 Number_func(num) { num += " "; num = StrTok(num,"."); return int(num[1]); }
[Image: MaEIQ.png]

#2
(08-31-2011, 14:10)Pozzuh Wrote: for @Tomsen1410

Code:
//iprintln("2.4 will be: " + Number_func(2.4)); //2.4 will be: 4 Number_func(num) { num += " "; num = StrTok(num,"."); return num[1]; }

now it will return "4 "...
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu


#3
(08-31-2011, 14:11)iAegle Wrote:
(08-31-2011, 14:10)Pozzuh Wrote: for @Tomsen1410

Code:
//iprintln("2.4 will be: " + Number_func(2.4)); //2.4 will be: 4 Number_func(num) { num += " "; num = StrTok(num,"."); return int(num[1]); }

now it will return "4 "...

What are you talking about? Troll

[Image: MaEIQ.png]

#4
(08-31-2011, 14:13)Pozzuh Wrote:
(08-31-2011, 14:11)iAegle Wrote:
(08-31-2011, 14:10)Pozzuh Wrote: for @Tomsen1410

Code:
//iprintln("2.4 will be: " + Number_func(2.4)); //2.4 will be: 4 Number_func(num) { num += " "; num = StrTok(num,"."); return int(num[1]); }

now it will return "4 "...

What are you talking about? Troll

it will return the number + a space
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu


#5
If there isn't a native function to do so, just do this (I never coded any gsc and I just guess this works).

Code:
foo = 1.2345; bar = foo - int(foo);

#6
(08-31-2011, 14:24)SuperNovaAO Wrote: If there isn't a native function to do so, just do this (I never coded any gsc and I just guess this works).

Code:
foo = 1.2345; bar = foo - int(foo);

I don't have a use for either one yet, but the difference is, @Pozzuh 's version will return 4 and @SuperNovaAO 's will return 0.4

#7
(08-31-2011, 20:05)some_kid Wrote:
(08-31-2011, 14:24)SuperNovaAO Wrote: If there isn't a native function to do so, just do this (I never coded any gsc and I just guess this works).

Code:
foo = 1.2345; bar = foo - int(foo);

I don't have a use for either one yet, but the difference is, @Pozzuh 's version will return 4 and @SuperNovaAO 's will return 0.4

Code:
foo = 1.2345; bar = foo - int(foo); num = int( bar * 100 );

?
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu


#8
Code:
while (int(bar) != bar) { bar = 10 * bar; }

To get 0 digits after the . after cutting the front of.

And yes, this is probably still faster than string manipulation since string manipulation the slowest thing possible is for computers (computers are made to calculate, not read).



Possibly Related Threads…
Thread Author Replies Views Last Post
Question Help Upgrade my point system from files to Database, help? EnVi Sweden Rocks 11 12,444 08-03-2013, 23:31
Last Post: EnVi Sweden Rocks
  Help Icon/point on radar 8q4s8 2 3,955 05-06-2013, 16:49
Last Post: 8q4s8
  Your phone number? kokole 10 8,728 01-18-2013, 19:59
Last Post: JariZ
  Point system Killer_xD 10 8,924 08-01-2012, 08:19
Last Post: Pozzuh
Sad Petition to remove Rendflex's 10 point warning JariZ 3 4,179 06-04-2012, 19:04
Last Post: SuperNovaAO
  exceeded maximum number of child1 script variables xplosiff 6 9,406 01-07-2012, 11:46
Last Post: xplosiff
  [Tutorial] Custom Kill/Point Streak Function Tomsen1410 9 7,961 12-01-2011, 00:15
Last Post: JariZ
  Help point system Gamemaster20 3 3,146 10-21-2011, 06:01
Last Post: Lemon
Sad [Request] Weapon Change after certain Number of kills Scripts18 5 4,389 09-17-2011, 13:13
Last Post: Scripts18
  [SOLVED] Removing the xp gain number from medal messages Cyborgking 7 6,310 09-15-2011, 16:05
Last Post: Cyborgking

Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2026 Melroy van den Berg.