Page 1 of 1

Get animation name of collided actor?

PostPosted: Fri Aug 26, 2011 10:59 pm
by ikarus
I have three actors that are all very very similar. I realized that it may be faster just have one actor that has all three animations and just specify the animation name through CreateActor. But each actor has a different collision even. I figured that I just need one even and specify a different thing depending on the animation name. I've been looking around on how to get it, but I'm not quite sure.

I tried using GetAnimName but it still only returns an animation of the even actor even if I give it collide.animindex.
Any ideas?

Re: Get animation name of collided actor?

PostPosted: Fri Aug 26, 2011 11:17 pm
by ikarus
Okay moved forward a bit, I made a type actor string variable and when the actor is created I do this:

Code: Select all
ctype = strcpy(type, GetAnimationName(animindex));


Then I have this in the collide even script editor:

Code: Select all
char ctype;
strcpy(ctype, collide.type);


But when my animation name is blue, this doesn't return true:

Code: Select all
if(ctype == "blue")


I know it's getting the right animation name cause I've made it also strcpy the type to a global char that I have a text actor updating from, and when I hit it the text actor prints out "blue". My only guess is that the name returned is a slightly different string than "blue"???

How would the string actually look like if I use strcpy?????

[edit]
fixed code typo above

Re: Get animation name of collided actor?

PostPosted: Fri Aug 26, 2011 11:41 pm
by Jagmaster
I believe to check a string's vale you use strcmp:
Code: Select all
if( strcmp(ctype, blue)==1)
{
//
}

Re: Get animation name of collided actor?

PostPosted: Fri Aug 26, 2011 11:51 pm
by ikarus
Jagmaster wrote:I believe to check a string's vale you use strcmp:
Code: Select all
if( strcmp(ctype, blue)==1)
{
//
}


still not working, sigh :/
What would cause two strings to not equal each other not, when they look the same?

Re: Get animation name of collided actor?

PostPosted: Fri Aug 26, 2011 11:56 pm
by ikarus
wait something ain't right cause if(strcmp("blue","blue")==1) isn't working :| :| :| :| :?:

Re: Get animation name of collided actor?

PostPosted: Sat Aug 27, 2011 12:02 am
by Jagmaster
whoops! My bad, It needed to be this:
Code: Select all
    if( strcmp(ctype, blue)==0)
    {
    //
    }

Dumb mistake. If it still doesn't work, Idk what the problem is. :P

Re: Get animation name of collided actor?

PostPosted: Sat Aug 27, 2011 12:04 am
by ikarus
---Down't matter anymore---

Re: Get animation name of collided actor?

PostPosted: Sat Aug 27, 2011 12:07 am
by ikarus
Jagmaster wrote:whoops! My bad, It needed to be this:
Code: Select all
    if( strcmp(ctype, blue)==0)
    {
    //
    }

Dumb mistake. If it still doesn't work, Idk what the problem is. :P

For a second you had me sure my computer was out to destroy everything I ever hoped to achieve lol

Thanks alot :D

Re: Get animation name of collided actor?

PostPosted: Sat Aug 27, 2011 12:10 am
by Jagmaster
Yeah, sorry about that. :oops: