|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_create
#118420
03/20/07 14:43
03/20/07 14:43
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
When I create a sprite with; Code:
string sign; // declare an empty, unlimited string
funtion blabla() { .............. str_cpy(sign," "); // make the string empty str_cpy(sign,"abc.bmp"); // set sprite in sign ent_create(sign,vector(x,y,z)); // place sprite on screen .............. .............. }
that works perfect, but now I want to remove the sprite again because I want to create and show an other sprite in 'sign'. I tried it with ent_remove, but that does not work, it has to be an entity. Does anyone know how I can do that?
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: ent_create
[Re: Frits]
#118422
03/20/07 14:52
03/20/07 14:52
|
Joined: Apr 2005
Posts: 2,332 Germany, BaWü
aztec

Expert
|

Expert
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
|
Quote:
Code:
string sign; // declare an empty, unlimited string entity* to_delete;
funtion blabla() { .............. str_cpy(sign," "); // make the string empty str_cpy(sign,"abc.bmp"); // set sprite in sign to_delete =ent_create(sign,vector(x,y,z)); // place sprite on screen .............. .............. }
later then just call ent_remove(to_delete); hope this helps 
Visit: schwenkschuster-design.de
|
|
|
Re: ent_create
[Re: aztec]
#118423
03/20/07 15:15
03/20/07 15:15
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
Thanks guys for the quick response. I changed the script in; Code:
string sign; // declare an empty, unlimited string entity* sign_sprite;
funtion blabla() { .............. ent_remove(sign_sprite); // remove previous sprite str_cpy(sign," "); // make the string empty str_cpy(sign,"abc.bmp"); // set sprite in sign sign_sprite=ent_create(sign,vector(x,y,z)); // place sprite on screen .............. .............. }
but then ofcource I get an error, because the entity is empty with the first call. How can I check if the entity has a value? (like with a var fisttime 'if(firsttime==0)' or something like that?)
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: ent_create
[Re: Slin]
#118426
03/20/07 15:33
03/20/07 15:33
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
Thanks Slin, I think I am working to long, not thinking straight anymore. How simple can the solution be.
Aztec, this is explained in my initial post, 'I want to remove the sprite again because I want to create and show an other sprite in 'sign'. So, I can't set the ent_remove at the end of the function, first remove the previous and than create a new one.
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
|