Basic SCripting Tutorial
9 posts • Page 1 of 1
Basic SCripting Tutorial
This is basically what the title says. I will explain some of the variable/OnCollide scripting.
I will list the steps, and explain them as I go.
1.) Open up the console in Algodoo (Phun) using F11 or 'tilde' (~)
2.) Type scene.my.Write your variable here, and then have it equal some value (i.e. 10, .4, true). It should look something like this :
3.) Open the script menu of an object, and type your variable (including the scene.my.) into any box. Be sure yo put curly brackets { } around the ENTIRE variable. DO NOT include the value of the variable. It should look something like this :
4.) To change the density of this object (object A, I'll call it) when another object collides, open the script menu of another object (object B), and paste this into the OnCollide box :
5.) You can also increase the density object A, so that every time object B collides, it increases the density of object A by one (this can also be inputted into the OnCollide of object A). The code looks like this :
6.) If you want to change the color of object A, you do not secondarily need any variables (only if you want when object B collides, it changes the color of object A). Input this into the OnCollide of object A :
This concludes my basic scripting tutorial. If you have any questions or comments, PM me or add a reply to this scene.
I will add another slightly more advanced tutorial, but right now I'm too lazy.
I will list the steps, and explain them as I go.
1.) Open up the console in Algodoo (Phun) using F11 or 'tilde' (~)
2.) Type scene.my.Write your variable here, and then have it equal some value (i.e. 10, .4, true). It should look something like this :
- Code: Select all
scene.my.dens = 100
3.) Open the script menu of an object, and type your variable (including the scene.my.) into any box. Be sure yo put curly brackets { } around the ENTIRE variable. DO NOT include the value of the variable. It should look something like this :
- Code: Select all
{scene.my.dens}
4.) To change the density of this object (object A, I'll call it) when another object collides, open the script menu of another object (object B), and paste this into the OnCollide box :
- Code: Select all
scene.my.dens = scene.my.dens = 10
5.) You can also increase the density object A, so that every time object B collides, it increases the density of object A by one (this can also be inputted into the OnCollide of object A). The code looks like this :
- Code: Select all
scene.my.dens = scene.my.dens + 1
6.) If you want to change the color of object A, you do not secondarily need any variables (only if you want when object B collides, it changes the color of object A). Input this into the OnCollide of object A :
- Code: Select all
e.this.color = [1, 1, 1, 1]
This concludes my basic scripting tutorial. If you have any questions or comments, PM me or add a reply to this scene.
I will add another slightly more advanced tutorial, but right now I'm too lazy.
Last edited by mold999 on Wed Mar 02, 2011 11:12 pm, edited 1 time in total.
Phundementalism?
Ain't nobody got thyme fo dat.
Ain't nobody got thyme fo dat.
-

mold999 - Posts: 225
- Joined: Sun Jan 02, 2011 1:35 am
- Location: [176436, 3763234]
Re: Basic SCripting Tutorial
thanks i've been looking for something like this for awhile
im pretty sure for number 6 to change the color you don't need to put
im pretty sure for number 6 to change the color you don't need to put
- Code: Select all
e.this.color = [1,1,1,1]
- Code: Select all
color = [1,1,1,1]
DFTBA nerdfighters
TheWonkits wrote:As immature as some of the people on this forum can be, most of you are pretty cool.
TC42 wrote:Better than spell-check... ...TC42's instant grammar-correction posts!
-

frogman786 - Posts: 71
- Joined: Fri Jan 07, 2011 8:32 am
- Location: Christchurch, New Zealand
Re: Basic SCripting Tutorial
frogman786 wrote:thanks i've been looking for something like this for awhile
im pretty sure for number 6 to change the color you don't need to putjust put
- Code: Select all
e.this.color = [1,1,1,1]
- Code: Select all
color = [1,1,1,1]
I know, but I think that the e.this. clarifies that you can do an e.other. also.
Phundementalism?
Ain't nobody got thyme fo dat.
Ain't nobody got thyme fo dat.
-

mold999 - Posts: 225
- Joined: Sun Jan 02, 2011 1:35 am
- Location: [176436, 3763234]
Re: Basic SCripting Tutorial
yea explaining things like e.other, e.this and e.geom would help noobs in the long run (just suggesting it)
oh and nuber 4 looks like you made a mistake
oh and nuber 4 looks like you made a mistake
- Code: Select all
scene,.my.dens = scene.my.dens = 10
DFTBA nerdfighters
TheWonkits wrote:As immature as some of the people on this forum can be, most of you are pretty cool.
TC42 wrote:Better than spell-check... ...TC42's instant grammar-correction posts!
-

frogman786 - Posts: 71
- Joined: Fri Jan 07, 2011 8:32 am
- Location: Christchurch, New Zealand
Re: Basic SCripting Tutorial
Did you search around?
I'm sorry, but this thread is simply a waste of space. It has already been done, and it's been done better by a more experienced thyme mechanic.
I'm sorry, but this thread is simply a waste of space. It has already been done, and it's been done better by a more experienced thyme mechanic.
-

Dare - Posts: 833
- Joined: Sat Nov 21, 2009 4:27 pm
- Location: Sydney, Australia
Re: Basic SCripting Tutorial
This link is even stickied! How did you not see it?
Also, you forgot to mention if statements, the most useful thing in scripting.
Also, you forgot to mention if statements, the most useful thing in scripting.
-

TC42 - Posts: 984
- Joined: Sun Jan 09, 2011 1:53 pm
- Location: $ sudo apt get-install sandwich_
Re: Basic SCripting Tutorial
Look, the new people who come here might not even know what to look for. If this thread is new, it will be on the front page, so the new people will look at this, and know there is more to search for.
Phundementalism?
Ain't nobody got thyme fo dat.
Ain't nobody got thyme fo dat.
-

mold999 - Posts: 225
- Joined: Sun Jan 02, 2011 1:35 am
- Location: [176436, 3763234]
Re: Basic SCripting Tutorial
It's stickied. It's permanently at the top of the page, even the new threads get put underneath it.
This thread is totally pointless.
This thread is totally pointless.
-

Dare - Posts: 833
- Joined: Sat Nov 21, 2009 4:27 pm
- Location: Sydney, Australia
9 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest





