Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ent_next #180192
01/27/08 18:56
01/27/08 18:56
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
hi,

ich möchte prüfen ob irgend ein entity den skill squad größer als 1 hat.
Dazu habe ich folgene funktion geschreiben, aber ich bekomme immer als fehler meldung, das der pointer you leer ist. Wo liegt dabei der fehler???
Code:
function show_squads()
{
var i = 1;
var counter1;
you = ent_next(null);

while(1)
{
if(i == 1)
{
if(you.squad == 1)
{
counter1 += 1;
}

you = ent_next(you);

if(you == null)
{
if(counter1 != 0)
{
squad1_pan.visible = on;
}
else
{
squad1_pan.visible = off;
}

i = 0; //reset var
counter1 = 0; //reset var
}
}

if(i == 0)
{
you = ent_next(null);
i = 1;
}

wait(1);
}
}



Mfg, Pingulord


3D Gamestudio A7 Extra
Re: ent_next [Re: Martek] #180193
01/28/08 08:11
01/28/08 08:11
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
ok, im gonna reply in english, my german isnt the best, but i can read it
I think what happens here, it goes through the loop normally. and comes to a point where you = null. then you set i to 0, and it quits the if that reads i == 1.
it comes in the other branch, and continues the ent_next, even though it was empty.
I think what you need there is simply: you = null;

that's what came to mind when reading through it real quick.
anyway, worth a try!

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: ent_next [Re: Helghast] #180194
01/28/08 12:56
01/28/08 12:56
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Thanks for your answer, but I can't imagine where I should place the you = null;
If it would help you, this is the problem. I copyed it out of the acklog.txt:

Empty pointer in show_squads: (you.squad==1) - any key to abort

Mfg, Pingulord


3D Gamestudio A7 Extra
Re: ent_next [Re: Martek] #180195
02/06/08 18:03
02/06/08 18:03
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Does nobody know where I must place the you = null; ???
Plesa help.

Mfg, Martek


3D Gamestudio A7 Extra
Re: ent_next [Re: Martek] #180196
02/06/08 19:28
02/06/08 19:28
Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Gordon_Shumway Offline
Member
Gordon_Shumway  Offline
Member

Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Hi,
probier das mal:
function show_squads()
{
var counter1=0;
you = null;
you = ent_next(NULL); // you auf erste Entity setzen (Sprung von Null auf 1. Entity)
while (you!=NULL)
{
if(you.squad == 1)
{
counter1 += 1;
}

you = ent_next(you);
continue;
}
}
Jetzt werden alle Entities durchgegangen und immer wenn eine Entity den skill squad == 1 hat, wird counter1 um eins erhöht.
Ich denke, dass sollte dir helfen, oder?
Bye G.S.

Last edited by Gordon_Shumway; 02/06/08 19:29.

***Neue Webseite!! Mit vielen neuen Infos! http://www.2662-thegame.de.vu***
Re: ent_next [Re: Gordon_Shumway] #180197
02/07/08 13:36
02/07/08 13:36
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Vielen Dank,
ich musste es zwar noch etwas abändern, aber es funktioniert jetzt.

Mfg, Martek


3D Gamestudio A7 Extra

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