Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,209 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Error 1515 Invalid argument. #221440
08/14/08 02:25
08/14/08 02:25
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline OP
Member
Jethro  Offline OP
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
I reported this a while back, and was too busy to persue at the time.
I can confirm this "possible" bug is in all versions from A7.07 up to current beta 7.24.

We intermittently get the following errors E 1515.
Invalid argument in Play_one_steam ENTITY.
Invalid argument in Flame_Check_Health ENTITY.

Now Flame_check_health.
We've put entity Pointer checks in before calling or using the me pointer but it is STILL BROKEN with following code?


Function Play_One_Steam(){
if (me==NULL) {return;} //trying to get rid of invalid argument bug.
If (Snd_Playing(POS_Hand)==0){
If (Random(100)<50){
POS_Hand=ent_Playsound(ME,Steam1_Snd,FX_Vol*10);
}ELSE{
POS_Hand=ent_Playsound(ME,Steam_bub_Snd,FX_Vol*10);
}
}
}


Function Flame_Check_Health(){

if (me==NULL) {return;} //trying to get rid of invalid argument bug.
c_setminmax(me);//we got some damage our scale will be adjusted,
If (Vec_dist(Player.x,my.x)<500){
Play_One_Steam();
}

If (MY.Skill40<=0){//Flame death
MY.event=null;
emit(3,MY.POS,particle_smoke); // emit( smoke
//score some points.
//Do some smoke or sizzle.
wait(2); //Give things above a chance to start before removing me.

if (me==NULL) {return;} //trying to get rid of invalid argument bug.
str_for_entfile (temp_str,ME);
IF (Str_Cmpi(temp_str,"fire_land.mdl")==1){ //Land fire extinguish, so get bonus and count it off the list.
Bonus_Score+=1;
Curr_flames-=1;//So weather knows how many fires are raging. only decrement immediately before
}
ent_Remove(me);Return;
}
}

//Fire will use this event action. Water scans fire to put it out, however other things may scan fire to flare it up?
Function Fire_Ev(){
If ((EVENT_TYPE == EVENT_SCAN)&&(indicator==_Water)){// Put me out
//Now result= distance from water sprite, so lets give us more discharge of strength the closer they are to us.

My.Skill40-=Water_Strength/(result+1); //So if a dead hit, you get maximum Water_strength/1 discharge. per hit which is 16/second for constant pounding.
//one_beep(2);//debug flame scanned by water
if (me==NULL) {return;} //trying to get rid of invalid argument bug.
Flame_Check_Health();
}ELSE{//no scan damage, check for direct hit.
If (YOU!=NULL){
IF (YOU._TYPE==_TYPE_WATERSPRAY){
My.Skill40-=1; //Get reduction of health by 1 for collissions.
// one_beep(3);//debug flame collide with water
if (me==NULL) {return;} //trying to get rid of invalid argument bug.
Flame_Check_Health();
}
IF (YOU._TYPE==_TYPE_WATER_Lake){
My.Skill40-=10; //Get reduction of health by 10 for collission with lake ie. kill me very fast.
// one_beep(3);//debug flame collide with water
if (me==NULL) {return;} //trying to get rid of invalid argument bug.
Flame_Check_Health();
}

}
}

}

Last edited by Jethro; 08/14/08 02:38.
Re: Error 1515 Invalid argument. [Re: Jethro] #221461
08/14/08 06:07
08/14/08 06:07
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
if (me==NULL) {return;} //trying to get rid of invalid argument bug.

This would not get rid of invalid arguments. If would only detect that me were NULL, but not a removed entity or an entity pointer containing garbage. Only the error message really indicates that me is not a valid entity. I'd suspect a removed entity here.

When you post code, please use the code tag. Otherwise it's hard to read.

Re: Error 1515 Invalid argument. [Re: Jethro] #221470
08/14/08 07:54
08/14/08 07:54
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline OP
Member
Jethro  Offline OP
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
When an entity is removed, shouldn't its event actions also be removed? as they are a part of the entity aren't they?

Jethro

Re: Error 1515 Invalid argument. [Re: Jethro] #221476
08/14/08 08:30
08/14/08 08:30
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
ent_remove terminates other functions that are on wait() and have the same me pointer. It does not terminate the current function.

You could test when the pointer becomes invalid by displaying its index, but unfortunately that would only work with lite-C, not with WDL scripts.

Re: Error 1515 Invalid argument. [Re: jcl] #221531
08/14/08 15:00
08/14/08 15:00
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline OP
Member
Jethro  Offline OP
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
OK. I think I fixed it, (it hasn't failed since I implemented the following) but I'm not sure if I'm working around a bug.

at the end of the main entity function, (the same function it ran when it was ent_created), Not its event action. I put 2 extra lines in front of the ent_remove, as follows.

Code:
my.event=null;  //try to solve invalid argument bug, ie. turn off events, give them a tick to do them, then remove me
wait(1);        // " " "
ent_remove(me); //flame ran out of fuel.
}


To ensure the event functions all have a chance to run, before removing the entity.
However I shouldn't have to do this as the events either run when me exists, or when me is ent_removed there is no entity to get the event.

Jethro.

Re: Error 1515 Invalid argument. [Re: Jethro] #221672
08/15/08 12:32
08/15/08 12:32
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
Yes, after an entity is removed, it should not trigger any further events. But I think I see now the problem in your code, and your workaround indeed fixed it.

Your event is starting a particle function at my.pos. Particles run at the end of the frame cycle. When the entity was removed inbetween, my.pos is invalid. That's why the manual mentions not to do anything that affects the level at the beginning of an event function, but place a wait(1) before. Your workaround also fixed that problem.

Normally you'd get a warning when you do something like that, but your script was apparently written for the A4 engine, with long-abandoned A4 keywords like POS or EMIT. This old stuff is untested since almost 10 years. So you'll probably save time in the end when you go over the script someday and bring it at least on A6 standard.

Re: Error 1515 Invalid argument. [Re: jcl] #221681
08/15/08 13:38
08/15/08 13:38
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline OP
Member
Jethro  Offline OP
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
My Bad,
Thanks for your patience with this.

Regards .... Jethro.


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