Jump to content

2 Lua Errors - I'm new to Lua and stuck!


Porsche
 Share

Recommended Posts

Alright, so I've been working through the VERY informative and VERY helpful Lua tutorials here on the Leadwerks site. I'm starting off knowing nothing about Lua, and this is my first time working with a scripting language as well as working on a game. So I'm very new to the whole deal.

 

I've had errors in the script I typed up from the tutorials, but I've been able to handle most of them. Except two. After doing the first eight tutorials, even though I made sure I typed everything exactly the way he did, I still get the errors. I've even pasted the script from the .pdf files that come with the tutorials! Still an error. I'm wanting to know what on my computer is causing them.

 

In the fourth tutorial, the line

scene = LoadMesh("abstract::scene.gmf")

gives the error:

"Unhandled exception error in the main chunk."

when I try to run the script. I used that exact same line with the exact same errors in the seventh and eight tutorials, too.

 

Finally, in the sixth tutorial, the line

sound1 = LoadSound("abstract::beep.ogg")

gives the error:

"EXCEPTION_ACCESS_VIOLATION"

when I try to run the script. This is the only time I've run into the error so far, from the 1-8 Lua tutorials.

 

Does anyone have any ideas/advice for a newbie who's run out? I'd appreciate it!

 

Thanks,

Torr.

simpleSigPNG.png

Artist, Animator, Musician, P/T Programmer

Dual Core @ 2.6GHz per /nVidia 9600 GT/ 4 GBs DDR3 6800 / XP Pro 32/64 Bit

Photoshop CS3 / 3D Studio Max 8 / VS '08

Link to comment
Share on other sites

Do you have those resources located from where you are running your scripts? scene.gmf and beep.ogg?

 

Yes. That was one of the first things I looked at. They're all in the same folder, and I've never had a problem before with the abstract path not finding things. : /

 

It's odd. I showed this to one of my seniors at school, and he wasn't able to figure it out either. That was where we tried copying the script directly from the .pdf of the tutorial. But the guy's works in the tutorial, no problem. I was wondering if it had anything to do with my computer?

simpleSigPNG.png

Artist, Animator, Musician, P/T Programmer

Dual Core @ 2.6GHz per /nVidia 9600 GT/ 4 GBs DDR3 6800 / XP Pro 32/64 Bit

Photoshop CS3 / 3D Studio Max 8 / VS '08

Link to comment
Share on other sites

Could you please post your engine logs when the programs are crashing? The commands are okay so there must be something else.

I have had problems with copying code directly from pdf before. Some kind of hidden format issue.

 

Do you also run the engine.exe that is inside the root of your project? I often switch between testing programs and that is why I need to specify the new path for the engine.exe.

Link to comment
Share on other sites

Could you please post your engine logs when the programs are crashing? The commands are okay so there must be something else.

I have had problems with copying code directly from pdf before. Some kind of hidden format issue.

 

Do you also run the engine.exe that is inside the root of your project? I often switch between testing programs and that is why I need to specify the new path for the engine.exe.

 

Okay, some more information...

 

I get a little more detail with debug, but I still can't make heads or tails of it. This is regarding the "Unhandled exception error in the main chunk." This is what is shown in the log at the bottom of the script editor:

 

Loading texture "c:/users/torr/documents/leadwerks engine sdk/tutorials/lesson09/concrete_floor01dot3.dds"...

Loading shader "zip::c:/users/torr/documents/leadwerks engine sdk/shaders.pak//mesh/mesh_diffuse_bumpmap.vert", "zip::/c:/users/torr/documents/leadwerks engine sdk/shaders.pak//mesh/mesh_diffuse_bumpmap.frag"...

Loading material "zip::c:/users/torr/documents/leadwerks engine sdk/private/thezone.pak//models/buildings/warehouse01/concrete.mat"...

Unhandled exception:Zip data error

 

As for the second error, I found that it plays the sound when running debug. But when I try to raise and lower the pitch with the up and down arrow keys, as we coded in the tutorial (#6, with sound), a different error pops up - something more specific, and a little easier to understand. "Unhandled Exception:Attempt to access field or method of Null object" ...the problem now is trying to find where that problem is, since I'm using the same code as in the tutorial. The log for this is very long, I cannot copy the text, and it doesn't seem to be helpful and save a .txt file either. Here are the last lines of the log, at least, and if you need more then I'll type further back:

 

Loading texture "incbin::noise.dds"...

Loading shader "zip::c:/users/torr/documents/leadwerks engine sdk/shaders.pak//postfilters/postfilter.vert", "zip::/c:/users/torr/documents/leadwerks engine sdk/shaders.pak//lighting/directionallight.frag"...

Loading shader "zip::c:/users/torr/documents/leadwerks engine sdk/shaders.pak//postfilters/postfilter.vert", "zip::/c:/users/torr/documents/leadwerks engine sdk/shaders.pak//postfilters/postfilter.frag"...

Loading shader "zip::c:/users/torr/documents/leadwerks engine sdk/shaders.pak//postfilters/postfilter.vert", "zip::/c:/users/torr/documents/leadwerks engine sdk/shaders.pak//postfilters/depthblit.frag"...

Loading texture "incbin::Arial9.dds"...

Unhandled Exception:Attempt to access field or method of Null object

 

The lines where we scripted the changing of the pitch are:

 

-- Increase/decrease pitch on command

if KeyHit(KEY_UP) == 1 then

pitch = pitch + 0.1

SetSourcePitch(source1,pitch)

elseif KeyHit(KEY_DOWN) == 1 then

pitch = pitch - 0.1

SetSourcePitch(source1,pitch)

end

 

...where pitch and source1 have already been defined above.

 

 

Does any of this help at all, for either error? Thanks for trying to help me out.

simpleSigPNG.png

Artist, Animator, Musician, P/T Programmer

Dual Core @ 2.6GHz per /nVidia 9600 GT/ 4 GBs DDR3 6800 / XP Pro 32/64 Bit

Photoshop CS3 / 3D Studio Max 8 / VS '08

Link to comment
Share on other sites

You are trying to use a mat file from Dave Lee's The Zone, or at least the abstract path is grabbing it. Either remove the Zone folder from your SDK or change the name of your mat file to something else.

 

For the line:

 

scene = LoadMesh("abstract::scene.gmf")

 

...that was causing problems, I changed the name of "scene.gmf" to something else. Worked like a charm, just as you said. THANK you!

 

 

One down, and one to go.

simpleSigPNG.png

Artist, Animator, Musician, P/T Programmer

Dual Core @ 2.6GHz per /nVidia 9600 GT/ 4 GBs DDR3 6800 / XP Pro 32/64 Bit

Photoshop CS3 / 3D Studio Max 8 / VS '08

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...