[Solved] Script runtime error cannot cast undefined to bool

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

[Solved] Script runtime error cannot cast undefined to bool

Post by Pedsdude » June 13th, 2009, 5:40 pm

I load my map, and as soon as I choose a team and class (i.e. when I spawn) it gives the "Script runtime error - cannot cast undefined to bool" error. Below is a screenshot of the console:

http://img193.imageshack.us/img193/2122/error2z.jpg

Here are the contents of my .gsc file:

Code: Select all

main()
{
	ambientPlay("ambient_backlot_ext");

	game["allies"] = "sas";
	game["axis"] = "spetsnaz";

}
Not only does it happen when I spawn, but it also happens when I miss a jump (i.e. if I fall from a moderate height) - so I assume it happens due to damage (in this case fall damage).

I can't think of any reason for this whatsoever. Any help would be greatly appreciated.
Image
Image

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Script runtime error - cannot cast undefined to bool

Post by waywaaaard » June 13th, 2009, 5:53 pm

you forgot place this line in your .gsc

Code: Select all

maps\mp\_load::main();
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: Script runtime error - cannot cast undefined to bool

Post by Pedsdude » June 13th, 2009, 8:54 pm

I had that previously and removed it in an attempt to fix it, but still no success.
Image
Image

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: Script runtime error - cannot cast undefined to bool

Post by _DanTheMan_ » June 13th, 2009, 9:22 pm

I'm pretty sure it's the CJ mod.
If you load any map with the CJ mod, and developer mode on at the same time, it will give you an error on self.advertElem when you first spawn, and that eAttacker is undefined every time you take fall damage.
Image

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: Script runtime error - cannot cast undefined to bool

Post by Pedsdude » June 13th, 2009, 9:25 pm

Ah, so it is, thank you :)

I was wondering why I was still getting it even when I didn't include my .gsc file!

Won't bother with developer 1 unless it's required in future!
Image
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Drofder2004 » June 13th, 2009, 11:32 pm

I thought I solved all the developer 1 issues :S

It is technically a simple solve, but I wont be releasing just to fix this error :)
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Pedsdude » June 13th, 2009, 11:42 pm

Drofder2004 wrote:I wont be releasing just to fix this error :)
Rightly so, wouldn't be worth updating all the servers for the sake of something most people don't/won't encounter.

I solved (kinda) my other problem which I wanted to talk to you about, Drofder. For some reason, whenever I selected ANY brush in my map this short, translucent, black cylinder would appear in the same position on my map. The more brushes I selected, the less translucent it became, and it showed up whenever I created new brushes (but always in the same spot).

I deleted all the brushes in my map, then made a new brush and it also appeared. I solved it by selecting all the brushes etc. in my map and copying over to a new map file.

I couldn't select the cylinder at all, and none of the filters seemed to make it dissappear. It was literally a ghost. Any ideas what it was? :roll:
Image
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Drofder2004 » June 14th, 2009, 2:17 pm

Never heard of anything like it. did you screenie it?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Pedsdude » June 14th, 2009, 10:37 pm

I've got the .map file if you want to have a look (assuming the ghost hasn't gone away!).
Image
Image

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Pedsdude » June 14th, 2009, 10:41 pm

http://www.codjumper.com/files/ghost.map
(might wanna save target as, if you click link it just shows the text).
Image
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Drofder2004 » June 14th, 2009, 11:18 pm

Opening in text format solves the problem...

"radius" - "200"
In worldspawn.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: [Solved] Script runtime error cannot cast undefined to bool

Post by Pedsdude » June 15th, 2009, 1:44 am

Hmm, fair does :)
Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest