[solved] Absolute value

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

[solved] Absolute value

Postby therestofguys » Tue Mar 03, 2015 6:08 pm

Hi

I made a simple text kph speedometer with this
Code: Select all
text = {"" + math.toInt(vel(0) * 3.6)}


and I found this from an older post
Code: Select all
scene.my.abs = (n)=>{n < 0 ? - n : n}


problem is that I have no idea how to put these together also how the 2nd script works?
Last edited by therestofguys on Wed Mar 04, 2015 1:35 pm, edited 2 times in total.
User avatar
therestofguys
 
Posts: 10
Joined: Sat May 17, 2014 9:34 am

Re: [Q]Absolute value

Postby Kilinich » Wed Mar 04, 2015 9:52 am

type scene.my... definition in console, then you could use it as a function:
text = {""+scene.my.abs(math.toInt(vel(0)*3.6))}
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: [Q]Absolute value

Postby therestofguys » Wed Mar 04, 2015 1:34 pm

Thanks, I didn't realize that
User avatar
therestofguys
 
Posts: 10
Joined: Sat May 17, 2014 9:34 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests