KTyJLXy Posted March 5, 2014 Share Posted March 5, 2014 Hi guys. Yep, that's me again. I've got windows critical error (and it says nothing? like bla-bla programm should be closed) on attempt to change level. Lua debug says nothing on this account. Here's the app code --This function will be called once when the program starts function App:Start() --Initialize Steamworks (optional) Steamworks:Initialize() --Set the application title self.title="DungeonScrolls" --Create a window self.window=Window:Create(self.title,0,0,1366,768,Window.Titlebar+Window.Center+8) self.window:HideMouse() --Create the graphics context self.context=Context:Create(self.window,0) if self.context==nil then return false end self.menumusic=Sound:Load("Sound/Music/Main theme.wav") if self.menumusic~=nil then self.musicsource = Source:Create() self.musicsource:SetSound(self.menumusic) self.menumusic:Release() self.menumusic=nil self.musicsource:SetVolume(1) self.musicsource:SetLoopMode(true) self.musicsource:Play() end --Create settings table and add defaults self.settings={} self.settings.vsync=True --Create a world self.world=World:Create() --Load a map --local mapfile = System:GetProperty("map","Maps/start.map") self.mapfile = "Maps/start.map" if Map:Load(self.mapfile)==false then return false end self.mapfile = "" return true end function App:SwitchLevel(name) self.mapfile = name end function App:LevelCheck() if self.mapfile ~= "" then self.world:Release() self.world = World:Create() Map:Load(self.mapfile) self.mapfile = "" end end --This is our main program loop and will be called continuously until the program ends function App:Loop() self:LevelCheck() --If window has been closed, end the program if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end --Update the app timing Time:Update() --Update the world self.world:Update() --Render the world self.world:Render() --Render statistics self.context:SetBlendMode(Blend.Alpha) if DEBUG then self.context:SetColor(1,0,0,1) self.context:DrawText("Debug Mode",2,2) self.context:SetColor(1,1,1,1) self.context:DrawStats(2,22) self.context:SetBlendMode(Blend.Solid) else --Toggle statistics on and off if (self.window:KeyHit(Key.F11)) then self.showstats = not self.showstats end if self.showstats then self.context:SetColor(1,1,1,1) self.context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2) end end --Refresh the screen self.context:Sync(false) --Returning true tells the main program to keep looping return true end And here's the trigger code Script.entered = false Script.exited = false Script.hadCollision = false Script.Map = "" --path function Script:UpdatePhysics() if self.entered then if self.hadCollision == false then if self.exited == false then self.exited = true self.component:CallOutputs("OnExit") self.entered = false end end end self.hadCollision = false end function Script:Collision(entity, position, normal, speed) self.hadCollision = true self.component:CallOutputs("OnCollide") if self.entered == false then self.component:CallOutputs("OnEnter") App:SwitchLevel(self.Map) self.entered = true self.exited = false end end Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 5, 2014 Share Posted March 5, 2014 What is the path to the level name in this example? Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 What is the path to the level name in this example? Maps/second_map.map If i understand your question correctly. Quote Link to comment Share on other sites More sharing options...
Rick Posted March 5, 2014 Share Posted March 5, 2014 self.world:Release() This changed. It should be self.world:Clear() now Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 Changed that. Still error. Quote Link to comment Share on other sites More sharing options...
Rick Posted March 5, 2014 Share Posted March 5, 2014 Put a System:Print("Map file = "..self.mapfile) inside your if statement in App:LevelCheck() and run the program and see what it says in the output. Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 Put a System:Print("Map file = "..self.mapfile) inside your if statement in App:LevelCheck() and run the program and see what it says in the output. it says: Map file = maps/second_map.map Quote Link to comment Share on other sites More sharing options...
Rick Posted March 5, 2014 Share Posted March 5, 2014 Did you step through the code that changes? Do you know exactly what line it's failing on? Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 Did you step through the code that changes? Do you know exactly what line it's failing on? Yep, that would be line 52 in app.lua, which now is self.world:Clear() Quote Link to comment Share on other sites More sharing options...
Rick Posted March 5, 2014 Share Posted March 5, 2014 Just a note if you Clear() the world you don't need to create another one. You are reusing the current world so you can comment that line out. Other than that I don't know what to tell you. This all works for me. I just tested the below and it works perfectly. function App:ChangeLevel(newLevel) self.newLevel = newLevel end function App:ShouldChangeLevel() if self.newLevel ~= "" then self.world:Clear() Map:Load(self.newLevel) self.newLevel = "" end end --This is our main program loop and will be called continuously until the program ends function App:Loop() self:ShouldChangeLevel() -- all the other stuff I just didn't want to paste here end Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 Should i submit bugreport to the engine devs or smth? Btw, if i comment 52 line it loads next lvl. Lags as hell, but it gets it done. Quote Link to comment Share on other sites More sharing options...
Rick Posted March 5, 2014 Share Posted March 5, 2014 I would if I were you. I would make a small test project just for this and include that in the bug report as well. List out your specs and make sure you have the most current version (I'm opted into the beta as well). Yeah, what you experience with the lag is because all the entities in your other scene are still there. They weren't removed because your world wasn't cleared. It's a huge memory leak to do that. Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 I've opted into beta and have created project just for testing. I've got following error now, instead of windows critical: Object reference count error. And output like Map file = maps/second.map Deleting material "e:/leadwerks projects/projectfortests/materials/developer/greengrid.mat" Deleting shader "E:/Leadwerks projects/Changetest/shaders/model/diffuse.shader" Deleting texture "e:/leadwerks projects/projectfortests/materials/developer/greengrid.tex" Deleting texture "E:/Leadwerks projects/Changetest/Materials/Common/bfn.tex" Deleting shader "E:/Leadwerks projects/Changetest/Shaders/Lighting/ambientlight.shader" Setting breakpad minidump AppID = 251810 Steam_SetMinidumpSteamID: Caching Steam ID: 76561197981090266 [API loaded no] Process Complete. Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 Btw, how do i submit bugreport in here? Quote Link to comment Share on other sites More sharing options...
Rick Posted March 5, 2014 Share Posted March 5, 2014 That's a better error as it looks like it's unloading the map. There is a bug report forum. It's very unstructured. You just make a forum post in the bug forum and explain your bug and attach your zipped project Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 5, 2014 Author Share Posted March 5, 2014 Thanks, done that. Quote Link to comment Share on other sites More sharing options...
KTyJLXy Posted March 6, 2014 Author Share Posted March 6, 2014 By the way, Rick, i wonder if you could sent me empty project with just level change somewhere in it. That way i could check if it is just my leadwerks creating projects wrongly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.