gordonramp Posted December 19, 2009 Share Posted December 19, 2009 --Register abstract path RegisterAbstractPath("") --Set graphics mode if Graphics(1024,768)==0 then Notify("Failed to set graphics mode.",1) return end world=CreateWorld() if world==nil then Notify("Failed to initialize engine.",1) return end gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),1+2+4+8) camera=CreateCamera() camera:SetPosition(Vec3(0,0,-2)) light=CreateSpotLight(10) light:SetRotation(Vec3(45,55,0)) light:SetPosition(Vec3(5,5,-5)) scene=LoadScene("abstract::tunnels.sbx") light=CreateDirectionalLight() light:SetRotation(Vec3(45,45,45)) while AppTerminate()==0 do UpdateAppTime() world:Update(AppSpeed()) SetBuffer(gbuffer) world:Render() SetBuffer(BackBuffer()) world:RenderLights(gbuffer) DrawText(UPS(),0,0) Flip(0) end I'm trying to load a scene in Lua outside of the Editor with the Lua Engine. With this code, no errors occur but I'm unable to see the scene. Any suggestions why? Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
Niosop Posted December 19, 2009 Share Posted December 19, 2009 Try taking out the light, it might help you see where things are located since it will default to non-lit mode I think. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
gordonramp Posted December 19, 2009 Author Share Posted December 19, 2009 No difference, I've tried shifting the camera too. I'm wondering if the scene is even loading. There's no mention of it in the log. Update: This works. --Register abstract pathRegisterAbstractPath("") --Set graphics mode if Graphics(1024,768)==0 then Notify("Failed to set graphics mode.",1) return end world=CreateWorld() if world==nil then Notify("Failed to initialize engine.",1) return end gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),1+2+4+8) camera=CreateCamera() camera:SetPosition(Vec3(0,1,0)) scene=LoadScene("abstract::tunnels.sbx") while AppTerminate()==0 do UpdateAppTime() world:Update(AppSpeed()) SetBuffer(gbuffer) world:Render() SetBuffer(BackBuffer()) world:RenderLights(gbuffer) DrawText(UPS(),0,0) Flip(0) end Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
Josh Posted December 20, 2009 Share Posted December 20, 2009 Your first code you posted worked perfectly. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gordonramp Posted December 20, 2009 Author Share Posted December 20, 2009 Yeah, I discovered the scene name was misspelt . Anyway, it is showing up now but of course I can't look around because my next mountain to climb is to get some controller code working. Mouselook and movement. I've tried adapting from the fpscontroller.lua code but what I have just produces errors. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
Wchris Posted January 4, 2010 Share Posted January 4, 2010 I'm testing lua and i have the same kind of problem (a black screen) with this code --Register abstract path RegisterAbstractPath("D:\Leadwerks\LPisland") --Set graphics mode if Graphics(1024,768)==0 then Notify("Failed to set graphics mode.",1) return end --Create framewerk object and set it to a global object so other scripts can access it framework=CreateFramework() if framework==nil then Notify("Failed to initialize engine.",1) return end SetGlobalObject("framewerk",framework) camera=framework.main.camera scene=LoadScene("abstract::islands3.sbx") if scene==nil then AppLog('***************** NULL') return end light=CreateDirectionalLight() light:SetRotationf(45,45,0) while AppTerminate()==0 do framework:Update() framework:Render() Flip(0) end the console says ***************** NULL and the script ends. - if i use "abstract::tunnels.sbx" like gordon it works. - my RegisterAbstractPath is correct and points to my islands3.sbx directory - islands3.sbx spelling is correct, and the path "D:\Leadwerks\LPisland" also. - the same kind of code in pascal works fine, only my full lua experiment fails - if i specify the full path like scene=LoadScene("D:\Leadwerks\LPisland\islands3.sbx") i still get the ********* NULL console message Can someone try to do a LoadScene from a custom sbx file located elsewhere than in LE maps folder ? if you have ideas how to solve this, you're welcome i also wonder how actionsnake is loading it's sbx files ? i did not find any loadscene in actionsnake lua files ? Thank you EDIT : okey it's m fault , it works, the camera is just misplaced and i should not have tested "if scene==nil then", but rather "if scene==0 then" or maybe "if scene==nul then" because CreateFramework returns a pointer ... and loadscene a handle. Quote Windows 7 home - 32 bits Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM Link to comment Share on other sites More sharing options...
macklebee Posted January 4, 2010 Share Posted January 4, 2010 you need to set the position of the camera... more than likely you are spawning the camera in the ground at (0,0,0) try this or some variation: camera=framework.main.camera camera:SetPosition(Vec3(0,3,-2)) as far as the null... not sure... i took this code and and placed it into the root of my game directory and changed the abstractpath to "". Changed the name of the scene to my scene and then dragged and dropped the lua script onto the Engine.EXE and it worked just fine after I positioned the camera... this could be an issue with the slashes... i think its supposed to be a forward slash in the abstractpath not a backward slash... but I never hardcode my paths, so I am not sure... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Wchris Posted January 4, 2010 Share Posted January 4, 2010 as far as the null... not sure... i took this code and and placed it into the root of my game directory and changed the abstractpath to "". Changed the name of the scene to my scene and then dragged and dropped the lua script onto the Engine.EXE and it worked just fine after I positioned the camera... You're right it works now with "if scene=nil then", no more message in the log window maybe vista was locking the sbx file I feel more at home with pascal than lua yet, so when something goes wrong i panic Thank you Quote Windows 7 home - 32 bits Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM 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.