HTML-Code:
function Camera1(
{Target = Logic.GetStoreHouse(2),
OffsetX = 0,
OffsetY = -1000,
Duration = 15,
ZoomFactor = 0.35,
RotationAngle = 0,
MayRotate = 0,
Title = "Der Basar",
TitleColor = "64, 0, 255",
TitleAlpha = 128,
Text = "Ah alle Interessenten sind anwesend...sehr schön",
TextColor = "255, 255, 255",
TextAlpha = 255,
Bars = "black",
MiniMap = 0,
MiniMapMarker = 0})
end
function UserSetCamera(Param)
assert(Param.Target)
local id,x,y = 0
if type(Param.Target) == "number" then
Param.x,Param.y = Logic.GetEntityPosition(Param.Target)
Param.ID = Param.Target
elseif type(Param.Target) == "string" then
Param.x,Param.y = Logic.GetEntityPosition(Logic.GetEntityIDByName(Param.Target))
Param.ID = Logic.GetEntityIDByName(Param.Target)
elseif type(Param.Target) == "table" then
Param.x = Param.Target[1]
Param.y = Param.Target[2]
Param.ID = Logic.GetEntityAtPosition(Param.Target[1], Param.Target[2])
end
if not Param.ID then Param.ID = 0 end
if type(Param.OffsetX) ~= "number" then Param.OffsetX = 0 end
if type(Param.OffsetY) ~= "number" then Param.OffsetY = 0 end
if not Param.Duration or Param.Duration > 30 or Param.Duration < 5 then
Param.Duration = 5
end
if not Param.ZoomFactor or Param.ZoomFactor > 0.5 or Param.ZoomFactor < 0.05 then
Param.ZoomFactor = 0.5
end
if not Param.RotationAngle or Param.RotationAngle > 180 or Param.RotationAngle < -180 then
Param.RotationAngle = -45
end
if type(Param.MayRotate) ~= "number" or Param.MayRotate ~= 0 or Param.MayRotate ~= 1 then
Param.MayRotate = 1
end
if not Param.Title or type(Param.Title) ~= "string" then
Param.Title = ""
else
Param.Title = Umlaute(Param.Title)
end
if not Param.TitleColor or type(Param.TitleColor) ~= "string" then
Param.TitleColor = "255, 255, 255"
end
if not Param.TitleAlpha or type(Param.TitleAlpha) ~= "number" then
Param.TitleAlpha = 255
end
if not Param.Text or type(Param.Text) ~= "string" then
Param.Text = ""
else
Param.Text = Umlaute(Param.Text)
end
if not Param.TextColor or type(Param.TextColor) ~= "string" then
Param.TextColor = "255, 255, 255"
end
if not Param.TextAlpha or type(Param.TextAlpha) ~= "number" then
Param.TextAlpha = 255
end
if not Param.Bars or type(Param.Bars) ~= "string" or Param.Bars ~= "black" and Param.Bars ~= "transp" then
Param.Bars = "none"
end
if not Param.MiniMap or type(Param.MiniMap) ~= "number" then
Param.MiniMap = 0
end
if not Param.MiniMapMarker or type(Param.MiniMapMarker) ~= "number" then
Param.MiniMapMarker = 1
end
Logic.ExecuteInLuaLocalState("SetLookAt("..Param.ID..", "..Param.x..", "..Param.y..", "..Param.OffsetX..", "..Param.OffsetY..", "..Param.Duration..", "..Param.ZoomFactor..", "..Param.RotationAngle..", ".. Param.MayRotate..", '"..Param.Title.."', '"..Param.TitleColor.."', "..Param.TitleAlpha..", '"..Param.Text.."', '"..Param.TextColor.."', "..Param.TextAlpha..", '"..Param.Bars.."', "..Param.MiniMap..", "..Param.MiniMapMarker..")")
end
function Umlaute(_text)
local texttype = type(_text);
if texttype == "string" then
_text = string.gsub( _text, "ä", "\195\164" );
_text = string.gsub( _text, "ö", "\195\182" );
_text = string.gsub( _text, "ü", "\195\188" );
_text = string.gsub( _text, "ß", "\195\159" );
_text = string.gsub( _text, "Ä", "\195\132" );
_text = string.gsub( _text, "Ö", "\195\150" );
_text = string.gsub( _text, "Ü", "\195\156" );
return _text;
elseif texttype == "table" then
for k, v in _text do
_text[k] = Umlaute( v );
end
end
end
Tausend Dank
Lesezeichen