Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
removing all entities in a level #138412
06/27/07 17:57
06/27/07 17:57
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
can anyone tell me what's wrong with this code?
it gives me an "invalid arguments ... : ent_remove(ent_to_remove);"

Code:

entity* ent_to_remove;

you = ent_next(null);
while(you)
{
ent_to_remove = you;
you = ent_next(you);
ent_remove(ent_to_remove);
}



thx


~"I never let school interfere with my education"~
-Mark Twain
Re: removing all entities in a level [Re: Germanunkol] #138413
06/27/07 21:46
06/27/07 21:46
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hi,

your code seems to be all right, because for me it works perfectly.

Do you have declared the entity pointer internally? This would cause an error as it has to be global.

Other than that, I have no idea why this error occurs..

Re: removing all entities in a level [Re: Fenriswolf] #138414
06/28/07 09:04
06/28/07 09:04
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
@ Germanunkol:
Ich würde mal nachgucken wer das ausfürht wenn es nämlich eine entity ist dann kommt das Problem you=my und ich denke dass daher der Fehler kommt....


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: removing all entities in a level [Re: Puppeteer] #138415
06/28/07 12:31
06/28/07 12:31
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Hm... it's a global entity pointer.
I tried changing its name as well... nothing.
And, der_Omega, it's a button that executes the function... not an entity. so... hm
Thx for answering!
but my problem remains...
this is the entire function:

Code:

function new_single_O()
{
you = ent_next(null);
while(you)
{
removed_atom = you;
ent_remove(removed_atom);
you = ent_next(you);
}
selected_atom = ent_create(oxygen_mdl,nullvector,oxygen);
}




~"I never let school interfere with my education"~
-Mark Twain
Re: removing all entities in a level [Re: Germanunkol] #138416
06/28/07 13:00
06/28/07 13:00
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Why don't you do it like that:
Code:

function new_single_O()
{
you = ent_next(null);
while(you)
{
ent_remove(you);
you = ent_next(you);
}
selected_atom = ent_create(oxygen_mdl,nullvector,oxygen);
}




Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: removing all entities in a level [Re: Puppeteer] #138417
06/28/07 13:14
06/28/07 13:14
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
@der_Omega: because you is empty after the ent_remove...
@Germanunkol: I had some problems with panels and pointers before. try to set my = 0; and you = 0; though I don´t see a problem in it when they would be set...

Slin

Re: removing all entities in a level [Re: Slin] #138418
06/28/07 13:30
06/28/07 13:30
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
damn i am stupid
but removed_atom would be empty too?


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: removing all entities in a level [Re: Puppeteer] #138419
06/28/07 13:33
06/28/07 13:33
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
but this would work:
Code:

function new_single_O()
{
you = ent_next(null);
while(you)
{
removed_atom = you;
you = ent_next(removed_atom);
ent_remove(removed_atom);
}
selected_atom = ent_create(oxygen_mdl,nullvector,oxygen);
}




Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: removing all entities in a level [Re: Puppeteer] #138420
06/28/07 15:27
06/28/07 15:27
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hey Germanunkol, you have posted two different codes! The order of instructions isn't the same (ent_remove is interchanged with you=...).
The second version should fire an error, but the first one is similar to Omega's suggestion an should work.

Re: removing all entities in a level [Re: Fenriswolf] #138421
06/28/07 15:43
06/28/07 15:43
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
@Germanunkol,

I've tested 2 sets of your code in A6.60, all works without error.
I suppose all entity pointers are declared outside all functions.

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1