Laser Hit Counter

About advanced scenes, and the Thyme scripting language used in Algodoo.

Laser Hit Counter

Postby ImaPirate » Wed Oct 14, 2009 2:54 am

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.
User avatar
ImaPirate
 
Posts: 65
Joined: Mon Oct 12, 2009 6:24 pm

Re: Laser Hit Counter

Postby niffirg1 » Wed Oct 14, 2009 3:25 am

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
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: Laser Hit Counter

Postby Mystery » Wed Oct 14, 2009 5:29 am

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.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Laser Hit Counter

Postby KarateBrot » Wed Oct 14, 2009 5:59 am

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
Last edited by KarateBrot on Wed Oct 14, 2009 9:05 pm, edited 1 time in total.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Laser Hit Counter

Postby Sniperkasa » Wed Oct 14, 2009 7:28 pm

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..
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem :)
User avatar
Sniperkasa
 
Posts: 493
Joined: Tue Sep 01, 2009 5:34 pm
Location: The bottom of a lake.

Re: Laser Hit Counter

Postby ImaPirate » Thu Oct 15, 2009 12:58 am

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?
User avatar
ImaPirate
 
Posts: 65
Joined: Mon Oct 12, 2009 6:24 pm

Re: Laser Hit Counter

Postby Conundrumer » Thu Oct 15, 2009 1:35 am

You can use my blips gates in my laser logic gate scene to get only one reading of an incoming laser.
User avatar
Conundrumer
 
Posts: 344
Joined: Mon Aug 31, 2009 5:55 pm
Location: NYC

Re: Laser Hit Counter

Postby ImaPirate » Thu Oct 15, 2009 2:16 am

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. ^_^
User avatar
ImaPirate
 
Posts: 65
Joined: Mon Oct 12, 2009 6:24 pm

Re: Laser Hit Counter

Postby KarateBrot » Thu Oct 15, 2009 3:00 am

Oh, that's what you wanted :D
So do you still want a frequency detector or is everything alright now with Conundrumer's scene?
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Laser Hit Counter

Postby ImaPirate » Thu Oct 15, 2009 3:15 am

A frequency counter would be greatly appreciated. ^_^ If you want too.
I can learn from the scene.
User avatar
ImaPirate
 
Posts: 65
Joined: Mon Oct 12, 2009 6:24 pm

Re: Laser Hit Counter

Postby KarateBrot » Thu Oct 15, 2009 5:38 am

Here it is :)

Rating: rated 6.1
Filesize: 54.63 kB
Comments: 8
Ratings: 3
download
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron