Author |
Topic: Script Runtime Error |
Trigonous |
General Member Since: Mar 8, 2006 Posts: 80 Last: Oct 3, 2006 [view latest posts] |
|
|
Category: CoD Mapping Posted: Monday, Oct. 2, 2006 12:40 am |
|
I got a script runtime error after I added a sliding door to my map, here is the door script straight from the "Getting started in scripting: moving things":
main()
{
thread door_slider ();
}
door_slider ()
{
door = getent ("slide ", "targetname");
trig = getent ("slider_trigger ", "targetname");
while (1)
{
trig waittill ("trigger");
door movez (80, 2, 0, 0.5);
door waittill ("movedone");
wait (4);
door movez (-80, 2, 0, 0.5);
door waittill ("movedone");
}
}
The console says:
******* script runtime error *******
undefined is not an object: (file 'maps\mp\door1.gsc', line 12)
trig waittill ("trigger")
*
called from:
(file 'maps\mp\door1.gsc', line 3)
thread door_slider ( );
*
called from:
(file 'maps\mp\outside.gsc', line 19)
level thread maps\mp\door1::main( );
*
called from:
(file 'maps\mp\outside.gsc', line 1)
main( )
*
edited on Oct. 1, 2006 11:22 pm by StrYdeR |
|
|
|
TexasRebel |
General Member Since: May 1, 2006 Posts: 373 Last: Aug 20, 2013 [view latest posts] |
|
|
|
Trigonous |
General Member Since: Mar 8, 2006 Posts: 80 Last: Oct 3, 2006 [view latest posts] |
|
|
|
StrYdeR |
General Member Since: May 11, 2004 Posts: 11672 Last: Apr 20, 2024 [view latest posts] |
|
|
|
|
Category: CoD Mapping Posted: Monday, Oct. 2, 2006 03:24 am |
|
the error is your answer....
you obviously do not have the entity in your map that has the targetname you are telling it to find and/or it is not a trigger
double check your entity in the map and make sure that you have named it what you are calling it in your script
slider_trigger
|
|
|
|
Trigonous |
General Member Since: Mar 8, 2006 Posts: 80 Last: Oct 3, 2006 [view latest posts] |
|
|
|
Trigonous |
General Member Since: Mar 8, 2006 Posts: 80 Last: Oct 3, 2006 [view latest posts] |
|
|
|
StrYdeR |
General Member Since: May 11, 2004 Posts: 11672 Last: Apr 20, 2024 [view latest posts] |
|
|
|
|
|
Trigonous |
General Member Since: Mar 8, 2006 Posts: 80 Last: Oct 3, 2006 [view latest posts] |
|
|
Category: CoD Mapping Posted: Tuesday, Oct. 3, 2006 12:11 am |
|
Look, there is a trigger_use next to the door. It has a classname of trigger_use, and a targetname of slider_trigger. I have checked this many times. Now, from my very limited experience with scripting, I think the problem is that there isn't anything named "Trigger", but I'm probobly wrong. I DO know that the trigger_use is named slider_trigger, and I've checked the spelling on that I don't know how many times. Now, the trigger_use is placed over a model. This is just a regular model, but from what I get, that shouldn't be a problem, just thought I'd include it. |
|
|
|
StrYdeR |
General Member Since: May 11, 2004 Posts: 11672 Last: Apr 20, 2024 [view latest posts] |
|
|
|
|
Category: CoD Mapping Posted: Tuesday, Oct. 3, 2006 01:41 am |
|
to break down your script (the area that we are talking about)
trig = getent ("slider_trigger", "targetname");
this line tells the engine to search the map for an entity that has the targetname of slider_trigger and from this point on refer to it as trig
while (1)
this tells the script that a subloop is going to take place in the following set (defined by an opening and closing curly brace)
{
starts the set
trig waittill ("trigger");
this tells the script to pause and wait until the defined action has occured, in this case wait until the entity defined as trig has been triggered
this is where the error is being generated - basically stating that undefined (trig) is not an object (there is no trigger)
|
|
|
|
Trigonous |
General Member Since: Mar 8, 2006 Posts: 80 Last: Oct 3, 2006 [view latest posts] |
|
|
|