cloneID function

You must understand the Game Editor concepts, before post here.

cloneID function

Postby feral » Sun Jul 13, 2008 6:55 am

OK, I just wrote out a very small function, that I believe will do away with getclone2(), as it primarily does the same thing, but it can also be used with many other functions not just getclone().

I call it cloneID and it basically allows any function to work like getclone2().

In nutshell getclone2() simply parses a "string and int" combo, which allows the original getclone() to be used in loops, because you can then name the index number separately and/or by a variable.

see getclone2() here viewtopic.php?f=5&t=711&p=40387&hilit=getclone2#p40387

However, that same idea, can be used with all GEs built functions and not just getclone(),

But, rather the rewrite all GE functions to have a second version eg: DestroyActor() and DestroyActor2(), I would suggest we remove the piece of code from getclone2() that allows it to work, and instead, make a new multipurpose function that allows ANY and ALL Ge functions to work the same way .. ie: the way getclone2() can work

and by this, I mean a small function that recreate the clonename using individual names and index's (actual or variables)..which can be inserted in place of an "actual name" in any function

Code: Select all
char buffer[50];
//---function cloneID-----------------------

char *cloneID(const char *cname, int cindex)
{
sprintf(buffer,"%s.%d",cname,cindex);
return buffer;
}


you can see that this is the part that allows getclone2(), to work

but as separate function it can still be used by the original getclone() without the need for getclone2.

eg: create function called cloneID()

now getclone works like getclone2

getclone(cloneID("test",2))

BUT, more importantly it allows ANY function that takes a clonename.index combo.. to work in the same way

example
Code: Select all
for (i=1;i<=7;i++)
{
      DestroyActor(cloneID("test",i)); //destroys all clones with index between 1 and 7
}


this also works with functions like ChangeAnimation() changtransparency() etc etc

example
ChangeAnimation(cloneID("test",i), "jumping", FORWARD); //changes animation of clone test.i to "jumping"

any thoughts? ... suggestions ? ... its not needed feral you dope ?

note: I do have a few little problems with it, so I really need a good coder to make this function the best it can be..
see the issues here viewtopic.php?f=2&t=5928

feral
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: cloneID function

Postby speckford123 » Tue Aug 05, 2008 2:28 pm

feral wrote:its not needed feral you dope ?


your no dope, your alot better with code than i am, :lol: and this for example can be usefull for certain things, +point!
speckford123
 
Posts: 334
Joined: Fri May 05, 2006 6:33 pm
Score: 49 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest