Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
undeclared identifier #179125
01/21/08 17:49
01/21/08 17:49
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
Somewhere in my script, I have this code:

Code:
function func_get_uzi(){
if(debug_has_gun == 1){ent_remove(current_weapon);debug_has_gun = 0;debug_tmp = 1;}
muzzledistance = 50;
current_weapon = me;
debug_has_gun = 1;
bullets = 20;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 0.5;
me.scale_y = 0.5;
me.scale_z = 0.5;
current_weapon.tilt = camera.tilt + 10;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
action gun_uzi(){
c_setminmax(my);
weap_uzi = my;
my.emask |= ENABLE_IMPACT;
my.event = func_get_uzi;
while(1){
if(vec_dist(weap_uzi.x,player.x)<120){
debug_gun_range = 1;
hand_pan.flags = VISIBLE;
hand_txt.pos_x = screen_size.x / 2;
hand_txt.flags = VISIBLE | CENTER_X;
}else{
debug_gun_range = 0;
hand_pan.flags = 0;
hand_txt.flags = 0;
}
my.pan = my.pan + 0.5;
wait(1);
}
}


But it gives me a undeclared identifier error at this line:

my.event = func_get_uzi;

'func_get_uzi' undeclared identifier

What can be the problem?


The best games are the games you create yourself.
Re: undeclared identifier [Re: NL_3DGS_n00b] #179126
01/21/08 18:34
01/21/08 18:34
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
You probably forgot a semicolon (;) or some bracket ({) somewhere above that function.

Last edited by Joozey; 01/21/08 18:35.

Click and join the 3dgs irc community!
Room: #3dgs
Re: undeclared identifier [Re: Joozey] #179127
01/21/08 18:43
01/21/08 18:43
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
This is the WHOLE guns.c script:

Code:
ENTITY* weap_uzi;
ENTITY* weap_m4a1;
ENTITY* hand_weap_uzi;
ENTITY* hand_weap_m4a1;
ENTITY* current_weapon;

ENTITY* muzzle_uzi;

SOUND* shot = "shot1.wav";

var muzzledistance;
var shot_handle;


// Weapon thumnails on screen when weapon is in hand
BMAP* uzi_tga = "uzi_icon.tga";
PANEL* uzi_icon ={pos_x = 885;pos_y = 598;layer = 10;bmap = uzi_tga;alpha = 25;}

// Muzzle images
BMAP* muzzle_uzi_tga = "muzzle.tga";
PANEL* muzzle_uzi_pan ={layer = 30;bmap = muzzle_uzi_tga;alpha = 100;}

// Crosshairs
BMAP* pointer1_tga = "pointer.tga";
PANEL* pointer1_pan ={pos_x = 487;pos_y = 359;layer = 2;bmap = pointer1_tga;alpha = 100;}

// General
BMAP* hand_tga = "hand.tga"; // Hand icon if close to weapon
PANEL* hand_pan ={pos_x = 462;pos_y = 334;layer = 3;bmap = hand_tga;alpha = 100;flags = OVERLAY;}
TEXT* hand_txt={alpha = 100;pos_x = 10;pos_y = 450;font = arial_font;string("Pickup Weapon (E)");}

function remove_guns(){
ent_remove(hand_weap_uzi);
ent_remove(hand_weap_m4a1);
}

function muzzle(){
if(automatic == 1){
while(mouse_left){
if(bullets > 0){
shot_handle = snd_play(shot, 100, 0);
current_weapon.tilt = camera.tilt + 13;
bullets = bullets - 1;
debug_muzzle_show = 1;
muzzle_uzi = ent_create("muzzle2.tga",vector(300,300,300),NULL);
muzzle_uzi.alpha = 40;
muzzle_uzi.flags = VISIBLE | OVERLAY | BRIGHT | TRANSLUCENT | PASSABLE;
muzzle_uzi.x = current_weapon.x + muzzledistance;
muzzle_uzi.y = current_weapon.y + 0;
muzzle_uzi.z = current_weapon.z;
var tmpx = random(0.1)+0.1;
var tmppan = random(359);
muzzle_uzi.scale_x = tmpx;
muzzle_uzi.scale_y = tmpx;
muzzle_uzi.roll = tmppan;
vec_diff(temp1,muzzle_uzi.x,current_weapon.x);
vec_set(muzzle_uzi.x,temp1.x);
vec_rotate(muzzle_uzi.x,current_weapon.pan);
vec_add(muzzle_uzi.x,current_weapon.x);
muzzle_uzi.ambient = 100;
wait(-0.1);
muzzle_uzi.flags = 0;
ent_remove(muzzle_uzi);
debug_muzzle_show = 0;
current_weapon.tilt = camera.tilt + 10;
shot_handle = snd_stop(shot, 100, 0);
}
wait(1);
}
}else{
if(bullets > 0){
bullets = bullets - 1;
debug_muzzle_show = 1;
muzzle_uzi = ent_create("muzzle2.tga",vector(300,300,300),NULL);
muzzle_uzi.alpha = 40;
muzzle_uzi.flags = VISIBLE | OVERLAY | BRIGHT | TRANSLUCENT | PASSABLE;
muzzle_uzi.x = weap_uzi.x + muzzledistance;
muzzle_uzi.y = weap_uzi.y + 0;
muzzle_uzi.z = weap_uzi.z;
var tmpx = random(0.1)+0.1;
var tmppan = random(359);
muzzle_uzi.scale_x = tmpx;
muzzle_uzi.scale_y = tmpx;
muzzle_uzi.roll = tmppan;
vec_diff(temp1,muzzle_uzi.x,weap_uzi.x);
vec_set(muzzle_uzi.x,temp1.x);
vec_rotate(muzzle_uzi.x,weap_uzi.pan);
vec_add(muzzle_uzi.x,weap_uzi.x);
muzzle_uzi.ambient = 100;
wait(-0.1);
muzzle_uzi.flags = 0;
ent_remove(muzzle_uzi);
debug_muzzle_show = 0;
}
}
}

//Dynamic gun actions, attached to gun in your hand
action uzi_action(){
muzzledistance = 50;
current_weapon = me;
debug_has_gun = 1;
bullets = 20;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 0.5;
me.scale_y = 0.5;
me.scale_z = 0.5;
current_weapon.tilt = camera.tilt + 10;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
action m4a1_action(){
muzzledistance = 210;
current_weapon = me;
debug_has_gun = 1;
bullets = 35;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 3;
me.scale_y = 3;
me.scale_z = 3;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
current_weapon.tilt = camera.tilt + 10;
if(bullets > 0 && bullets < 11){
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}

//function func_get_uzi;
//function func_get_m4a1;



// Gun functions
function func_get_uzi(){
if(debug_has_gun == 1){ent_remove(current_weapon);debug_has_gun = 0;debug_tmp = 1;}
muzzledistance = 50;
current_weapon = me;
debug_has_gun = 1;
bullets = 20;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 0.5;
me.scale_y = 0.5;
me.scale_z = 0.5;
current_weapon.tilt = camera.tilt + 10;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
function func_get_m4a1(){
if(debug_has_gun == 1){ent_remove(current_weapon);debug_has_gun = 0;debug_tmp = 1;}
muzzledistance = 210;
current_weapon = me;
debug_has_gun = 1;
bullets = 35;
automatic = 1;
pointer1_pan.flags = VISIBLE | OVERLAY;
hand_txt.flags = 0;
hand_pan.flags = 0;
me.scale_x = 3;
me.scale_y = 3;
me.scale_z = 3;
while(1){
current_weapon.x = camera.x + 100;
current_weapon.y = camera.y - 40;
current_weapon.z = camera.z - 30;
vec_diff(temp1,current_weapon.x,camera.x);
vec_set(current_weapon.x,temp1.x);
vec_rotate(current_weapon.x,camera.pan);
vec_add(current_weapon.x,camera.x);
current_weapon.pan = camera.pan + 10;
current_weapon.tilt = camera.tilt + 10;
if(bullets > 0 && bullets < 11){
uzi_icon.flags = VISIBLE | OVERLAY;
wait(1);
}
}
// Static Guns
action gun_uzi(){
c_setminmax(my);
weap_uzi = my;
my.emask |= ENABLE_IMPACT;
my.event = func_get_uzi;
while(1){
if(vec_dist(weap_uzi.x,player.x)<120){
debug_gun_range = 1;
hand_pan.flags = VISIBLE;
hand_txt.pos_x = screen_size.x / 2;
hand_txt.flags = VISIBLE | CENTER_X;
}else{
debug_gun_range = 0;
hand_pan.flags = 0;
hand_txt.flags = 0;
}
my.pan = my.pan + 0.5;
wait(1);
}
}
action gun_m4a1(){
c_setminmax(my);
weap_m4a1 = my;
my.emask |= ENABLE_IMPACT;
my.event = func_get_m4a1;
while(1){
if(vec_dist(weap_m4a1.x,player.x)<120){
debug_gun_range = 1;
hand_pan.flags = VISIBLE;
hand_txt.pos_x = screen_size.x / 2;
hand_txt.flags = VISIBLE | CENTER_X;
}else{
debug_gun_range = 0;
hand_pan.flags = 0;
hand_txt.flags = 0;
}
my.pan = my.pan + 0.5;
wait(1);
}

}


I can't find any missing semicolons or brackets...


The best games are the games you create yourself.
Re: undeclared identifier [Re: NL_3DGS_n00b] #179128
01/21/08 21:11
01/21/08 21:11
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline
Senior Member
oldschoolj  Offline
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
func_get_uzi neeeds to be declared before use, so at the beginning of your code add: function func_get_uzi():


you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: undeclared identifier [Re: oldschoolj] #179129
01/21/08 23:17
01/21/08 23:17
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
Quote:

func_get_uzi neeeds to be declared before use, so at the beginning of your code add: function func_get_uzi():



Already have tried that...
Still got exactly the same error.


The best games are the games you create yourself.
Re: undeclared identifier [Re: NL_3DGS_n00b] #179130
01/24/08 00:46
01/24/08 00:46
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

You have flags that are not set in the Lite-C way.

hand_txt.flags = VISIBLE | CENTER_X;

shoud be

hand_txt.flags |= (VISIBLE | CENTER_X);

This could be part of the problem
Hope this helps

Ottawa


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

Gamestudio download | 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