vScript
By: Tim - August 3, 2006
One of vSig's major goals is to allow its users to customize. Everything we can think of is customizable. We believe that vScript is the ultimate way to customize your vSig. It allows you to control your vSig and actually add new features. Never before has this been done (at least not that we know of).
Prerequisite: A basic knowledge of PHP programming (really neccesary - vScript has almost the exact same syntax as PHP; we won't teach it over again!)
vScript has the same syntax as PHP, with a few exceptions for security and ease-of-use reasons:
- • There are no opening and closing tags to vScript (<?php, ?>)
- • vScript does not support any loops (e.g. while, for, foreach...)
- • vScript has no object oriented programming features
- • vScript is limited and custom - only functions and features that the vSig team feels neccesary are included.
At the moment, vScript functions are very limited - only functions that we could see needed were added. We would like to ask you a very big favor - if you need a function (from PHP, or a custom function from us), please request it in the forums to vScript can be improved.
Let's throw you an example script:
if(rand(1,2) == 1)
{
// a winner; random came out to 1.
setWidgetValue("You had a 50% chance of winning... and you've won!");
}
else
{
// not a winner; random came out to 2.
setWidgetValue("You've lost... try again later.");
}
This should be easy to see - the script calls a function, rand, and either any number 1 through 2 is returned (our random function only returns integers, so that's 1 or 2). If it comes out to 1, we set the widget (element) that called our script's value to a message that says we won; otherwise we say "you lost". Simple enough? If you know PHP, this should be a breeze (we made sure of that!). All you need to know about is supported functions. That list should do!
If you need more help, are confused, or otherwise want to know something, just ask on the forums! Really!