GE Lua Documentation

Press F to search!

doScreenshot

Definition


-- @/lua/ge/screenshot.lua:50

local function doScreenshot(batchTag, upload, path, ext)
  -- find the next available screenshot filename
  local counter = 0

  local finalPath, format, filepath, filename
  if path and ext then
    finalPath = path
    format = ext
    upload = nil
    batchTag = nil
  else
    format = settings.getValue("screenshotFormat")

    filename = ''
    local filename_without_ext = ''
    filepath = ''
    local screenPath = screenshotPath .. tostring(getScreenShotFolderString())
    if not FS:directoryExists(screenPath) then
      FS:directoryCreate(screenPath)
    end
    repeat
      filename_without_ext = 'screenshot_' .. tostring(getScreenShotDateTimeString())
      if counter > 0 then
        filename_without_ext = filename_without_ext .. '_' .. tostring(counter)
      end
      filename = filename_without_ext .. '.' ..format
      filepath = screenPath .. '/' .. filename
      counter = counter + 1
    until not FS:fileExists(filepath)
    finalPath = screenPath .. '/' .. filename_without_ext
  end

   -- TODO: fix metadata to include level, vehicles, etc


  createScreenshot(finalPath, format, 1, 1, 0, false, upload, getMetadataJson())
end

Callers

@/lua/ge/screenshot.lua
  end
  doScreenshot(batchTag, true)
end
@/ui/modules/photomode/photomode.js
  vm.takePic = function() {
    vm.doScreenshot()
  }
@/lua/ge/extensions/core/vehicle/partmgmt.lua
  local screenshotName = (playerVehicle.vehicleDirectory .. fn)
  screenshot.doScreenshot(nil, nil, screenshotName, 'jpg')
  -- Stage 3 on JS side
@/lua/ge/extensions/gameplay/drag/general.lua
  local dir = "screenshots/timeslips/"..getScreenShotDateTimeString()
  screenshot.doScreenshot(nil, nil, dir,'jpg')
  ui_message("Timeslip saved: " .. dir .. ".jpg", nil, nil, "save")
@/ui/ui-vue/mockdata/inputBindings.js
                "actionMap": "Global",
                "onDown": "screenshot.doScreenshot()",
                "order": 12,