Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-28-2006, 11:47 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Square root

Simple question, is there square root (built-in) in gscript?
__________________
Reply With Quote
  #2  
Old 11-29-2006, 12:02 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
x^.5 is the same thing.
Reply With Quote
  #3  
Old 11-30-2006, 02:38 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Yen View Post
x^.5 is the same thing.
Thanks, was hoping for a built-in one tho, but that will work
__________________
Reply With Quote
  #4  
Old 11-30-2006, 03:29 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Quote:
Originally Posted by Chompy View Post
Thanks, was hoping for a built-in one tho, but that will work
You could create a public function squareRoot( v) return v ^ 0.5;
xP
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #5  
Old 11-30-2006, 03:31 PM
_Z3phyr_ _Z3phyr_ is offline
Banned
Join Date: Sep 2003
Location: Louisiane
Posts: 390
_Z3phyr_ is an unknown quantity at this point
I thought that sqrt(val) worked as well? Or am I soo 5 years ago or something
Reply With Quote
  #6  
Old 11-30-2006, 04:09 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by contiga View Post
You could create a public function squareRoot( v) return v ^ 0.5;
xP
maybe I will

Quote:
Originally Posted by _Z3phyr_ View Post
I thought that sqrt(val) worked as well? Or am I soo 5 years ago or something
Didn't work, but I know that sqrt(float) works in some other script languages like C I think
__________________
Reply With Quote
  #7  
Old 11-30-2006, 04:14 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Chompy View Post
Didn't work, but I know that sqrt(float) works in some other script languages like C I think
C isn't a 'script language', and it only works because there is a library that implemented it.

PHP Code:
#include <math.h>
double sqrt(double); 
or something like that.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #8  
Old 11-30-2006, 04:25 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by ApothiX View Post
C isn't a 'script language', and it only works because there is a library that implemented it.

PHP Code:
#include <math.h>
double sqrt(double); 
or something like that.
oh, didn't know that Well, thanks guys, I'll now start working on something I needed square root for
__________________
Reply With Quote
  #9  
Old 12-01-2006, 12:15 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Massokre's Interesting Fact of the Day:
The ENIAC, a computer that was used in the design of the hydrogen bomb, had a divider/square-rooter built into it's hardware. It could perform 40 divides per second or 3 square roots per second.
Reply With Quote
  #10  
Old 12-01-2006, 12:19 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by jake13jake View Post
Massokre's Interesting Fact of the Day:
The ENIAC, a computer that was used in the design of the hydrogen bomb, had a divider/square-rooter built into it's hardware. It could perform 40 divides per second or 3 square roots per second.
:O I didn't know that for sure

Nice, now Stefan can find this computer and connect it too graal?
Did you make the bomb?
__________________
Reply With Quote
  #11  
Old 12-01-2006, 12:34 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Square root is done by x^0.5, which is actually internally converted into a sqrt() C call for best speed
Reply With Quote
  #12  
Old 12-01-2006, 12:38 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Stefan View Post
Square root is done by x^0.5, which is actually internally converted into a sqrt() C call for best speed
:O so x^0.5 equal to sqrt(x)? nice
__________________
Reply With Quote
  #13  
Old 12-01-2006, 01:38 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
*wants his xor operator back* :-(

I'd even be willing to write the program that would convert everyone's nw files and scripts from

a^b to pow(a,b),
a^=b to a=pow(a,b)
and,
a xor b to a^b
Reply With Quote
  #14  
Old 12-01-2006, 04:36 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by jake13jake View Post
*wants his xor operator back* :-(

I'd even be willing to write the program that would convert everyone's nw files and scripts from

a^b to pow(a,b),
a^=b to a=pow(a,b)
and,
a xor b to a^b
How I use Xor, is this >_>

PHP Code:
function onCreated() {
 
var1 "foo";
 
var2 "bar";
 echo(
var1 xor var2 0); // would return true
}
/*
   True  = Not alike
   False = Alike
*/ 
__________________
Reply With Quote
  #15  
Old 12-02-2006, 03:11 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Chompy View Post
How I use Xor, is this >_>

PHP Code:
function onCreated() {
 
var1 "foo";
 
var2 "bar";
 echo(
var1 xor var2 0); // would return true
}
/*
   True  = Not alike
   False = Alike
*/ 
X_x.. Why are you using xor on strings? That's not how it works :x
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:26 PM.


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