Cloneindex Problem

Non-platform specific questions.

Cloneindex Problem

Postby tzoli » Tue Apr 24, 2012 1:06 pm

Hi. I have a little problem with the cloneindex.
What is the correct form of this?:
Code: Select all
    int i;
    i=cloneindex-1;
    block.i.type=0;


and this:
Code: Select all
    int i;
    i=cloneindex-1;
    if(block.i.type==0){
    ...
    }
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Cloneindex Problem

Postby Game A Gogo » Tue Apr 24, 2012 4:31 pm

instead of having block.i.type (Since the compiler in GE doesn't like that for some reason)

you'll need to use the GetClone function

Code: Select all
Actor tactor;//Temporary actor
int i;
char temp[256];//Temporary string holder
i=cloneindex-1;
sprintf(temp,"block.%d",i);
tactor=getclone(temp);//getclone returns a pointer to the mentioned actor.
//A pointer is a variable that points to a space in memory, in this case, tarctor will point to "block.i"
tactor->type=0;
//When dealing with pointer variables, you need to use the point-to (->) and not the .


Code: Select all
Actor tactor;
int i;
char temp[256];
i=cloneindex-1;
sprintf(temp,"block.%d",i);
tactor=getclone(temp);
if(tactor->type==0)
{
    //do something :)
}


if you need help with some explanation, just ask!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Cloneindex Problem

Postby tzoli » Tue Apr 24, 2012 5:30 pm

Thanks! :D Now it will be easier to change variables between a lot of actors. I gave a +
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest