Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Deletion after Math Error!!

Lexi Foley
Registered User
Join date: 1 Mar 2006
Posts: 43
10-04-2006 07:31
Hai There!!

I made a bullet tester for Carnage Island, its free to copy for all,
the thing is, that last night a math error accured durring a mass of bullets at once.
after seeing that i realized that if a math error accured the scipt tuns off and because
i like it to be not modify, its not posseble to reset the script for the onwer and if anny body
would take a copy of it the person also would copy the math error, so i went trying to find a way to deleted the object once a math error accured.

the only event that happens is the script is saying on channel 0 = Math Error
(as far as i know!!)

so i put in another prim whit a listener on 0 that listens for Math Error.

it works but (and here is the but) anny other Tester in chat range is deleted then,

so i tryed it whit llMessagelink to sent the key of the root, to the childprim on rez, but on a math error the key of the object saying it, is not reconised even the owner of the object is not reconised whitin the Math Error message,

So what left for me was to have the Childprim to llListen(0,"Carnage Bullet Tester","","";)
to avoid it when some other thing is going Math Error it would deleted,,,,

Now is my quistion,, (i hope you are still whit me :) ) Is there a way of deleting only the specific object (or from the same owner) after a Math Error??

Greetings Lexi Foley

(i forgot to say, i tryed also llResetScript() on rez into the Root script and again as far as i know its not posseble for an other script to reset one that turned of by math error)

(lexi says whit a soft high voice,, Help!)
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
10-04-2006 10:58
From: Lexi Foley
Hai There!!

I made a bullet tester for Carnage Island, its free to copy for all,
the thing is, that last night a math error accured durring a mass of bullets at once.
after seeing that i realized that if a math error accured the scipt tuns off and because
i like it to be not modify, its not posseble to reset the script for the onwer and if anny body
would take a copy of it the person also would copy the math error, so i went trying to find a way to deleted the object once a math error accured.

the only event that happens is the script is saying on channel 0 = Math Error
(as far as i know!!)

so i put in another prim whit a listener on 0 that listens for Math Error.

it works but (and here is the but) anny other Tester in chat range is deleted then,

so i tryed it whit llMessagelink to sent the key of the root, to the childprim on rez, but on a math error the key of the object saying it, is not reconised even the owner of the object is not reconised whitin the Math Error message,

So what left for me was to have the Childprim to llListen(0,"Carnage Bullet Tester","","";)
to avoid it when some other thing is going Math Error it would deleted,,,,

Now is my quistion,, (i hope you are still whit me :) ) Is there a way of deleting only the specific object (or from the same owner) after a Math Error??

Greetings Lexi Foley

(i forgot to say, i tryed also llResetScript() on rez into the Root script and again as far as i know its not posseble for an other script to reset one that turned of by math error)

(lexi says whit a soft high voice,, Help!)


/me points to sig. Now that that's out of the way...


It is to have an object delete on a math error. you were on the right track by filtering your chat with the "Carnage Bullet Tester" name. To get the object to only delete itself after it reports it's own math error you'd need something like this.


CODE

default
{
state_entry()
{
llListen( 0, "Carnage Bullet Tester", NULL_KEY, "" ); //Note that while math errors are reported on channel 0, in general channel 0 listeners are considered "Laggy"
}

listen( integer channel, string name, key id, string message )
{
if ( id == llGetKey() )//Compares the id's of who said something to itself.
{
llDie();//Kills itself if the object is the one saying the message
}

}
}


[edit] You can also have it scan for the message "Math error" in case you're using the same script in bullets with different names. This way you don't need to rewrite the script for each specifically named object; just copy and paste it in without editing.

[edit 2] Quite honestly, you need to find out what is throwing the Math Error, most likely a division by 0, and write a little block of code to correct for the error.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Lexi Foley
Registered User
Join date: 1 Mar 2006
Posts: 43
whell ehm i think you got me a bit different as i meant
10-04-2006 12:25
From: Senuka Harbinger
/me points to sig. Now that that's out of the way...


It is to have an object delete on a math error. you were on the right track by filtering your chat with the "Carnage Bullet Tester" name. To get the object to only delete itself after it reports it's own math error you'd need something like this.


CODE

default
{
state_entry()

{
llListen( 0, "Carnage Bullet Tester", NULL_KEY, "" ); //Note that while math errors are reported on channel 0, in general channel 0 listeners are considered "Laggy"
}

listen( integer channel, string name, key id, string message )
{
if ( id == llGetKey() )//Compares the id's of who said something to itself.
{
llDie();//Kills itself if the object is the one saying the message
}

}
}


[edit] You can also have it scan for the message "Math error" in case you're using the same script in bullets with different names. This way you don't need to rewrite the script for each specifically named object; just copy and paste it in without editing.

[edit 2] Quite honestly, you need to find out what is throwing the Math Error, most likely a division by 0, and write a little block of code to correct for the error.


like i sayd the key of the object or objects owner is NOT in the Math error message,, and a script can not listen to itself like an scanning objecte dosnt scan itself,, and if a Math error acurse wel than the script isnt working so it wound listen to annything,

I am aware that solving the Math Error would be the best,

okee to keep i short,, the last bit is the right bit i just need to solve the math error,,,
but what i wanted to say about the example a script can not listen fist to what it says itself, second, after a math it stops running so the listener is to late,,, will i wrote tis i think i found what could cause the math error,, now i use

if(vel.x == 0)vel.x=0.01;

but i think thats not good and that it must be

