custom script loaded in every single scene

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

custom script loaded in every single scene

Postby hiltropper » Tue Mar 08, 2011 12:57 pm

hi there
i wondered if it is possible to create a .txt into the algodoo folder and write some scripts in it that and algodoo should load it into ANY scene you open

so the console is like "open \bla\my.txt" any loading process

and the .txt is like "print: <all my scripts included here>"

the practical sense of this is for EXAMPLE:

Code: Select all
scene.my.round=(x)=>{x>(math.toint(x)+0.4999)?{x2=(math.toint(x)+1)}:{x2=math.toint(x)}}

could be included into every scene and if i want a rounded number i didnt have to write the script down everytime

my question: is there the possibility?
maybe in the algodoo config?
or maybe algodoo just cant open it ?
well i dont know thats why im asking here :D
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: custom script loaded in every single scene

Postby Chronos » Tue Mar 08, 2011 1:15 pm

I'm pretty sure you can do that in the config file, but only the one in your documents. I don't know exactly where to put it, but I don't think it matters much.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: custom script loaded in every single scene

Postby hiltropper » Tue Mar 08, 2011 1:51 pm

works
into the "autoexec.cfg"
i included my rounding function:

Code: Select all
exit = {System.exit};
quit = {System.exit};
print = {Console.print};
roundmy = {scene.my.roundmy=(x)=>{x>(math.toint(x)+0.4999)?{x2=(math.toint(x)+1)}:{x2=math.toint(x)}}};
time = {Sim.time};
sin = {math.sin};
cos = {math.cos};


now it can be used in every scene automatically after starting algodoo
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: custom script loaded in every single scene

Postby hiltropper » Tue Mar 08, 2011 1:58 pm

one last thing: could there appear any problems with writing down something into the config??
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: custom script loaded in every single scene

Postby Chronos » Tue Mar 08, 2011 2:07 pm

Not at all. People do it all the time. The config is the best (and I think only) way to do this, and people have done it since Phun was around.

Also, you should really edit your posts instead of posting twice.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: custom script loaded in every single scene

Postby hiltropper » Tue Mar 08, 2011 4:17 pm

sorry. forgot it
ok im done,thanks for your help
:thumbup:
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest