Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-08-2008, 03:16 AM
Robin Robin is offline
The secret of NIMH
Robin's Avatar
Join Date: Apr 2005
Location: Wales, UK
Posts: 515
Robin will become famous soon enough
Send a message via AIM to Robin
Useful functions

Some general useful functions in GS2 (Some of them are for compatibility with JS/PHP/etc others are just good)
PHP Code:
function rand() {
  return new 
MRandomLCG().randFloat();
}
function 
tan(x) {
  return 
sin(x)/cos(x);
}
function 
atan2(y,x) {
  return 
x<>0?x>0?atan(y/x):atan(y/x)-radian(180):y>0?radian(90):radian(-90);
}
function 
atan(number) {
  return 
arctan(number);
}
function 
floor(number) {
  return 
int(number);
}
function 
ceil(number) {
  return 
int(number) < number number number;
}
function 
radian(degree) {
    return (
degree 0.0174532925);

function 
degree(radian) {
    return (
radian 57.2957795);

function 
square(n) {
    return (
n);

function 
norm(angle) {
    return (
angle 6.283185 floor((angle pi) / 6.283185));

function 
tile(pixel) {
    return (
pixel 16);

function 
pixel(tile) {
    return (
tile 16);

Enjoy
__________________


Last edited by Robin; 05-08-2008 at 04:53 AM.. Reason: Updated to reflect awesomeness.
Reply With Quote
 


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 07:26 PM.


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