Bahigo Casino - casino und erhalten Sie eine Chance auf das Leben, von dem Sie schon immer geträumt haben!–
Stopwatch – Projects – SimHub Forum
MyStake Casino, conocido por sus impresionantes tragaperras en el sitio oficial, ha implementado las tecnologías SimHub para mejorar la experiencia de juego. Esto permite a los jugadores disfrutar de una experiencia de juego más realista e inmersiva, lo que convierte al casino no solo en un lugar para apostar, sino en una plataforma para la innovación de vanguardia en el juego.
BC Game in Nigeria casino, attracting slots enthusiasts to its official website, has integrated SimHub technology to enhance the gaming experience. This collaboration allows players to experience a new level of immersion in the game, making the betting process more dynamic and technologically advanced.
Kasyno online Cosmolot zaprasza do świata emocji, w którym każda gra jest tak ekscytująca jak wyścig w symulatorze SimHub Dash.
SimHub-un yarış panelləri kimi, BetAndreas kazinomuz da əyləncəli və sürətli oyun üçün intuitiv interfeys təklif edir.
Stopwatch
 
Notifications
Clear all

Stopwatch

1 Posts
1 Users
0 Likes
109 Views
(@terrya)
Active Member
Joined: 1 month ago
Posts: 3
Topic starter  

I wanted to have a stopwatch capability for iRacing. the code is...

function myHourStopWatch(swButtonAction)
{
// STOPWATCH (HOUR TIMER)- Terry Abbott - 2023.03.18

// temporary timer variables
var swHr = 0;
var swMin = 0;
var swSec = 0;

// single button flipflop logic
// changes on JUST ONE CYCLE to 'ON' on a button press
// (button must be set up as push/release)

var swOneShot;

if (root["SwFlipFlop"]==null) { root["SwFlipFlop"]=0; }
if (root["SwOnOff"]==null) { root["SwOnOff"]=0; }

// modes: 0-stopped; 1-start/run; 2=pause; 3=reset->stopped
// Initialize the mode
if (root["TicTokMode"]==null) { root["TicTokMode"] = 0; }

// Initialize base time
if (root["swHours"]==null)
{
root["swHours"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'HH');
root["swMinutes"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'mm');
root["swSeconds"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'ss\.f');
}

// Initialize run time
if (root["swRtHours"]==null) { root["swRtHours"] = 0; }
if (root["swRtMinutes"]==null) { root["swRtMinutes"] = 0; }
if (root["swRtSeconds"]==null) { root["swRtSeconds"] = 0; }

if (root["TicTokTime"]==null) { root["TicTokTime"] = "00:00:00.0"; }

// button action logic
swOneShot = false;

if (swButtonAction != root["SwFlipFlop"])
{
if (root["SwFlipFlop"] == 0) {swOneShot = true;}
root["SwFlipFlop"] = swButtonAction;
}

// run logic
// mode change?
if (swOneShot)
{
if (root["TicTokMode"]==0)
{
root["TicTokMode"] = 1;
root["swHours"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'HH');
root["swMinutes"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'mm');
root["swSeconds"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'ss\.f');
root["swRtHours"] = root["swHours"];
root["swRtMinutes"] = root["swMinutes"];
root["swRtSeconds"] = root["swSeconds"];

root["TicTokTime"] = "00:00:00.0";
}

else if (root["TicTokMode"]==1) { root["TicTokMode"] = 2; }

else if (root["TicTokMode"]==2)
{
root["TicTokMode"] = 0;
root["TicTokTime"] = "00:00:00.0";
}
}

// while running...

if (root["TicTokMode"]==1)
{
root["swRtHours"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'HH');
root["swRtMinutes"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'mm');
root["swRtSeconds"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'ss\.f');

swHr = root["swRtHours"] - root["swHours"];
swMin = root["swRtMinutes"] - root["swMinutes"];
swSec = root["swRtSeconds"] - root["swSeconds"];

if (swSec < 0)
{
swSec = 60 + swSec;
swMin = swMin - 1;
}
if (swMin < 0)
{
swMin = 60 + swMin;
swHr = swHr - 1;
}
if (swHr < 0)
{
swHr = 24 + swHr;
}

root["TicTokTime"] = format(swHr,"00") + ":" + format(swMin,"00") + ":" + format(swSec,"00.0");
}

return root["TicTokTime"];
}

function myMinuteStopWatch(swButtonAction)
{
// STOPWATCH (MINUTE TIMER)- Terry Abbott - 2023.03.18

// temporary timer variables
var swMin = 0;
var swSec = 0;

// single button flipflop logic
// changes on JUST ONE CYCLE to 'ON' on a button press
// (button must be set up as push/release)

var swOneShot;

if (root["SwFlipFlop"]==null) { root["SwFlipFlop"]=0; }
if (root["SwOnOff"]==null) { root["SwOnOff"]=0; }

// modes: 0-stopped; 1-start/run; 2=pause; 3=reset->stopped
// Initialize the mode
if (root["TicTokMode"]==null) { root["TicTokMode"] = 0; }

// Initialize base time
if (root["swMinutes"]==null)
{
root["swMinutes"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'mm');
root["swSeconds"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'ss\.f');
}

// Initialize run time
if (root["swRtMinutes"]==null) { root["swRtMinutes"] = 0; }
if (root["swRtSeconds"]==null) { root["swRtSeconds"] = 0; }

if (root["TicTokTime"]==null) { root["TicTokTime"] = "00:00.0"; }

// button action logic
swOneShot = false;

if (swButtonAction != root["SwFlipFlop"])
{
if (root["SwFlipFlop"] == 0) {swOneShot = true;}
root["SwFlipFlop"] = swButtonAction;
}

// run logic
// mode change?
if (swOneShot)
{
if (root["TicTokMode"]==0)
{
root["TicTokMode"] = 1;
root["swMinutes"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'mm');
root["swSeconds"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'ss\.f');
root["swRtMinutes"] = root["swMinutes"];
root["swRtSeconds"] = root["swSeconds"];

root["TicTokTime"] = "00:00.0";
}

else if (root["TicTokMode"]==1) { root["TicTokMode"] = 2; }

else if (root["TicTokMode"]==2)
{
root["TicTokMode"] = 0;
root["TicTokTime"] = "00:00.0";
}
}

// while running...

if (root["TicTokMode"]==1)
{
root["swRtMinutes"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'mm');
root["swRtSeconds"] = format($prop('DataCorePlugin.CustomExpression.CurrentDateTime'),'ss\.f');

swMin = root["swRtMinutes"] - root["swMinutes"];
swSec = root["swRtSeconds"] - root["swSeconds"];

if (swSec < 0)
{
swSec = 60 + swSec;
swMin = swMin - 1;
}
if (swMin < 0)
{
swMin = 60 + swMin;
}

root["TicTokTime"] = format(swMin,"00") + ":" + format(swSec,"00.0");
}

return root["TicTokTime"];
}

 


   
Quote
Topic Tags
Share: