Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sensors Question

Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-11-2006 07:26
Say I raise a sensor on a timer like every 1 second.
then say my sensor event takes a number and subtracts 1 from the number on each detect. Then updates a hovertext( the text update is actually on the timer not sensor event). So untill the update it should still be tracking the var that its subtracting from.

I am detecting bullets here.

person shoots but there is some latency like a qued up sensor detects.

My main question is how long does sensor stay up? say sensor is triggered will it stay as long as theres still colliding?

pseudo wise
CODE

//THE sensor is triggered by a timer
sensor(integer 1) {
x=x - 1;
}



This is reacting wierd i would thing it would do the subtraction once then kill the sensor and wait for it to be triggered again on my timer going off
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
10-11-2006 07:45
From: Dimentox Travanti
This is reacting wierd i would thing it would do the subtraction once then kill the sensor and wait for it to be triggered again on my timer going off

Would think that's how it should work indeed. Quite easy to veify, though
CODE

integer ping_count;

default {

state_entry() { llSetTimerEvent( 1.0 ); }

timer() {

llOwnerSay( "Sensor triggered " + (string)ping_count + " time(s)." );
ping_count = 0;
llSensor( ... );
}

sensor( integer Count ) { ++ping_count; }
}
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-11-2006 08:17
I am not able to get in game.

But i had a llsay in the sensor() it was going off quite a bit. even when i upped the timer. I dont know has anyone else worked with this? I am doing a combat system where it detects bullets and melee heh.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
10-11-2006 08:29
If your event that triggers the sensor is collision() I believe that should be the case, that it will fire rapidly as there is still a collision happening. If you don't want that to happen, try collision_start or collision_end so it will only fire once at the start or end of the collision.
_____________________
Archatek

Home to some of the highest quality katanas and other blades available in SL. Co-creator of the Samurai Island Combat System, one of the best melee combat systems available, come check it out!

___________________
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
10-11-2006 09:12
There seems to be some misunderstanding about the sensor() event.

A sensor() event is raised only when a llSensor() is called, or repeatedly when a llSensorRepeat() is called.

If you are detecting collisions with your avatar, use the event collision_start().
_____________________
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-11-2006 13:05
Actually alli am detecting is bullets fired at me and swords. Which the sensor works fine.

But It seems that sensor is fireing off multiple times per call via timer.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
10-11-2006 13:11
It's going to be a bit inefficient to use sensors to detect hits, if that's what you're doing - collision_start would be best. Apart from that though I'm not sure what the problem is. Could you post a bit more of the code that you are using? Are you able to get in-world to retrieve it? If not, try explaining what you're trying to achieve in a bit more depth.

You don't need to run a timer to use a sensor by the way, llSensorRepeat will set a sensor to run every X seconds, and you can cancel it with llSensorRemove.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-11-2006 14:40
I have a question about collision start.. The object thats attached is SMALL and is transparent. I am using sensors so i dont have to wrap the avatar in a prim bubble.

I will post some results when i am able to run in game.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
10-11-2006 14:42
If the prim is attached to the avatar, it will detect collisions anywhere on the avatar, not just on that prim.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-11-2006 16:54
If i wanted to detect collisions instead of a sensor would it be..

CODE

collision_start(integer times) {
if (llDetectedType(0) & ACTIVE) {
health = health - 1;
}
}
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-11-2006 16:56
lso it does not seem to be detecting on any part of my body cept where the prim is located.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-12-2006 00:14
OK got collision working with GUNS,
but it wont register melee hits.


THE rcs system will only register hits if someone is wearing the RCS also.

So it muct be communicating..

SO how do i make it communicate? and work with any melee weapon?
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-12-2006 09:38
Anyone?
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Gerami Fizz
That Guy
Join date: 15 Jun 2005
Posts: 88
10-12-2006 10:07
Melee weapons are tricky. When you "hit" someone with a melee weapon in SL, you're never actually hitting them with the object itself. Usually the hitting is done in one of two ways:

1) The weapon actually fires a short-range sensor, and if it detects another avatar, it does something (push, communicate damage, etc). This is the most common type of melee weapon I've encountered, and they vary in quality.

2) The weapon actually fires a short-range bullet, just like a gun with a very limited range. You'll need to do it this way if you want to cause "real" damage in combat zones, and it's easier to script because it works like any other gun in SL. You might run into issues with lag and range, though.
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-12-2006 10:11
Right, What the other system does i dont know BUT it will work with any melee weapon and only when its used, So my question is how is he detecting the move and then sending out a signal to the other person wearing the system.

I know i could script a weapon to do this...
PSUDO code

slash
start sensor
send message on channel saying hit on detected agent.



But how is he intercepting or even placeing the sensor on the weapon.

The System is a small orb attached to the head.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
10-17-2006 06:30
I am still looking for some help with this.
_____________________
LSL Scripting Database - http://lsl.dimentox.com