Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Bot Code Problem
Bot Code Problem
2001-04-16, 7:21 PM #1
Alright you will have to be good to understand what this means ... it's a peice of code from my Godlike Rbots.



if(DistToTarg >= .8)
{
if(acid == 1 && getthingflags(target) & 0x2000000 && !getthingflags(rbot) & 0x2000000) call sidestep;
if(acid == 1 && getthingflags(target) & 0x2000000 && getthingflags(rbot) & 0x2000000) call acid_to_acid_tatics;
if(acid == 1 && !getthingflags(target) & 0x2000000 && getthingflags(rbot) & 0x2000000) call acid_to_ground_tatics;
if(acid != 1 && !getthingflags(target) & 0x2000000 && getthingflags(rbot) & 0x2000000) call water_to_ground_tatics;
if(acid != 1 && !getthingflags(target) & 0x2000000 && getthingflags(rbot) & 0x2000000) call water_to_ground_tatics;
AiSetMovePos(rbot, GetThingPos(target));
}
else if(curweap != 5) call sidestep; else AiSetMovePos(rbot, GetThingPos(target));
if (VectorLen(GetThingVel(rbot)) < 2.3 && !(getthingflags(rbot) & 0x2000000)) AddThingVel(rbot, VectorScale(GetThingVel(rbot), 0.33));

Bassicly it means that if the target is far away , it will move toward the target, and at the same time if it's in water/acid it will call apon special tatics

After that if it's upclose and the bot doesn't have a flak cannon , move out of the way before it gets hit, else if it does have a flak cannon move right up to the target.

Note: Acid also counts for lava, deadly water and other types of hurtful water.

Now the problem , the bots just don't work , I don't know if it's a synax problem , no idea

Can someone help me ?
2001-04-17, 6:34 AM #2
First of all, I think it's a syntax error.

I think it should be something along the lines of this:

Code:
if(acid != 1 && getthingflags(target) != 0x2000000 && getthingflags(rbot) == 0x2000000) call water_to_ground_tatics;


Of course, I may very well be wrong, but you'll have to try it.

------------------
LordVirus: His pot is blacker than his kettle!

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-04-17, 7:14 AM #3
Syntax is fine, checked it with cogwriter.

------------------
Together we stand.
Divided we fall.
2001-04-17, 12:42 PM #4
Siefer, you may need to put brackets around each comparison where you use the bitwise AND. I don't know if the compiler is trying to compare the logical AND (&&) before the bitwise AND (&).

ie:
Code:
if(acid == 1 && (getthingflags(target) & 0x2000000) && (!getthingflags(rbot) & 0x2000000)) call sidestep;


btw if anyone wants to know, 0x2000000 thing flag refers to the actor or player being underwater.

Raynar

------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2001-04-17, 2:47 PM #5
I've been writing codes as you said, I put brackets around each elements of the bitwise and.

And if you got problems along with the functions called by "call", we won't know what the problem may be.

------------------
http://millennium.massassi.net/ - Millennium
2001-04-17, 3:43 PM #6
Well thanks Raynar I'll try it out

No Hekei the call fuction is ok , I put printed in the tatics and they worked, and yes 0x2000000 is under water , but at the start if it recives a message from the start up cog of Acid or lava level, it will tell the bots that there playing on a acid or lava level and do that.
2001-04-19, 1:40 PM #7
these look like they will be pretty smart bots
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-19, 2:04 PM #8
May look a bit clearer if you use "else" more. Might do some change, but not sure.

And that's about 50% or less of my name seifer.


Code:
if(DistToTarg >= .8)
{
	if(acid)
	{
		if(getthingflags(target) & 0x2000000)
		{
			if(!getthingflags(rbot) & 0x2000000) call sidestep;
			else call acid_to_acid_tatics;
		}
		else if(getthingflags(rbot) & 0x2000000) call acid_to_ground_tatics;
	}
	else if( (!getthingflags(target) & 0x2000000) && (getthingflags(rbot) & 0x2000000) ) call water_to_ground_tatics;


	AiSetMovePos(rbot, GetThingPos(target)); 
} 
else
{
	if(curweap != 5) call sidestep;
	else AiSetMovePos(rbot, GetThingPos(target)); 
}


if( (VectorLen(GetThingVel(rbot)) < 2.3) && !(getthingflags(rbot) & 0x2000000)) AddThingVel(rbot, VectorScale(GetThingVel(rbot), 0.33));


------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited April 19, 2001).]
2001-04-20, 7:44 PM #9
lol thanks i'll try it

I'm sorry Hideki lol , I do it all the time with Raynar too.

I'm just in such a rush.
2001-04-20, 7:44 PM #10
lol thanks i'll try it

I'm sorry Hideki lol , I do it all the time with Raynar too.

I'm just in such a rush.

↑ Up to the top!