Old bos scripts spitting out invalid piecids?

Old bos scripts spitting out invalid piecids?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Old bos scripts spitting out invalid piecids?

Post by smoth »

[f=0007444] Warning: t61: weapon2: Neither AimFromWeapon nor QueryWeapon defined or returned invalid pieceids

I fired up gundam the other day and suddenly I have these errors.

So I opened bos and s3o and sure enough the piece names were right as they were years ago. So why is this error showing now?

Code: Select all

AimFromWeapon1(piecenum)
	{	
		piecenum=turret;	
	}

QueryWeapon1(piecenum)
	{	
		if (shooting_num) 
		{
			piecenum = flarea;
		} 
		else 
		{
			piecenum = flareb;
		}   
	}
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

seems odd, what was the change that made this come up?

I mean it is an easy thing to ducttape and bubblegum but why did the script never kick out errors before?
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by hokomoko »

smoth wrote:[f=0007444] Warning: t61: weapon2: Neither AimFromWeapon nor QueryWeapon defined or returned invalid pieceids
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

I find it strange that now it errors. Was some work put into that code?
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by hokomoko »

yes
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Old bos scripts spitting out invalid piecids?

Post by Forboding Angel »

smoth wrote:I find it strange that now it errors. Was some work put into that code?
I'm sure you already know this at this point, but as far as I can tell, this happens when you have more weapons defined in the unitdef than actually exist in the script.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Old bos scripts spitting out invalid piecids?

Post by Jools »

Why not define those functions for weapon2 as well and get rid of the error? Yes, the warning was added in a recent engine version...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

cool! I like more error messages!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Old bos scripts spitting out invalid piecids?

Post by Forboding Angel »

Yeah, I'm really liking the error reporting in 102-rc1, it seems far more robust than it has ever been. It's also more of a fulfillment of one of my bitching threads many many years ago where I was complaining that infolog was not verbose enough. It's to the point now that infolog tells you pretty much everything you could possibly want to know. Daddy liek.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

Any thoughts on this?
unitname weapon1: Neither AimFromWeapon nor QueryWeapon defined or returned invalid pieceids
unitname weapon2: Neither AimFromWeapon nor QueryWeapon defined or returned invalid pieceids

Code: Select all

piece base, 
arm1, dish1, arm2, dish2,
turret1, barrel1, turret2, barrel2,
flare1, flare2, flare3, flare4;

static-var shooting_numa, shooting_numb;

#define smallvulcan 1024+0

#define SIG_AIM_1 2
#define SIG_AIM_2 4
#define SMOKEPIECE1 base 
#define ANIM_VARIABLE TRUE

#include "/headers/smoke.h";

	
Create()
	{
	shooting_numa = 0;
	shooting_numb = 0;
	
	turn turret1 to y-axis <-90>	now;
	turn turret2 to y-axis <90>		now;
		
	turn arm1	 to x-axis <8>		now;
	turn dish1	 to x-axis <-8>		now;
	turn arm2	 to x-axis <-8>		now;	
	turn dish2	 to x-axis <8>		now;		
	start-script SmokeUnit();
	}

QueryWeapon1(piecenum)
	{
	 if (shooting_numa==1) 
	 {	 piecenum=flare1;     }
     
     if (shooting_numa==2) 
     {   piecenum=flare2;     }  
	}
	
QueryWeapon2(piecenum)
	{
	 if (shooting_numb==1) 
	 {	 piecenum=flare3;     }
     
     if (shooting_numb==2) 
     {   piecenum=flare4;     }  
	}
	

AimWeapon1(heading,pitch)
	{
	signal SIG_AIM_1;
	set-signal-mask SIG_AIM_1;
		
		turn turret1	to y-axis heading speed <205>;
		turn barrel1	to x-axis (<0>-pitch) speed <290>;
		
		wait-for-turn turret1	around y-axis;		
		wait-for-turn barrel1	around x-axis;
	
		return(TRUE);
	}
	

AimWeapon2(heading,pitch)
	{
	signal SIG_AIM_2;
	set-signal-mask SIG_AIM_2;
		
		turn turret2	to y-axis heading speed <205>;
		turn barrel2	to x-axis (<0>-pitch) speed <290>;
		
		wait-for-turn turret2	around y-axis;		
		wait-for-turn barrel2	around x-axis;
	
		return(TRUE);
	}
	
FireWeapon1()
	{
			if(shooting_numa==1)
			{	emit-sfx smallvulcan 		from flare1;		}
			
			if(shooting_numa==2)
			{	emit-sfx smallvulcan 		from flare2;		}
	
	shooting_numa = shooting_numa+1;
		
	if( shooting_numa == 3)
		{ shooting_numa = 1; }
	}
		
FireWeapon2()
	{
			if(shooting_numb==1)
			{	emit-sfx smallvulcan 		from flare3;		}
			
			if(shooting_numb==2)
			{	emit-sfx smallvulcan 		from flare4;		}
	
	shooting_numb = shooting_numb+1;
		
	if( shooting_numb == 3)
		{ shooting_numb = 1; }
	}

Killed( severity, corpsetype )
	{
	corpsetype = 3;
	explode base type		SHATTER | EXPLODE_ON_HIT;
	return( 0 );
	}
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

I have a physical condition i am struggling with that makes sight difficult. Even that asside i cannot "see it." As in i am somehow missing it, i dunno, it was the first tims i sat down to read code in over a year because each time it might trigger a migraine, it is a huge step.

I hope one day you grow up. You see how dead is is around here? I don't see you generating content. I am trying to come back and get stuff done. How after all these years you still hate me is beyond me. Please stop.

Does anyone see what i am missing here?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Old bos scripts spitting out invalid piecids?

Post by yuritch »

Your Create() function sets both shooting_numa and shooting_numb to 0, and your QueryWeapon1() and QueryWeapon2() only check for 1 and 2. So for 0 there is no return value -> you get those warnings.

Modify Create() to set those variables to 1 instead.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

oh yeah, that is what the old bug was about! it WAS right under my nose. Geeze! thanks yuritch
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

If i understand/remeber it correctly, query weapon is now called before create() at least 1 time, which might be why it is an issue now.

Most of the scripts still set 1 in create, which could still trigger it right? Sloppy or not i just converted a bunch of if statements to allow for an else to have an assumed emit point prior to create().
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by hokomoko »

Query can't be called before Create.
The issue is exactly what yuritch stated - the query functions don't handle the initial value of 0.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

other scripts generating the same error had 1 in create()
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Old bos scripts spitting out invalid piecids?

Post by smoth »

IMMA take a look maybe thursday morning in depth, I am just getting these old garbage bos files running for my local copy of GRTS then I am going to convert everything in it to use that universal unit script I was working on.
Post Reply

Return to “Game Development”