hi otlander's i have a cam recoder script i would like to know if there is anyway to Save the clip in a new folder inside otclient location? because this script Works with php website but i dont have that, now im asking for a solution to Save the clip like tibianic dll does but in otclient =)
Code:
recorderWindow = nil
isRecording = false
recordingPaused = false
local timeElapsed = 0
recordingEvent = nil
stopRecordBox = nil
errorBox = nil
function init()
connect(g_game, {
onGameStart = online,
onGameEnd = offline
})
recorderWindow = g_ui.displayUI('recorder')
recorderWindow:setVisible(false)
nameLabel = recorderWindow:recursiveGetChildById('nameLabel')
statusLabel = recorderWindow:recursiveGetChildById('statusLabel')
end
function toggle()
if recorderWindow:isVisible() then
recorderWindow:setVisible(false)
else
recorderWindow:setVisible(true)
end
end
function startRecording()
local OkFunc = function() errorBox:destroy() errorBox = nil end
if G.proxy == "Player" then
if not errorBox then
errorBox = displayGeneralBox(tr('Cam Recorder - Error'), tr("You cannot record replays."), {{ text=tr('Ok'), callback=OkFunc }, anchor=AnchorHorizontalCenter }, OkFunc)
end
return false
end
if modules.game_interface:isCastSpectactor() then
if not errorBox then
errorBox = displayGeneralBox(tr('Cam Recorder - Info'), tr("You are recording cast stream, this cam goes to public list automatically without password."), {{ text=tr('Ok'), callback=OkFunc }, anchor=AnchorHorizontalCenter }, OkFunc)
end
end
if not isRecording or recordingPaused then
isRecording = true
statusLabel:setColor("red")
removeEvent(recordingEvent)
statusLabel:setText("Recording ... " .. secondsToClock(timeElapsed))
recordingEvent = cycleEvent(function()
timeElapsed = timeElapsed + 1
statusLabel:setText("Recording ... " .. secondsToClock(timeElapsed))
end, 1000)
modules.game_interface.recordingLabel:setColor("red")
modules.game_interface.recordingLabel:setVisible(true)
recordingPaused = false
g_game.setPlayerRecording(1)
end
end
function stopRecording()
if isRecording then
statusLabel:setColor("gray")
statusLabel:setText("OFF")
modules.game_interface.recordingLabel:setVisible(false)
local OkFunc = function() stopRecordBox:destroy() stopRecordBox = nil end
if timeElapsed >= 10 then
stopRecordBox = displayGeneralBox(tr('Cam Recorder - Info'), tr("Cam Recorder stoped! Login account on the website to manage your records."), {{ text=tr('Ok'), callback=OkFunc }, anchor=AnchorHorizontalCenter }, OkFunc)
else
stopRecordBox = displayGeneralBox(tr('Cam Recorder - Error'), tr("The recording could not be saved because time elapsed is less than 10 seconds."), {{ text=tr('Ok'), callback=OkFunc }, anchor=AnchorHorizontalCenter }, OkFunc)
end
removeEvent(recordingEvent)
timeElapsed = 0
isRecording = false
recordingPaused = false
g_game.setPlayerRecording(0)
end
end
function pauseRecording()
if isRecording and not recordingPaused then
statusLabel:setColor("yellow")
statusLabel:setText("Paused. " .. secondsToClock(timeElapsed))
modules.game_interface.recordingLabel:setText("Paused")
modules.game_interface.recordingLabel:setColor("yellow")
removeEvent(recordingEvent)
recordingPaused = true
g_game.pausePlayerRecording(1)
end
end
function getRecording()
return isRecording
end
function goMyAccount()
g_platform.openUrl("www.classicot.com/myaccount.php")
end
function goPublicCams()
g_platform.openUrl("www.classicot.com/replays.php")
end
function secondsToClock(seconds)
local seconds = tonumber(seconds)
if seconds <= 0 then
return "00:00:00";
else
hours = string.format("%02.f", math.floor(seconds/3600));
mins = string.format("%02.f", math.floor(seconds/60 - (hours*60)));
secs = string.format("%02.f", math.floor(seconds - hours*3600 - mins *60));
return hours..":"..mins..":"..secs
end
end
function terminate()
disconnect(g_game, {
onGameStart = online,
onGameEnd = offline
})
recorderWindow:destroy()
end
function offline()
stopRecording()
end
function online()
nameLabel:setText(g_game.getLocalPlayer():getName())
end
function onMiniWindowClose()
addEvent(function()
recorderWindow:open()
end)
end
Last edited: