Virtual Channel help please

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
ross2004
Posts: 24
Joined: Mon Sep 18, 2017 3:58 pm
Location: Staunton, VA

Virtual Channel help please

Post by ross2004 »

I'm trying to create a virtual channel called "StintTime" to serve as a driver stint timer. I'm attempting to pull the getUptime() command to pull the time the unit has been powered up (divided by 60,000 to convert to minutes). This is my first time I've tried creating a Virtual Channel so naturally I'm screwing it up. Does anyone have an idea what the trouble may be? RCP3 on 2.14.0

timerId = addChannel(“StintTime”,1,0,0,250,”min”)

function drivetime()
local time = getUptime()/60000
setChannel(timerId, time)
end

setTickRate(30)
function onTick()
drivetime()
end

[lua] Startup script error: ([string "timerId = addChannel( 201cStintTime 201d,1,0,0,250, 201dmin 201..."]:1.0: malformed number near '201cStintTime')
[lua] Failure: Failed to load script

BigLobsterDude
Posts: 17
Joined: Sun Dec 27, 2015 12:55 am
Location: Freehold, NJ

Post by BigLobsterDude »

Check the double quote characters used around "Stint Time". I notice that that its different than than the quotes around "min". Might just be a posting anomaly, but I suspect your first quote character is not correct.
John
Schumacher Taxi #189

ross2004
Posts: 24
Joined: Mon Sep 18, 2017 3:58 pm
Location: Staunton, VA

Post by ross2004 »

Bravo sir! Thank you very much, somewhere along the way I assume copy/pasting back and forth from the Notes app the quotes got messed up. Now it's working perfectly. Thanks again!

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Tip, you could connect a GPIO to reset the stint timer. You could do it in such a way that a button press resets the count to 0.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

ross2004
Posts: 24
Joined: Mon Sep 18, 2017 3:58 pm
Location: Staunton, VA

Post by ross2004 »

True, but we power cycle the RCP at every pit stop, so that will serve us.

Post Reply