0 registered members (),
1,209
guests, and 0
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Player Pointer invalid.
[Re: testDummy]
#211926
06/19/08 05:40
06/19/08 05:40
|
Joined: Jul 2000
Posts: 27,987 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,987
Frankfurt
|
The first thing to do in such cases is debugging. Anything could be an engine bug, but you'll never know unless you look where the problem lies at all. I can help when I know where the problem happens, and under which circumstances.
"Invalid pointer" means that a pointer is NULL. The first thing to do is finding when and where in the code that pointer is set to NULL. Display the pointer on the screen, like this:
draw_text(str_for_num(NULL,player),10,10,vector(0,0,0))
and check if and when "player" changes.
|
|
|
Re: Player Pointer invalid.
[Re: jcl]
#212061
06/20/08 00:42
06/20/08 00:42
|
Joined: Oct 2003
Posts: 130 Wollongong Australia
Jethro
OP
Member
|
OP
Member
Joined: Oct 2003
Posts: 130
Wollongong Australia
|
OK. I implemented what you said in two areas of my code,and this verifies what I already know.
The following code is in the faulty entities action. While (Player==Null){ draw_text(str_for_num(NULL,player),10,50,vector(0,0,0)); Wait(1); } The above always returns "0".
The following code is in the players main loop while(1) { draw_text(str_for_num(NULL,player),10,10,vector(0,0,0)); move_view(); ....rest of code wait(1); }
The above always returns "39965.617". So the constant screen display is
"39965.617" --> player function using "player" pointer "0" --> Entity function using "player" pointer
This prooves that in one area of my code the Engine defined Player pointer is set and in another area of my code it isn't.
OK. To my workaround.
Where I set the player pointer, I also set an extra player pointer, "my_player" as follows.
Player=me; MY_Player=me; //Set this because of invalid Player pointer bug!
Now when I monitor the MY_Player pointer, in the same entity function it is recognised as valid and falls throuigh to the following loop which constantly displays the same pointer number as "Player" Pointer. Entity code snippet. While (vec_dist(my.x,MY_player.x) > 50) { draw_text(str_for_num(NULL,MY_player),10,50,vector(0,0,0)); Wait(1); }
So the constant screen display is
"39965.617" --> player function using "player" pointer "39965.617" --> Entity function using "my_player" pointer
Go Figure "my_player" is reliable but "player" is NOT recognised from within this entities ACTION! In all but one other "Faulty" entity function. The Player Pointer is recognised!
I know this doesn't make any sence at all that is why I'm reporting it!
Hope this helps jethro.
Heres the entire faulty action unedited.
Action SCTur_PU { //first reset the counters. MY.Passable=on; MY.Invisible=on; Sub_Stage=1; //This is the eggs and turtle picked up Sub_level=1; //This is the secpan If (Main_Diff==1)&&(My.Flag1==0){ent_Remove(me);} If (Main_Diff==2)&&(My.Flag2==0){ent_Remove(me);} If (Main_Diff==3)&&(My.Flag3==0){ent_Remove(me);} //I'm for this difficulty so wait until Im needed While (MY_Player==Null){draw_text(str_for_num(NULL,MY_player),10,50,vector(0,0,0));Wait(1);} While (MY.Skill1!=Sub_level){Wait(1);} //I'm now active, so wait to get picked up. Turtle_Ent=ME; //So GPS Can find me //MY.Passable=off; //not sure if turn this off. definately need on to carry turtle MY.Invisible=off; //Do it with proximity While (vec_dist(my.x,MY_player.x) > 50) {draw_text(str_for_num(NULL,MY_player),10,50,vector(0,0,0));wait(1);} //For now just wait for player //We're picked up from here, lock me to player. Got_turtle=My.skill1; While (Got_Turtle!=0){// Lock me to player vec_for_vertex(temp,MY_Player,56);//Read Top left corner vertex vec_set(my.x,temp.X); vec_set(My.pan,MY_Player.pan); Wait(1); } //Now get dropped off at secpan, and trigger the secpan. Ent_Remove(me); //Im Removed while they do the sec pan. }
|
|
|
Re: Player Pointer invalid.
[Re: Jethro]
#212562
06/23/08 01:10
06/23/08 01:10
|
Joined: Mar 2003
Posts: 5,377 USofA
fastlane69
Senior Expert
|
Senior Expert
Joined: Mar 2003
Posts: 5,377
USofA
|
But it is that simple. You're missing the point. A stub would have minimal graphics and everything... it's only purpose is to test your hypothesis: is player pointer broken? It shouldn't take more than an hour to write and test several whiles and ifs and other commmands using player... and then you know if the problem is with the engine or your code. It's that simple. One hour. Tops.
|
|
|
|