-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGear System 2.CEA
122 lines (98 loc) · 2.8 KB
/
Gear System 2.CEA
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{$lua}
[ENABLE]
local mul=1+3e-3
local gearMul=1.1
local rangeMultiplier=1.5
local Up=18
local Down=0
local div=0.85
local motion=1
local speedXString='X SPEED'
local speedYString='Y SPEED'
--Instructions
--mul is the speed by which the car will accelerate if the speed of the car is in range of (TempUp,TempDown)
--gearMul is the speed by which the car will be forced such that finally the speed of the car comes under the range of (TempUp,TempDown).Setting a higher value for gearMul will result in huge jerks but lower value for this will result in late input reaction.
--rangeMultiplier is the multiplier by which the range will be multiplied to calculate the new bottom and top speed.
--Up is the initial top speed
-- Down is the initial bottom speed
--div is the speed for bigger brakes.If however you want to slow down just change to a lower gear
--motion is the threshold for the speed of the car so that script may start to work normally.
--Gear is increased by W and decreased by S
local TempUp=Up
local TempDown=Down
function adjustSpeed(x,y,tempUp,tempDown)
r=((x.Value^2)+(y.Value^2))^0.5
if r<tempDown then
if r*gearMul<=tempDown then
x.Value=x.Value*gearMul
y.Value=y.Value*gearMul
else
ratio=tempDown/r
x.Value=x.Value*ratio
y.Value=y.Value*ratio
end
elseif r>=tempDown and r<tempUp then
if r*mul<=tempUp then
x.Value=x.Value*mul
y.Value=y.Value*mul
else
ratio=tempUp/r
x.Value=x.Value*ratio
y.Value=y.Value*ratio
end
else
if r/gearMul>tempUp then
x.Value=x.Value/gearMul
y.Value=y.Value/gearMul
else
ratio=tempUp/r
x.Value=x.Value*ratio
y.Value=y.Value*ratio
end
end
end
hk1=createHotkey(function()
t=getAddressList()
x=t.getMemoryRecordByDescription(speedXString)
y=t.getMemoryRecordByDescription(speedYString)
adjustSpeed(x,y,TempUp,TempDown)
end,0x26)
hk2=createHotkey(function()
x=getAddressList().getMemoryRecordByDescription(speedXString)
y=getAddressList().getMemoryRecordByDescription(speedYString)
x.Value=x.Value*div
y.Value=y.Value*div
end,0x28)
hk3=createHotkey(function()
TempDown=TempUp
TempUp=TempUp*rangeMultiplier
t=getAddressList()
x=t.getMemoryRecordByDescription(speedXString)
y=t.getMemoryRecordByDescription(speedYString)
adjustSpeed(x,y,TempUp,TempDown)
speak('Gear Up')
end,0x57)
hk6=createHotkey(function()
TempUp=TempDown
TempDown=TempDown/rangeMultiplier
t=getAddressList()
x=t.getMemoryRecordByDescription(speedXString)
y=t.getMemoryRecordByDescription(speedYString)
adjustSpeed(x,y,TempUp,TempDown)
speak('Gear Down')
end,0x53)
hk7=createHotkey(function()
TempUp=Up
TempDown=Down
t=getAddressList()
x=t.getMemoryRecordByDescription(speedXString)
y=t.getMemoryRecordByDescription(speedYString)
adjustSpeed(x,y,TempUp,TempDown)
speak('Reset')
end,0x52)
[DISABLE]
hk1.destroy()
hk2.destroy()
hk3.destroy()
hk6.destroy()
hk7.destroy()