summaryrefslogtreecommitdiff
path: root/scripts/gugus/session.lua
blob: 25f8a71657427e585f7d6414e304c7734a25bb9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

require("scripts/gugus/sector")

function custom_enterSessionEvent(devType)

	mOldSector = -1
	local laps = GetContextInfo("laps")
	local sector = GetCarInfo("sector")
	if laps <= 1 then
		mLastSectors = {0.0, 0.0, 0.0}
		mBestSectors = {0.0, 0.0, 0.0}
	end

	-- type your custom script on session start, here
	print ()
	print (              "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv")
	print (string.format("simu   : %s",GetContextInfo("simulation")))
	print (string.format("car    : %s",GetContextInfo("carname")))
	print (string.format("track  : %s",GetContextInfo("trackname")))
	--print (string.format("session: %s",GetContextInfo("session")))
	print ()
	if GetContextInfo("ospcustom") then print ("has ospcustom") end

	print (string.format("shiftlightsmethod: %s",GetContextInfo("shiftlightsmethod")))
	print (string.format("ospmethod        : %s",GetContextInfo("ospmethod")))
	print (string.format("speedlimitemethod: %s",GetContextInfo("speedlimitermethod")))
	return 2
end

function global_custom_exitSessionEvent(devType)
	-- type your custom script on session ending, here
	if GetContextInfo("ospcustom") then print ("has ospcustom") end
	print ()
	print (string.format("shiftlightsmethod: %s",GetContextInfo("shiftlightsmethod")))
	print (string.format("ospmethod        : %s",GetContextInfo("ospmethod")))
	print (string.format("speedlimitemethod: %s",GetContextInfo("speedlimitermethod")))
	print (              "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
	print ()

	--my_setups=io.open("gus_cars.cfg", "a")
	--my_setups:write(GetContextInfo("carname"), " shiftligts ", GetContextInfo("shiftlightsmethod"), "\n")
	--my_setups:write(GetContextInfo("carname"), " speedlimiter ", GetContextInfo("speedlimitermethod"), "\n")
	--my_setups:close()

	return 2
end

print ( "gugus> + enter exit" )