Page 1 of 1

Laser Hit Counter

PostPosted: Wed Oct 14, 2009 2:54 am
by ImaPirate
I've been looking for a laser hit counter. Something that would register and display a number every time it gets hit by a laser. ( ex. Count up - 1, 2, 3, 4, 5.. etc. )

If that can be done, I'm also curious of a way to do the same thing, but have it give a count of cycles per minute and/or second. ( EX. Find frequency of a laser pulse which is being flashed on and off every second to get 30Hz or something similar. )


I've searched the forums and found nothing myself, if there is a topic with such information then I apologize for this post, but would request a link to the topic.

Re: Laser Hit Counter

PostPosted: Wed Oct 14, 2009 3:25 am
by niffirg1
Is this what ur looking for.
1. Create a custom variable like scene.my.count = 0 and put that into the console (f11 or ~ key)
2.Press enter
3. Go into the script menu of the laser and type
Code: Select all
scene.my.count = scene.my.count + 1
and that will count how ever many times the laser hits something ( if you want to put it into a specific object type in the onlaserhit of the script menu of the object)
Hope that helped

Re: Laser Hit Counter

PostPosted: Wed Oct 14, 2009 5:29 am
by Mystery
Adding to niff, to display the count in the scripting menu in "Text" Type
{""+ Scene.my.count} And this will display the current number adjust the text size and color in the appearance menu.

Re: Laser Hit Counter

PostPosted: Wed Oct 14, 2009 5:59 am
by KarateBrot
Paradigm made a video tutorial for it. It's very basic so it's perfect for beginners.
It works with OnCollide but it's the same pricipe for OnLaserHit and for OnHitByLaser



If you want I can make a laser counter and a frequency detector

Btw:
I tested it and normally I get a laser hit frequency of 56Hz so if I make the laser pulsating at half speed, I get nearly 30Hz

Re: Laser Hit Counter

PostPosted: Wed Oct 14, 2009 7:28 pm
by Sniperkasa
But what if he wants the laser to count only once when its hit by a laser, even if continously shot at?
:shock: for that I'd maybe do some mechanics... thymed propably..

Re: Laser Hit Counter

PostPosted: Thu Oct 15, 2009 12:58 am
by ImaPirate
Ive managed to make a counter that shows the total amount, and it works good, but I didn't anticipate it counting the 56 hits per second or so. In other words, the number jumps up by large increments.

I don't know how to word this question exactly.. but does anybody know how to "soften" out the reading? As in make it see a more constant stream of light. So a person could connect the light and have it stay there only to have it register as one ( rather than 200 ), and then disconnect and reconnect it to have it register as two, etc.

KarateBrot, If you'd be willing to make a counter and frequency detector, that would be greatly appreciated. Either way, I learn something. :P

Edit: How might I reset the value, via a command or line of script?

Re: Laser Hit Counter

PostPosted: Thu Oct 15, 2009 1:35 am
by Conundrumer
You can use my blips gates in my laser logic gate scene to get only one reading of an incoming laser.

Re: Laser Hit Counter

PostPosted: Thu Oct 15, 2009 2:16 am
by ImaPirate
Conundrumer wrote:You can use my blips gates in my laser logic gate scene to get only one reading of an incoming laser.


:D Those do exactly what I want, and I must say, your laser works are quite stunning. I'm amazed. ^_^

Re: Laser Hit Counter

PostPosted: Thu Oct 15, 2009 3:00 am
by KarateBrot
Oh, that's what you wanted :D
So do you still want a frequency detector or is everything alright now with Conundrumer's scene?

Re: Laser Hit Counter

PostPosted: Thu Oct 15, 2009 3:15 am
by ImaPirate
A frequency counter would be greatly appreciated. ^_^ If you want too.
I can learn from the scene.

Re: Laser Hit Counter

PostPosted: Thu Oct 15, 2009 5:38 am
by KarateBrot
Here it is :)

Rating: rated 6.1
Filesize: 54.63 kB
Comments: 8
Ratings: 3
download