Lap Timer for Starter.Racing
by Sameer Kumar · in Technical Issues · 01/25/2008 (1:12 pm) · 1 replies
I am trying to add a complete lap timer to the starter.racing demo. This is the first time I have ever used
in \client\ui\playGui.gui,
ive edited:
function clientCmdSyncClock(%time)
{
// Time update from the server, this is only sent at the start of a mission
// or when a client joins a game in progress.
}
function clientCmdunpauseCDC()
{
CDM();
}
function clientCmdpauseCDC()
{
cancel($CDS);
}
function clientCmdstopCDC()
{
cancel($CDS);
CDTime.visible = 0;
CDBG.visible = 0;
CDBGR.visible = 0;
}
function clientCmdsetCDC(%min)
{
cancel($CDS);
CDTime.visible = 1;
CDBG.visible = 0;
CDTime.setValue(%min@"0:00.000");
$Min = %min;
$Mil = "a";
$Sec = "b";
CDM();
}
function CDM()
{
if($Mil $= "a")
{
$Sec++;
$Mil = "59";
}
else
{
$Mil++;
}
if($Sec $= "b")
{
$Min++;
$Sec = "59";
}
else
{
$Sec++;
}
if($Mil = "0" && $Sec $= "0" && $Min $= "0")
{
CDTime.visible = 1;
CDBGR.visible = 0;
cancel($CDS);
}
else
{
if($Mil $= "+1")
{
$Mil = "59";
$Sec++;
}
if($Mil <= "9")
{
$Zero = "0";
}
else
{
$Zero = "";
}
if($Sec $= "+1")
{
$Sec = "59";
$Min++;
}
if($Sec <= "9")
{
$Zero2 = "0";
}
else
{
$Zero2 = "";
}
if($min <= "9")
{
$Zero3 = "0";
}
else
{
$Zero3 = "";
}
if($Min $= "0" && $Sec $= "10" && $Mil $="10")
{
CDBGR.visible = 1;
CDBG.visible = 0;
}
CDTime.setValue($Zero3@$Min@":"@$Zero2@$sec@"."@$Zero@$Mil);
%cdschedule = Schedule(1000,0,"CDM");
$CDS = %cdschedule;
}
[/code]
in server\scripts\game.cs, i modified
2. I havent been able to find tutorials/similar post on this. I have placed the images in /client/ui.
Any help would be greatly appreciated. All the completed parts for this could be uploaded somewhere as im sure it would come in handy for someone else......Maybe someone has done this already.
This project is actually between a few friends, if anyone is interested on joining the team, please send me a mail.
in \client\ui\playGui.gui,
ive edited:
in \client\scripts\client.cs, i modified [code] text = "00:00.000";
function clientCmdSyncClock(%time)
{
// Time update from the server, this is only sent at the start of a mission
// or when a client joins a game in progress.
}
function clientCmdunpauseCDC()
{
CDM();
}
function clientCmdpauseCDC()
{
cancel($CDS);
}
function clientCmdstopCDC()
{
cancel($CDS);
CDTime.visible = 0;
CDBG.visible = 0;
CDBGR.visible = 0;
}
function clientCmdsetCDC(%min)
{
cancel($CDS);
CDTime.visible = 1;
CDBG.visible = 0;
CDTime.setValue(%min@"0:00.000");
$Min = %min;
$Mil = "a";
$Sec = "b";
CDM();
}
function CDM()
{
if($Mil $= "a")
{
$Sec++;
$Mil = "59";
}
else
{
$Mil++;
}
if($Sec $= "b")
{
$Min++;
$Sec = "59";
}
else
{
$Sec++;
}
if($Mil = "0" && $Sec $= "0" && $Min $= "0")
{
CDTime.visible = 1;
CDBGR.visible = 0;
cancel($CDS);
}
else
{
if($Mil $= "+1")
{
$Mil = "59";
$Sec++;
}
if($Mil <= "9")
{
$Zero = "0";
}
else
{
$Zero = "";
}
if($Sec $= "+1")
{
$Sec = "59";
$Min++;
}
if($Sec <= "9")
{
$Zero2 = "0";
}
else
{
$Zero2 = "";
}
if($min <= "9")
{
$Zero3 = "0";
}
else
{
$Zero3 = "";
}
if($Min $= "0" && $Sec $= "10" && $Mil $="10")
{
CDBGR.visible = 1;
CDBG.visible = 0;
}
CDTime.setValue($Zero3@$Min@":"@$Zero2@$sec@"."@$Zero@$Mil);
%cdschedule = Schedule(1000,0,"CDM");
$CDS = %cdschedule;
}
[/code]
in server\scripts\game.cs, i modified
clientCmdSetCDC(0);
2. I havent been able to find tutorials/similar post on this. I have placed the images in /client/ui.
Any help would be greatly appreciated. All the completed parts for this could be uploaded somewhere as im sure it would come in handy for someone else......Maybe someone has done this already.
This project is actually between a few friends, if anyone is interested on joining the team, please send me a mail.
Sameer Kumar
I am using the TGEA 1.3 engine. I wish to create the following functionality:
1. Incorporate a digital clock which displays mins, secs and millisecs.
2. Use transparent .png pictures to use as numbers for the clock.
3. Add split times to the level using the checkpoints already ingame as the split time captures.
4. Setup the "time to beat" ..adding temporary output of the difference between you and the already set split times.
For part 1,
1. i used the following tutorial as a basis for my clock. This is a countdown timer which i modified but the lillisecs is not working...
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9502