Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 863 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Very bad if #230532
10/06/08 14:44
10/06/08 14:44
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hi,
I don't get this. I have a very semple if statement here.
I keep getting and error (undeclared identifier)

here the code:
Code:

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




function canera_state();
function cam_walking();
var campla = 1;

function main()
{
	video_screen = 1;
	video_mode = 7;
	level_load ("place.wmb");
        ent_create("ship.mdl", vector(0,0,0),NULL);
	
	while(1)
{
	IF (campla==1)
     {

     	canera_state();
     
     
   else
   
     if(campla == 0) 
    cam_walking();
   }


   if (key_a){campla=1;}
   if (key_b){campla=0;}
   wait(1)
	

     
   
} 




function canera_state()

{
	vec_set(camera.x,ship.x);
  vec_set(camera.y,ship.y);
  vec_set(camera.z,ship.z);// move the camera together with the ship entity
  vec_set(camera.pan,ship.pan);
  wait(1)
	
	
}



function cam_walking()

{
	
vec_set(camera.x, vector(-300, 0, 20));	
	
	
}




I have the var set for campla to 1, I should be able to go from one camera pos. to a nother by using the a and b keys.
Well if anyone know what I did wrong here let me know.


I have A7 Commercial .............. Now I just need to learn how to use it

Re: Very bad if [Re: sadsack] #230534
10/06/08 15:02
10/06/08 15:02
Joined: Mar 2003
Posts: 1,095
Germany
nightshade Offline
Serious User
nightshade  Offline
Serious User

Joined: Mar 2003
Posts: 1,095
Germany
You have written :

IF (campla==1)
{

canera_state();

your forgot to set the }

Anyways, in which line do you get the Error?

Last edited by nightshade; 10/06/08 15:02.
Re: Very bad if [Re: nightshade] #230540
10/06/08 15:32
10/06/08 15:32
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
You seem to use Lite-C, which is case sensitive. That means you have to write "if" instead of "IF".

Re: Very bad if [Re: Lukas] #230546
10/06/08 16:35
10/06/08 16:35
Joined: Sep 2008
Posts: 66
falagar8 Offline
Junior Member
falagar8  Offline
Junior Member

Joined: Sep 2008
Posts: 66
oh deer!
and I don't mean buffalo either. wink

semicolons, brackets and keywords.
and make your ship global too. Or attach a function as the ships mdl function. And perhaps with mini tasks in this attached function for the ship model.

#include <acknex.h>;
#include <default.c>;


function canera_state();
function cam_walking();
var campla =1;

function main()
{
video_screen = 1;
video_mode = 7;
level_load ("place.wmb");
ent_create("ship.mdl", vector(0,0,0),NULL);

while(1)
{
if(campla==1)
{
canera_state();

}
else
{

if(campla == 0)
{ cam_walking(); }




if (key_a){campla=1;}
if (key_b){campla=0;}

wait(1);





}




}




function canera_state()
{
vec_set(camera.x,ship.x);
vec_set(camera.y,ship.y);
vec_set(camera.z,ship.z);// move the camera together with the ship entity
vec_set(camera.pan,ship.pan);
wait(1);


}



function cam_walking()
{

vec_set(camera.x, vector(-300, 0, 20));


}


syntax and form first.
then style and function.
Rhyme and Reason.






Last edited by falagar8; 10/06/08 16:36.
Re: Very bad if [Re: falagar8] #230556
10/06/08 17:39
10/06/08 17:39
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
boy, can I be dumb
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: Very bad if [Re: sadsack] #230575
10/06/08 19:20
10/06/08 19:20
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hi all,

Well I think I made right all that you said was wrong.
Here is the full code:
Code:

#include <acknex.h>;
#include <default.c>;


ENTITY* ship;
function camera_ship();
function camera_walking();


var campla =1;





action act_ship()
{
ship = me;
me.ambient = 10;
while(1)
{
	if (campla==1)
     {
      
     	canera_ship();
     }
     
   else
   
     if(campla == 0) 
    {
 
    cam_walking();
   }
   
   if (key_z) {me.pan += 3*time_step;}
if (key_x) {me.pan -= 3*time_step;}
if (key_a){c_move (me,vector( 5,0,0),nullvector,NULL);}
if (key_s){c_move (me,vector( -5,0,0),nullvector,NULL);}
if (key_q){c_move (me,vector( 0,0,1),nullvector,NULL);}
if (key_e){c_move (me,vector( 0,0,-1),nullvector,NULL);}
if (key_c) {me.tilt += 3*time_step;}
if (key_v) {me.tilt -= 3*time_step;}
if (key_r) {me.roll -= 3*time_step;}
if (key_t) {me.roll += 3*time_step;}	




wait(1);
}
}


function main()
{
video_screen = 2;
video_mode = 6;
level_load ("place.wmb");
ent_create("ship.mdl", vector(0,0,0),NULL);
}






function camera_ship()

 {
 
 	
 vec_set(camera.x,ship.x);
  vec_set(camera.y,ship.y);
  vec_set(camera.z,ship.z);// move the camera together with the ship entity
  vec_set(camera.pan,ship.pan);	
 	
 	
}



function camera_walking()

{
	
	
vec_set(camera.x, vector(-300, 0, 0));	
	
	
	
}





I still get the same error (undeclared identifier) and it at this line.
if (campla==1)
what need to be identifi???
Thank You
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: Very bad if [Re: sadsack] #230581
10/06/08 19:48
10/06/08 19:48
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Ralph Offline
Senior Member
Ralph  Offline
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
this:
Code:
if (campla==1)
     {
      
     	canera_ship();
     }
     
   else
   
     if(campla == 0) 
    {
 
    cam_walking();
   }


should be this:
Code:
if (campla==1)
     {
      
     	canera_ship();
     }
     
   else{
   
     if(campla == 0) 
    {
 
    cam_walking();
   }
}


So he was right!

Ralph

Re: Very bad if [Re: Ralph] #230590
10/06/08 20:32
10/06/08 20:32
Joined: Sep 2008
Posts: 66
falagar8 Offline
Junior Member
falagar8  Offline
Junior Member

Joined: Sep 2008
Posts: 66

@sadsack,

not dumb.
Perhaps, get confuse and miss a matching bracket, or semicolon. I know I do a lot.

but all of these are fine and legal syntax:

Code:
 if(campla==1)
{  
       canera_state();
     
}  
else
{

     if(campla == 0) 
      cam_walking();
   
   
   
}


 if(campla==1)
 {  canera_state();}  
 else
 {  if(campla == 0) 
     cam_walking();  }

 if(campla==1) {  canera_state();}  
 else {  if(campla == 0) 
            cam_walking();  }


as long as the keywords are there and the matching brackets. And with the semicolons too.
Which form and style is better and more readable to each coder. And also if you program on a team or at a company and which is the standard or acceptable forms for the team, supervisor, boss, contractor involved.

Re: Very bad if [Re: falagar8] #230598
10/06/08 21:45
10/06/08 21:45
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Well I have tryed all of the above ways and I still get the same error.
the error as to do with this line
if(campla==1)
it stop compiling at that line.

I have tryed a test if statement and it works fine. There is something in this code that is bad.

I have this computer that I have on the web and my work computer that have never been on the web. Some time I make a mistake taking it from the work computer and putting it on this computer.
I have tryed all of the above and at this

boy, I found the problem

problem= { canera_state();}
right= { camera_state();}

Thanks
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: Very bad if [Re: sadsack] #230602
10/06/08 22:04
10/06/08 22:04
Joined: Sep 2008
Posts: 66
falagar8 Offline
Junior Member
falagar8  Offline
Junior Member

Joined: Sep 2008
Posts: 66

glad to hear that you found and corrected the problem.

Even, the Script editor can be intrusive.
Placing here and there extra comments and parenthesis. I know its for the aid of the coder and programmer.
But it would be better for me if I do the placing and postioning of these brackets, pound signs, semicolons, and parenthesis myself. Rather than having the editor with this method of developer presumptions and second hand guessing.

unless there is a way to turn off this feature?

Page 1 of 2 1 2

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