Page 1 of 2

collide.MY new problem.(RESOLVED)

PostPosted: Tue Mar 10, 2009 4:48 pm
by equinox
Hi at ALL,

when EROE_1 collide with PP (1 heart), the event..... does not work.

where wrong?

Tnk1000 x help.

Re: collide.name problem.

PostPosted: Tue Mar 10, 2009 8:15 pm
by zygoth
I'm no expert, but I believe the best way would be to use the strcmp function which compares two strings and returns a variable based on the result. something like

if(strcmp(collide.name,"PP") ==1)ExitGame();

strcmp returns 1 if the strings are the same, 0 if not.
Can anybody else verify this? I don't think you can compare strings with mathematical symbols.
Hope this helps.

Zygo

Re: collide.name problem.

PostPosted: Wed Mar 11, 2009 12:23 am
by skydereign
zygoth is right. But you can't use name, you would have to use clonename to make this work.

Re: collide.name problem.

PostPosted: Wed Mar 11, 2009 1:37 am
by DST
just use an integer. Save yourself a lot of trouble.

give each actor a unique id and class id on startup.

id=gid;
gid++;

and a class id
classid=5; //or whatever the appropriate number should be.

now just ask for collide.classid to know the TYPE of actor, or collide.id to know the unique id of the actor.

You can make an array to hold the names for the id's, and access that when you need the string for displaying.

Strings should not be an integral part of events; they are slow and bulky and computers hate them. Your computer hates you for using them. They should be only for display for the users.

Use numbers, I promise it'll make your life a lot easier.

Re: collide.name problem.

PostPosted: Wed Mar 11, 2009 1:26 pm
by equinox
Tnk ALL, for help me.

I use COLLIDE.NAME...and work!!

Now I try with getclone,,after with Id = 5.

Re: collide.name problem.

PostPosted: Wed Mar 11, 2009 1:44 pm
by equinox
if(strcmp(collide.name,"PP") == 0){
//ExitGame();
getclone("STAMPO.7")->textNumber = collide.cloneindex;<----work

...but...

DestroyActor("collide.cloneindex");<---- NO!!!
DestroyActor(collide.cloneindex);<---- NO!!! to destroy the heart with which the EROE collide.
DestroyActor("collide.name);<---- NO!!!

Please: where i wrong?

Tnk1000 for all help me.

Re: collide.name problem.

PostPosted: Wed Mar 11, 2009 11:45 pm
by skydereign
For this, just use destroy actor.
Code: Select all
DestroyActor("Collide Actor");

Re: collide.name problem.

PostPosted: Thu Mar 12, 2009 1:01 pm
by equinox
Tnks. +1Point

collide.DO_HP == "HP +"<--not work

PostPosted: Sun Mar 15, 2009 7:41 pm
by equinox
HI,
DO_HP = 150; actor int var
DO_TIPO = "HP +" actor string var

hp = collide.DO_HO<--work....
..but..

if (collide.DO_TIPO == ""HP +){
.......
}..NOT.

Can help me,please?

Re: collide.MY new problem.

PostPosted: Sun Mar 15, 2009 7:47 pm
by skydereign
I think that is because that is an actor string variable.
Code: Select all
if (strcmp(collide.DO_TIPO,"HP +")
{
    //
}

Re: collide.MY new problem.

PostPosted: Sun Mar 15, 2009 7:52 pm
by equinox
PERFECT!!!!!!!!!!!

many TNk1000 for yor kindley help me.

(collide.name,ATTORE[0])<------#2 new problem.

PostPosted: Fri Mar 27, 2009 7:17 pm
by equinox
HI at ALL,

in create START:
Actor *ATTORE[3];
ATTORE[0] = CreateActor("EROE_1", "STOP_GIU", "(none)", "(none)", 160, 116, false);// Creo LEONE


in collision any actor for ENEMY:
if(strcmp(collide.name,ATTORE[0]) == 0){<---NOT WORK.
ExitGame();
}
..please: there is solution?

Tnk1000.

Re: collide.MY new problem.

PostPosted: Fri Mar 27, 2009 9:13 pm
by makslane
You variable ATTORE is an actor, not a string.
Try:

Code: Select all
if(strcmp(collide.name,ATTORE[0].name) == 0)
{
  ExitGame();
}

Re: collide.MY new problem.

PostPosted: Sat Mar 28, 2009 11:13 am
by equinox
...if(strcmp(collide.name,ATTORE[0].name) == 0)<--- error !!

if(strcmp(collide.name,ATTORE[0]->name) == 0){<---work...but collide with any ATTORE[0].n

Re: collide.MY new problem.

PostPosted: Sat Mar 28, 2009 6:21 pm
by skydereign
What do you mean with any ATTORE[0].n? Switching it to point to name should work, but it seems that is not what you want... ATTORE[0] points to an actor you have created, and is ATTORE not specific to your actor. The actor should correspond with the pointer, otherwise PP will collide and use ATTORE[0]'s information. I believe that is the problem, but you would need to change your approach to fix it. Can you explain what you are trying to do?