What does this mean?

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

What does this mean?

Postby AN9K » Sat Jun 18, 2016 12:09 pm

I tried to create a script that one object will disappear when another object hit on the specific object.
The code was:

The specific object:
Code: Select all
onCollide = (e) = > {
        scene.my.Leg14E = true
}


The disappearable object:
Code: Select all
poststep = (e) = > {
        timeToLive = (scene.my.Leg14E) ? 0.0001 : inf
}


The object disappeared without any problems, and the console said:
WARNING - timeToLive was bound to bad type. Restoring to last known value.


So how should I fix this problem?
AN9K
 
Posts: 5
Joined: Tue Jun 30, 2015 12:14 am

Re: What does this mean?

Postby icrls984 » Sun Jun 19, 2016 3:22 am

I think the warning is just to say the object is bad so it was removed, which is what you were trying to do.
.
User avatar
icrls984
 
Posts: 80
Joined: Thu Jun 13, 2013 6:33 am

Re: What does this mean?

Postby Kilinich » Mon Jun 20, 2016 11:00 am

there is no "inf" value. It should be +inf (or -inf).
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: What does this mean?

Postby Xray » Fri Jul 29, 2016 9:50 pm

@AN9K - You got the warning because your code is trying to store a Boolean operator (true or false) in TimeToLive which can only have a positive real number between zero and infinity.

Also, do you know the difference between "=" and "==" ?
"=" means copy the value from right side of equal sign to variable on left side of equal sign.
"==" asks the question: Does the value on the left side of the double equal sign equal the value on the right side of the double equal sign?
One is an action, and the other is a comparison.

BTW - A better script in the disappearing object is this:

postStep = (e) = > {
scene.my.Leg14E ? {TimeToLive = 0} : {}
}
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron