Booda Sack
Sphere Master
- 300
- Posts
- 20
- Years
- Age 38
- Ireland
- Seen Jul 30, 2007
Here is a text script which you will need to display the clock time or any text.
Usage of the text script would be something like:
Here is another simple but very useful script.
Clock:
To put the time to the screen you would do:
Or you could do,there is no need for the hour,min secns variable:
But I just find its easier to type the first one.
Code:
function Text(str,x,y)//str is the text you want to print
{
var myfont = LoadFont("epokefont.rfn");
var windowstyle = LoadWindowStyle("bluewhite.rws");
var x = x;
var y = y;
var width = GetScreenWidth()-32;
var height = myfont.getStringHeight(str, width);
while (!IsKeyPressed(KEY_CTRL))//shows text untill you press CTRL
{
if (IsMapEngineRunning())
RenderMap();
windowstyle.drawWindow(x, y, widht, height);
myfont.drawTextBox(x, y, width, height, 0, str);
FlipScreen();
}
}
Code:
Text("Sphere Text Script",10,10);
Here is another simple but very useful script.
Clock:
Code:
var time //Store the time object
var hours //Store the hours part of the time object
var mins //Store the minuets part of the time object
var secns//Store the second part of the time object
function thetime(){
time = new Date()
hours = time.getHours()
mins = time.getMinutes()
secns = time.getSeconds()
}
Code:
thetime()//Update the time variables
Text("The time is:"+hours+":"+mins+":"+secns,20,20);
Or you could do,there is no need for the hour,min secns variable:
Code:
thetime()//Update the time variables
Text("The time is:"+time.getHours()+":"+time.getMinutes()+":"+time.getSeconds(),20,20);
But I just find its easier to type the first one.