Page 1 of 1

Runtime error 216

Posted: Mon Sep 10, 2012 9:10 am
by darkhog
I'm trying to make simple game where you can drive car. Unfortunately I get runtime error 216. Most likely my fault, because I'm net to this soft, so I attaching my project.

Posted: Mon Sep 10, 2012 10:26 am
by VilleK
Hi and welcome to these forums!

You get a "null pointer referenced in expression" error in the log window too. The problem is in Car.OnUpdate.Condition.Expression:

"return CurrentModel.CollidedWith.ClassId == Ground.ClassId;"

CurrentModel.CollidedWith is only valid to use in OnCollision. So move this Condition to Car.OnCollision instead.

Posted: Mon Sep 10, 2012 11:55 am
by darkhog
Thanks! However now I have another problem. Wheels of my car don't want to rotate. I'm using following script in Keypress binded to W key. I'm attaching project file. KeyPress is in OnUpdate.

Also sorry for noob questions, but I'm new to it aaand, you know.

Posted: Mon Sep 10, 2012 12:10 pm
by VilleK
For some reason I can't remember the keys need to be specified in caps. So just change to W instead and it will work.

Posted: Mon Sep 10, 2012 12:15 pm
by darkhog
Thanks again.

Posted: Mon Sep 10, 2012 1:48 pm
by Kjell
Hej Ville,
VilleK wrote:For some reason I can't remember the keys need to be specified in caps.
Because Windows returns the QWERTY key events in the 0x41 - 0x5A range, which corresponds to the capital letters in the ANSI map. The lower case ordinals actually map to the numpad and function-keys among others :)

K

Posted: Mon Sep 10, 2012 3:50 pm
by VilleK
That's it, thanks for reminding me Kjell :)