Removing selection rectangle

Removing selection rectangle

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

Moderator: Moderators

Post Reply
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Removing selection rectangle

Post by Maelstrom »

Like the subject says, I need to remove the selection rectangle around units. Unfortunately, I cant just copy trepans method of doing it. The error is:

Code: Select all

LUACOB-MAIN  (GADGETS)
LUACOB-DRAW  (GADGETS)
LUARULES-MAIN  (GADGETS)
error = 2, LuaRules/draw.lua, error = 2, LuaRules/gadgets.lua, [string "LuaRules/Gadgets/gui_roundselection.lua"]:49: attempt to index global 'io' (a nil value)
The code is:

Code: Select all

function SetupCommandColors(state)
  local alpha = state and 1 or 0
  local f = io.open('cmdcolors.tmp', 'w+')      <---- line 49
  if (f) then
    f:write('unitBox  0 1 0 ' .. alpha)
    f:close()
    Spring.SendCommands({'cmdcolors cmdcolors.tmp'})
  end
  os.remove('cmdcolors.tmp')
end
Either I need another way of removing the selection rectangles, or how to fix the error. Any ideas?

Thanks
Post Reply

Return to “Lua Scripts”