|
Unexpected error [SOLVED]
#425972
07/14/13 14:11
07/14/13 14:11
|
Joined: Jan 2013
Posts: 106 Only in your imagination!
The_KING
OP
Member
|
OP
Member
Joined: Jan 2013
Posts: 106
Only in your imagination!
|
Hello, guys ***PROBLEM SOLVED*** I typed in some code to narrate a part of my game story. I used a function called play_movie2(). The function creates a view ,sets it position and orientation according to another character model "robert" which stands in front of the player (I teleported the player using her x ,y and z components 'cause I wanted her to stand in a certain place).
Anyway, when the function is executed ,an "invalid arguments E1515" appears at me. I can't figure out where is the faulty argument and I can't find any pointer returning NULL undesirably. Here is the fucntion (the player pointer is named "player1"):
VIEW* movie_camera3;
function play_movie2()
{
var time_passed = 0;
var distance_to_ground;
VECTOR g_temp;
VECTOR temp;
VECTOR temp2;
snd_tune(snd_forest_handle,50,0,0);
//initialize the camera for Mr. Rubert and Miss Clara Lear
movie_camera3 = view_create(6);
wait(2);
movie_camera3.pos_x = 0;
movie_camera3.pos_y = 0;
movie_camera3.size_x = screen_size.x;
movie_camera3.size_y = screen_size.y;
wait(1);
movie_camera3.x = 5841;
movie_camera3.y = 11442;
movie_camera3.z = 455;
movie_camera3.tilt = 0;
movie_camera3.pan = 0;
movie_camera3.genius = NULL;
movie_camera3.flags |= AUDIBLE;
//ACTION!!...
p_able_to_move = 0;
toggle(camera,SHOW);
set(movie_camera3,SHOW);
player1.x = 5798;
player1.y = 11696;
robert = ent_create("Robert.mdl",vector(5666,11629,510),NULL);
vec_set(temp.x,robert.x);
vec_sub(temp.x,player1.x);
vec_to_angle(player1.pan,temp.x);
while(time_passed < 5 )
{
time_passed += time_step/16;
vec_set(temp.x,robert.x);
vec_sub(temp.x,movie_camera3.x);
vec_to_angle(movie_camera3.pan,temp.x);
vec_set(temp2.x,player1.x);
vec_sub(temp2.x,robert.x);
vec_to_angle(robert.pan,temp2.x);
vec_set(g_temp.x,robert.x);
g_temp.z -= 5000;
distance_to_ground = c_trace(robert.x,g_temp.x,IGNORE_ME | USE_BOX) - 17;
c_move(my,nullvector,vector(0,0,-distance_to_ground),GLIDE | IGNORE_PASSABLE);
ent_animate(robert,"stand",robert.stand_percentage,ANM_CYCLE);
robert.stand_percentage += 2*time_step;
ent_animate(player1,"stand",player1.stand_percentage,ANM_CYCLE);
player1.stand_percentage += 3*time_step;
wait(1);
}
}
Thank you for reading
Last edited by The_KING; 07/15/13 12:28.
|
|
|
Re: Unexpected error
[Re: The_KING]
#425973
07/14/13 14:24
07/14/13 14:24
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
I can't figure out where is the faulty argument and I can't find any pointer returning NULL undesirably. If you cannot figure out which line of your code causes the error place a beep in the middle of the function and run your game. Do you hear the beep before you see the error message? If so, move the beep further down until, otherwise move it up. This way you can exactly determine which line is causing the trouble.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Unexpected error
[Re: Uhrwerk]
#425983
07/14/13 19:00
07/14/13 19:00
|
Malice
Unregistered
|
Malice
Unregistered
|
@Uhrwerk awesome debugging tip.
@The_King the code only has 3 things that can be NULL in this way. Robert,player2, snd_forest_handle and movie_camera3. One of these is only a empty pointer at run time. You can build on Uhrwerks tip by making loops at the beep() points that do not allow continuing passed. Then use DEBUG_VAR() to display thing you think could be NULL. If the first micro loop runs and the suspect isn't NULL, than move the loop end to include the next suspect and modify the DEBUG_VAR to display it's NULL/NON-NULL state.
Last edited by Malice; 07/14/13 19:03.
|
|
|
Re: Unexpected error
[Re: ]
#426020
07/15/13 12:27
07/15/13 12:27
|
Joined: Jan 2013
Posts: 106 Only in your imagination!
The_KING
OP
Member
|
OP
Member
Joined: Jan 2013
Posts: 106
Only in your imagination!
|
Thank you, I found the error. In the while loop, the pointer "my" in the "c_move" instruction returns NULL 'cause it isn't an action
@Uhrwerk Nice debugging method! (Really this thread isn't a waste of time)
Last edited by The_KING; 07/15/13 12:29.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|