Page 1 of 1

Insert Command Widget

Posted: 19 Jun 2008, 18:39
by stilicho
I really liked this widget that was written by Tim-the-maniac. Does anyone still have it? I can't find it on any of the download sites.

Re: Insert Command Widget

Posted: 19 Jun 2008, 20:51
by fischkopf01
:idea:

i dont know the widget by tim-the-maniac but i use this kool widget by jK to insert commands

just create empty lua file and insert this:

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

function widget:GetInfo()
return {
name = "FrontInsert",
desc = "Allows to use the meta key to insert any command at the front of the command queue",
author = "jK",
date = "Jan,2008",
license = "GNU GPL, v2 or later",
layer = 5,
enabled = true
}
end

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

function widget:CommandNotify(id, params, options)
local _,_,meta,_ = Spring.GetModKeyState()
if (meta) then
local opt = 0
if options.alt then opt = opt + CMD.OPT_ALT end
if options.ctrl then opt = opt + CMD.OPT_CTRL end
if options.shift then opt = opt + CMD.OPT_SHIFT end
if options.right then opt = opt + CMD.OPT_RIGHT end

Spring.GiveOrder(CMD.INSERT,{0,id,opt,unpack(params)},{"alt"})
return true
end
return false
end


and put the lua in ur ...\Spring\LuaUI\Widgets folder

then u just have to put this line in ur ...\Spring\uikeys.txt

"fakemeta 0x020"

to make ur spacebar the insert key

8)

Re: Insert Command Widget

Posted: 19 Jun 2008, 21:52
by stilicho
Awesome, thanks!

Re: Insert Command Widget

Posted: 19 Jun 2008, 22:44
by Hoi
fischkopf01 wrote::idea:

i dont know the widget by tim-the-maniac but i use this kool widget by jK to insert commands

just create empty lua file and insert this:

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

function widget:GetInfo()
return {
name = "FrontInsert",
desc = "Allows to use the meta key to insert any command at the front of the command queue",
author = "jK",
date = "Jan,2008",
license = "GNU GPL, v2 or later",
layer = 5,
enabled = true
}
end

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

function widget:CommandNotify(id, params, options)
local _,_,meta,_ = Spring.GetModKeyState()
if (meta) then
local opt = 0
if options.alt then opt = opt + CMD.OPT_ALT end
if options.ctrl then opt = opt + CMD.OPT_CTRL end
if options.shift then opt = opt + CMD.OPT_SHIFT end
if options.right then opt = opt + CMD.OPT_RIGHT end

Spring.GiveOrder(CMD.INSERT,{0,id,opt,unpack(params)},{"alt"})
return true
end
return false
end


and put the lua in ur ...\Spring\LuaUI\Widgets folder

then u just have to put this line in ur ...\Spring\uikeys.txt

"fakemeta 0x020"

to make ur spacebar the insert key

8)
what does it do?

Re: Insert Command Widget

Posted: 31 Jul 2008, 17:23
by FrOzEnTaCo
lol how do u create a empty lua file? thats all i need to know. :?:

Re: Insert Command Widget

Posted: 31 Jul 2008, 17:36
by dizekat
FrOzEnTaCo wrote:lol how do u create a empty lua file? thats all i need to know. :?:
save as something.lua with text editor (notepad or whatever).

Also, use (my widget in other thread) instead. It does more stuff.