Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 857 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
empty pointer? #224021
08/28/08 01:16
08/28/08 01:16
Joined: Jul 2008
Posts: 37
Ankara, Turkey
Warchief Offline OP
Newbie
Warchief  Offline OP
Newbie

Joined: Jul 2008
Posts: 37
Ankara, Turkey
hi when i run these codes, it says empty point, waht is problem?

Code:
 #include <acknex.h> 
#include <default.c>

ENTITY* carbody;
ENTITY* tireleft;


var joinbody;



action mybody()
{
	carbody=me;

    phent_settype (my, PH_RIGID, PH_BOX); 
    phent_setmass (my, 70, PH_BOX); 
    phent_setgroup (my, 2);
    phent_setfriction (my, 20); 
    phent_setdamping (my, 40, 40); 
    phent_setelasticity (my, 50, 20); 

}

action lefttire()
{
	
tireleft=me;
		
	phent_settype (my, PH_RIGID, PH_SPHERE);
	phent_setmass (my, 10, PH_SPHERE);
	phent_setgroup (my, 2);
	phent_setfriction (my, 60);
	phent_setdamping (my, 40, 40);
	phent_setelasticity (my, 50, 20);
    
   joinbody= phcon_add( PH_WHEEL, carbody, my); 
    phcon_setparams1 (joinbody, my.x, vector(0, 0, 1), vector(1, 0, 0)); 
    	phcon_setparams2 (joinbody, vector(-30, 30, 0), nullvector, vector(50000, 100, 0));
}


void main()
{
	
	level_load("test.wmb");
wait(4);
	ph_setgravity (vector(0, 0, -386));

		
	
		while(1)
	{
		if(key_w == 0 & key_s == 0 & key_a == 0 & key_d == 0)
		{
			phcon_setmotor(joinbody, vector(0,50,0), nullvector, nullvector);
		
		}
	

if(key_a == 1&key_d == 0)
		{
			phcon_setmotor(joinbody, vector(-100,50,0), vector(0,0,0), nullvector);

		
		}
		
		wait(1);
}
		
}



Vekare
Re: empty pointer? [Re: Warchief] #224034
08/28/08 05:02
08/28/08 05:02
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
There is the potential for the function
"action lefttire"
to run BEFORE carbody has been filled.

So I would insert the folowing code
Code:
action lefttire()
{
   tireleft=me;
   //
   while(carbody==NULL)   wait(1);      //<<<<   Line to insert
   //
   phent_settype (my, PH_RIGID, PH_SPHERE);

This way the tyre code will wait until the carbody exists before it tries
to join with it.
In reality, this line could be placed anywhere in you code as long as it comes
before the "joinbody= phcon_add( PH_WHEEL, carbody, my);" line.
But where Ive got it, I think there will be less load on the physics engine
when there is no carbody.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: empty pointer? [Re: EvilSOB] #224078
08/28/08 12:22
08/28/08 12:22
Joined: Jul 2008
Posts: 37
Ankara, Turkey
Warchief Offline OP
Newbie
Warchief  Offline OP
Newbie

Joined: Jul 2008
Posts: 37
Ankara, Turkey
still same problem.


Vekare
Re: empty pointer? [Re: Warchief] #224100
08/28/08 14:00
08/28/08 14:00
Joined: Jul 2008
Posts: 37
Ankara, Turkey
Warchief Offline OP
Newbie
Warchief  Offline OP
Newbie

Joined: Jul 2008
Posts: 37
Ankara, Turkey
problem solved when i re-define pointer.


Vekare
Re: empty pointer? [Re: Warchief] #224187
08/29/08 01:37
08/29/08 01:37
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
What was it, spelling typo?

Your description on "re-define pointer" isnt too clear.

And do you mean the problem is actually solved, or just the error goes away?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: empty pointer? [Re: EvilSOB] #224190
08/29/08 03:10
08/29/08 03:10
Joined: Jul 2008
Posts: 37
Ankara, Turkey
Warchief Offline OP
Newbie
Warchief  Offline OP
Newbie

Joined: Jul 2008
Posts: 37
Ankara, Turkey
completely solved, and i mean with re-defined was, i delete entity and defined it again.


Vekare
Re: empty pointer? [Re: Warchief] #224191
08/29/08 03:19
08/29/08 03:19
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Ah, I get it. Best of luck.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1