heightmap functions

heightmap functions

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

Moderator: Moderators

Post Reply
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

heightmap functions

Post by zoggop »

did something change that the wiki no longer reflects? i remember using these functions in map gadgets, but now:

Code: Select all

[f=0000050][f=0000122] Error: LuaRules::RunCallIn: error = 2, Initialize, [Internal Lua error: Call failure] error = 2, LuaRules/gadgets.lua, [string "LuaRules/Gadgets/heightmaptest.lua"]:14: attempt to call field 'AdjustHeightMap' (a nil value)
stack traceback:
	[C]: in function 'Include'
	[string "LuaRules/draw.lua"]:9: in main chunk
[f=0000122] Error: LuaRules loading failed

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Loony: Heightmap Test",
    desc      = "Tries to adjust the heightmap.",
    author    = "zoggop",
    date      = "January 2015",
    license   = "whatever",
    layer     = -3,
    enabled   = true
   }
end

function gadget:Initialize()
  Spring.AdjustHeightMap(100, 100, 200, 200, 50)
end
edit: it works when luarules are loaded the first time, but not when they're reloaded with a console command
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: heightmap functions

Post by gajop »

Shouldn't it have a check to see if it's synced?

Code: Select all

if (gadgetHandler:IsSyncedCode()) then 

-- your callin

end
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: heightmap functions

Post by zoggop »

lol, indeed. thanks
Post Reply

Return to “Lua Scripts”