if(vel.x <=0.01)vel.x=0.01;

thx for pointing out my lazyness :) So i gues the anwer of my question is,, solve the math!!! hihi,, okeeeeee well very thx for thinking whit me... i have to find out first in the new version of SL and find out if its not bugged annywhere ;)

B.T.W. what does ;;;/me points to sig. Now that that's out of the way...;;; means hihi!!
im dutch and i trying to figger out what that could mean :)

Greetings (again) Lexi Foley
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-04-2006 12:51
You could have a 'watcher' script that sends out a link message at a regular interval, and expects to receive a response from the math script within a certain time period (so, start a timer, send out the link message, if you get a response, stop the timer, if the timer expires, then you didn't get a response). If a response doesn't arrive for N consecutive attempts (so you don't jump to the wrong conclusion because of lag), you could assume that the math script has died, and take necessary action. You can llDie(), but I think there is an llResetOtherScript() function, though I don't know if that works on a script that has died on an error.

That might be one way to try and address this...
Rich Cordeaux
Registered User
Join date: 8 May 2006
Posts: 26
10-04-2006 13:49
I was under the impression that scripts cannot hear anything said by any of the prims in their object. Is that not correct, or are the script-crash messages exempt from that limitation, or have y'all not actually tested any of this yet?

Also, you can determine what causes a math error and prevent it (check your divisions to make sure they won't ever divide by zero, and if they do make them test before doing the division, etc). Adding a listener on channel 0 instead is going to be a drain on sim resources.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
10-04-2006 15:22
1) If the bullet script is having a math error you need to get it fixed.
2) Your bullets should be set Temporary (temp_on_rez) so you don't need a watching script.
3) If you need help fixing the math error, post the script. We can help. Using a listen is the wrong solution but a link message is a better solution.

For a basic bullet script all you need is...

CODE

setup()
{
llSetPrimitiveParams([PRIM_PHYSICS, TRUE, PRIM_TEMP_ON_REZ, TRUE]);
}

default
{
state_entry()
{
setup();
}
on_rez(integer a)
{
if(a)
{
llSetDamage(a);
setup();
}
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Lexi Foley
Registered User
Join date: 1 Mar 2006
Posts: 43
10-04-2006 16:36
From: Rich Cordeaux
I was under the impression that scripts cannot hear anything said by any of the prims in their object. Is that not correct, or are the script-crash messages exempt from that limitation, or have y'all not actually tested any of this yet?

Also, you can determine what causes a math error and prevent it (check your divisions to make sure they won't ever divide by zero, and if they do make them test before doing the division, etc). Adding a listener on channel 0 instead is going to be a drain on sim resources.



Wel you are correct partly,, its not able to listen into the same prim thats right,, i dont know if its a glitch but if the listener is in another prim it can hear the rootprim speak, sow its not the object in total that can not hear it, only the same prim!!

The Math message is more limeted as othere scripts,, because you can not find the key from the object (i tested it in very varable ways) and the end result was the the math just doest give the key whit it,,

Sow when a math error accurs the option of putting in a timer script would seem the best option AFTER solving the math problem,, i solved it,, my error was like i said earleyer in this forem,,

i used

if(vel.x==0){vel.x=0.01;}

that had to be

if(vel.x<=0.01){vel.x=0.01;}

so the problem is solved,, that is the besst thing to do,,, but if (mark if) then a timer would be the best option,,,

Test for yourself whit the listener,, you will find a prim wil listen to anothere prim in the same object

greetings Lexi Foley
Lexi Foley
Registered User
Join date: 1 Mar 2006
Posts: 43
10-04-2006 16:40
From: Strife Onizuka
1) If the bullet script is having a math error you need to get it fixed.
2) Your bullets should be set Temporary (temp_on_rez) so you don't need a watching script.
3) If you need help fixing the math error, post the script. We can help. Using a listen is the wrong solution but a link message is a better solution.

For a basic bullet script all you need is...




thx i know it must be very confusing, im dutch here, and have trouble to explain myself correct,, i was not talking about making bullets, you coundt know but i know,

annyway thank for reply, its nice there are people out there that want to help :)
Lexi Foley
Registered User
Join date: 1 Mar 2006
Posts: 43
10-04-2006 16:48
From: Ziggy Puff
You could have a 'watcher' script that sends out a link message at a regular interval, and expects to receive a response from the math script within a certain time period (so, start a timer, send out the link message, if you get a response, stop the timer, if the timer expires, then you didn't get a response). If a response doesn't arrive for N consecutive attempts (so you don't jump to the wrong conclusion because of lag), you could assume that the math script has died, and take necessary action. You can llDie(), but I think there is an llResetOtherScript() function, though I don't know if that works on a script that has died on an error.

That might be one way to try and address this...


Thanks Ziggy,, if there was a math error that wasnt fixed that the watcher would be sertainly it!!

The llResetOtherScipt is (to bad) not able to reset a script that stoped on Math error.
and even not the script itself whit a reset on rez,, i think lots of people would be happy when that was posseble,, think of stoped trains,, but it also have its reasons..

okee thx for replaying!!!!!
:)
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-04-2006 17:09
Yes, if a script crashes, then it's stopped, which means it won't process an on_rez event, so putting an llResetScript() into the on_rez handler won't help a crashed script.
Lexi Foley
Registered User
Join date: 1 Mar 2006
Posts: 43
10-05-2006 03:38
From: Senuka Harbinger
/me points to sig. Now that that's out of the way...




:) still wondering what that means !