Page 1 of 1

Old bos scripts spitting out invalid piecids?

Posted: 10 Apr 2016, 17:11
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;
		}   
	}

Re: Old bos scripts spitting out invalid piecids?

Posted: 10 Apr 2016, 17:29
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?

Re: Old bos scripts spitting out invalid piecids?

Posted: 10 Apr 2016, 17:42
by hokomoko
smoth wrote:[f=0007444] Warning: t61: weapon2: Neither AimFromWeapon nor QueryWeapon defined or returned invalid pieceids

Re: Old bos scripts spitting out invalid piecids?

Posted: 11 Apr 2016, 03:23
by smoth
I find it strange that now it errors. Was some work put into that code?

Re: Old bos scripts spitting out invalid piecids?

Posted: 11 Apr 2016, 10:25
by hokomoko
yes

Re: Old bos scripts spitting out invalid piecids?

Posted: 11 Apr 2016, 11:39
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.

Re: Old bos scripts spitting out invalid piecids?

Posted: 11 Apr 2016, 12:31
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...

Re: Old bos scripts spitting out invalid piecids?

Posted: 11 Apr 2016, 17:12
by smoth
cool! I like more error messages!

Re: Old bos scripts spitting out invalid piecids?

Posted: 15 Apr 2016, 20:42
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.

Re: Old bos scripts spitting out invalid piecids?

Posted: 06 Sep 2016, 09:28
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 );
	}

Re: Old bos scripts spitting out invalid piecids?

Posted: 06 Sep 2016, 21:14
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?

Re: Old bos scripts spitting out invalid piecids?

Posted: 06 Sep 2016, 22:02
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.

Re: Old bos scripts spitting out invalid piecids?

Posted: 07 Sep 2016, 15:41
by smoth
oh yeah, that is what the old bug was about! it WAS right under my nose. Geeze! thanks yuritch

Re: Old bos scripts spitting out invalid piecids?

Posted: 07 Sep 2016, 18:31
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().

Re: Old bos scripts spitting out invalid piecids?

Posted: 07 Sep 2016, 19:49
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.

Re: Old bos scripts spitting out invalid piecids?

Posted: 07 Sep 2016, 22:04
by smoth
other scripts generating the same error had 1 in create()

Re: Old bos scripts spitting out invalid piecids?

Posted: 07 Sep 2016, 22:17
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.