Identifying a laser

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

Identifying a laser

Postby Mr_Stabby » Mon Dec 28, 2009 2:22 am

I have a box that does something when hit by laser, the problem is there are 2 lasers pointed at it - one to transfer some info and other to trigger the spawn. I figured i could solve this with a simple e.other.something? check but i cant seem to access the laser pointer variables from the box. so how do i get some random attribute from a laser if the script resides in the box?

EDIT: ok i found out that i can use e.laser to adress the laserpen but i ran into another problem:

i made a really near distance sensor that works with just one box and one laser but there seems to be a bug. Whenever i import the sensor to a scene or load a scene or open algodoo, i have to open the laser script and hit enter, otherwise the script just doesent work, its weird coz i change nothing and just by setting my cursor to a random place and hitting enter fixes it. i have no clue what causes it, maybe somebody can help. heres the script:
Code: Select all
onLaserHit=(e)=>{
    e.geom.friction == 0.033 ? {
        collideSet = 63;         
        e.geom.xhit = color(0) * 1000;         
        e.geom.yhit = color(1) * 1000     
    } : {
        collideSet = 127
    };     
    color = [0, 0, 0, 1] + [e.pos(0) / 1000, e.pos(1) / 1000, 1, 0]
}


what it does is collect pos data from where the laser lands and store it in its color (provided the thing it hits isnt the sensor itself which has friction of .033) and then when it does hit the sensor it passes on the data
Mr_Stabby
 
Posts: 155
Joined: Wed Dec 16, 2009 12:16 am

Re: Identifying a laser

Postby RA2lover » Tue Dec 29, 2009 5:16 pm

i used multiple lasers to relay info from my missile's memory component, when i noticed it would cause problems with triggering the warhead multiple times.

Rating: rated 6.5
Filesize: 42.97 kB
Comments: 7
Ratings: 4
download


the yellow parts are the data transfering parts. to avoid getting mutual transfers, the laser checks the color of the object to determine wether its the data storage device, or the part to write it to.

the geometry detects wether the laser is the right one to trigger the warhead by checking its color. without that check, the missile can trigger an offset explosion, or even worse, a double explosion.
Jrv wrote:
TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.


GTFO newfgt
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: Identifying a laser

Postby Mr_Stabby » Fri Jan 01, 2010 8:19 am

ok i did some further testing and apparently laser scripts are very buggy, first off none of them work without reentering them each time u load the laser and secondly you cant pass the script on to them either via new laser or modifying them because they just act retarded and the script starts executing on the parent object instead

i hope this gets fixed in the next version, theres so much i could do with this
Mr_Stabby
 
Posts: 155
Joined: Wed Dec 16, 2009 12:16 am

Re: Identifying a laser

Postby RA2lover » Fri Jan 01, 2010 4:08 pm

laser scripts do work. and that issue happens to geometries too
Jrv wrote:
TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.


GTFO newfgt
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: Identifying a laser

Postby RaRaMalum » Wed Feb 17, 2010 5:47 pm

You can basicly get the laser to do different stuff depending on what it hits, but you really have to give it some if statments to follow... lasers are really cool, but they aren't psychic.

and if you have a box thats hit by several lasers, same rule aplys: make if statments

the more complicated way is to make the main portion of the thyme run from the box and then let induvidual lasers change something in the box with their own thyme(this way is less laggy).
Phundamentalists, come to the dark side.
We have much cooler toys.
User avatar
RaRaMalum
[Best newcomer 2010]
 
Posts: 280
Joined: Mon Aug 31, 2009 10:47 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron