Insert Command Widget

Insert Command Widget

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
stilicho
Posts: 46
Joined: 21 Mar 2007, 02:49

Insert Command Widget

Post 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.
fischkopf01
Posts: 22
Joined: 04 Jun 2008, 15:48

Re: Insert Command Widget

Post 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)
User avatar
stilicho
Posts: 46
Joined: 21 Mar 2007, 02:49

Re: Insert Command Widget

Post by stilicho »

Awesome, thanks!
User avatar
Hoi
Posts: 2917
Joined: 13 May 2008, 16:51

Re: Insert Command Widget

Post 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?
User avatar
FrOzEnTaCo
Posts: 81
Joined: 02 Jul 2008, 05:52

Re: Insert Command Widget

Post by FrOzEnTaCo »

lol how do u create a empty lua file? thats all i need to know. :?:
dizekat
Posts: 438
Joined: 07 Dec 2007, 12:10

Re: Insert Command Widget

Post 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.
Post Reply

Return to “Lua Scripts”