Page 1 of 1

Remove the 10 seconds autoquit when playing alone

Posted: 06 Apr 2009, 01:46
by TradeMark
Could you please remove it? Its hard to notice when its loaded when you are doing something else at same time

Re: Remove the 10 seconds autoquit when playing alone

Posted: 06 Apr 2009, 01:53
by lurker
Isn't this forum for engine feature requests? Add a single line to the widget that gets the player count and submit to the mods that use it. Were you not aware it was a widget?

Re: Remove the 10 seconds autoquit when playing alone

Posted: 06 Apr 2009, 01:57
by Google_Frog

Code: Select all

----------------------------------------------------------------
-- global variables
----------------------------------------------------------------
local versionNumber = "v1.2"
local delay = 5
local endTime
local mx,my

----------------------------------------------------------------
-- speedups
----------------------------------------------------------------
local DiffTimers = Spring.DiffTimers
local GetTimer = Spring.GetTimer
local SendCommands = Spring.SendCommands
local Echo = Spring.Echo
local GetMouseState = Spring.GetMouseState

----------------------------------------------------------------
-- callins
----------------------------------------------------------------

function widget:GetInfo()
  return {
    name      = "Autoquit L",
    desc      = versionNumber .. " Automatically quits "..delay.."s after the game ends. Move mouse to cancel.",
    author    = "Evil4Zerggin & zwzsg",
    date      = "25 December 2008",
    license   = "GNU LGPL, v2.1 or later",
    layer     = 0,
    enabled   = true  --  loaded by default?
  }
end

function widget:Initialize()

  local plist = Spring.GetPlayerList()
  if (#plist == 1) then
    widgetHandler:RemoveWidget()
  end
  endTime = false
end

function widget:GameOver()
  endTime = GetTimer()
  mx,my = GetMouseState()
  Echo("<autoquit> Automatically exiting in " .. delay .. " seconds. Move mouse to cancel.")
end

function widget:Update(dt)
  if endTime then
    local nmx,nmy = GetMouseState()
    if nmx~=mx or nmy~=my then
      Echo("<autoquit> Autoquit canceled.")
      endTime = false
      -- widgetHandler:RemoveWidget()
    elseif DiffTimers(GetTimer(), endTime) > delay then
      Echo("<autoquit> Autoquit sending quit command.")
      SendCommands("quit")
    end
  end
end

Re: Remove the 10 seconds autoquit when playing alone

Posted: 06 Apr 2009, 02:32
by TradeMark
oh it was widget, i thought it was some new feature lol

Re: Remove the 10 seconds autoquit when playing alone

Posted: 07 Apr 2009, 18:22
by Forboding Angel
A new feature built into spring that jsut magically arrived when you downloaded a widget without needing to update spring?

Re: Remove the 10 seconds autoquit when playing alone

Posted: 07 Apr 2009, 18:29
by lurker
Why do you think he downloaded the widget?

You're telling me you notice the exact second a feature shows up?

Re: Remove the 10 seconds autoquit when playing alone

Posted: 07 Apr 2009, 18:32
by Forboding Angel
How else would he have gotten it? SD doesn't just auto DL widgets also I thought it was funny cause you would thing that the big AUTOQUIT in f11 and widgets dir would be a clue.

And mainly, because this thread made me laugh.

Re: Remove the 10 seconds autoquit when playing alone

Posted: 07 Apr 2009, 18:37
by TradeMark
i havent downloaded any widgets, perhaps its new BA feature

Re: Remove the 10 seconds autoquit when playing alone

Posted: 07 Apr 2009, 18:38
by lurker
The tiny 'autoquit' in the menu that is rarely used, and a widget that's probably in a mod file. Don't be so mocking.

Re: Remove the 10 seconds autoquit when playing alone

Posted: 07 Apr 2009, 23:23
by Forboding Angel
BA Changelog wrote:- Added Evil4Zerggin & zwzsg's autoquit widget (exits spring at game end if no mousemove after 10 seconds).