Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Current_rotation = input.getNumber(2)
Input_rotation = input.getNumber(3)
Reload_input = input.getBool(4)
if Reload_input then
local target = math.floor(Current_rotation + 0.5)
local diff = target - Current_rotation
if math.abs(diff) > 0.01 then
local speed = math.min(math.max(math.abs(diff)*10,0.1), 1)
output.setNumber(1, (diff > 0.01) and speed or -speed)
else
output.setNumber(1, 0)
end
else
output.setNumber(1, Input_rotation)
end
end
Here's some fixes, and improvements just so it autocorrects to position stabely.
You seem to either be familiar with a different language, or have no prior experience, as lua uses 'then' following every 'elseif' / 'if' statement, with nothing following 'else'. Also, an 'end' is required to follow the last 'if' / 'elseif' statement that there is.
Goodluck on the rest of your creation! (Just realized this was a 2024 discussion, hope it still helps!)