PDA

View Full Version : Scripting Items


donno
2006-10-02, 13:36
Intro
Vortex Presets uses a scripting library known as AngelScript. The Scripting language follows the same/similar syntax to C/C++. Here is a list of things that might be useful to know. I might post this on the Wiki Later on. Just thought this forums looking bare. Hopefully some more infomation can be given later like examples, samples, explanations on how stuff actually works. For now this list is here just so you know.

Supported Data Types

float
int
bool
Texture
Map
VoicePrint
Tunnel


List of Global Defined Constants
const int PRIM_POINTLIST = 1;
const int PRIM_LINELIST = 2;
const int PRIM_LINELOOP = 3;
const int PRIM_LINESTRIP = 4;
const int PRIM_TRIANGLELIST = 5;
const int PRIM_TRIANGLESTRIP = 6;
const int PRIM_TRIANGLEFAN = 7;
const int PRIM_QUADLIST = 8;
const int PRIM_QUADSTRIP = 9;
const int TEXTURE_FRAMEBUFFER = 1;
const int TEXTURE_NEXTPRESET = 2;
const int TEXTURE_CURRPRESET = 3;
const int TEXTURE_ALBUMART = 4;
const int NULL = 0;
const int BLEND_OFF = 0;
const int BLEND_ADD = 1;
const int BLEND_MOD = 2;
const int BLEND_MAX = 3;
const int FILLMODE_SOLID = 0;
const int FILLMODE_WIREFRAME = 1;

Global Vortex Variables

TREBLE
MIDDLE
BASS
TIMEPASS
FINISHED (Set by User)

As you guess you can use these to base your animations/movement/position/size etc on what the auto is like


Operators and Math
+ Addition (5+3 will give 8)
- Subtraction (5-3 will give 2)
* Multiplcation (2*4 will give 8)
= Equality (left side will be made same as right side)
+= (same as left = left + right
-= (same as left = left - right)
Cos(x) Cosine of x in radians
Sin(x) Sine of x in radians
Rand() Chooses a random float from 0 to 1. [Not sure how many decial places]
Rand()*10 Chooses a random float from 0 to 10 [Still not sure how many decimal places]
Pow(a,x) a to the power of x (I think :D)
Fabs(a) makes float a an absolute value

Vortex Functions
I got no idea exactly how these works i just found them in the inlucded presets.
a,b,c,d,e,[f] for showing variables in the function argument,


gfxSetTexture(Texture Type);
gfxSetRenderTarget(Texture Type); (also gfxSetRenderTarget(Map Type)
gfxSetEnvTexture(Texture Type);
gfxTranslate(a, b, c);
gfxRotate(a,b,c,d);
gfxColour(a, b, c, d);
gfxCube(a,b, c, d,e,[f]); (Using f coz I use f for something else)
gfxTexCoord(a,b);
gfxVertex(x,y,s);
gfxSetBlendMode(BLEND_ADD);
gfxBegin(PRIM_QUADLIST);
gfxEnd();
gfxPushMatrix();
gfxPopMatrix();
gfxClear(0);
gfxSetAspect(0);
gfxTexRect(-1, 1, 1, -1);
gfxLookAt(Cos(tn*1.23)*5,Sin(tn)*5,(tm*2)-1,Cos(tn*0.6734)*2,Sin(tn*0.2143)*2,(tm*2)+8,0,1,0 );

MrC
2006-10-02, 21:45
Math Functions
float Rand() - returns a random number between 0 and 1
float Sin(float x) - returns the sine of x (x in radians)
float Cos(float x) - - returns the cosine of x (x in radians)
float Mag(float x, float y) - returns the magnitude of x and y ( same as sqrt(x*x + y*y) )
float Clamp(float x, float min, float max) - returns x after clamping it to the min and max values
float Fabs(float x ) - returns the absolute value of x
int Abs(int x) - returns the absolute value of x
float Atan2(float x, float y) - returns the arctangent of x and y
float Pow(float x, float y) - returns x raised to the power y
float Sqrt(float x) - returns the square root of x

morte0815
2006-10-03, 20:31
Some additions:

General:
the coordinatesystem is left-handed: x,y in screenplane z into the screen.

Primitives:

if you use PRIM_QUADLIST, the vertices have to be ordered clockwise, otherwise the texture on top is mirrored.

1----2
| |
4----3