Script help! Please help, my scripts become values?
4 posts • Page 1 of 1
Script help! Please help, my scripts become values?
Ok, what happens is my scripts become the values that they are worth. Exampe:
I type 'scene.my.speed = 0.0' in the console.
Then I type '(e)=>{scene.my.speed = 2.5}' in the on-collide section of a polygon.
Then, I make a vehicle, and type 'scene.my.speed' in the motor speed section of the hinge, so that the speed of the vehicle is equal to the value of the variable 'scene.my.speed'.
So, the speed of the vehicle is 0.0 at the start, and should become 2.5 when the polygon collides. But this doesn't happen. Instead, when I type 'scene.my.speed' in the motor speed section, the motor speed becomes 0.0, and is no longer scene.my.speed, so it doesn't change to 2.5 when the polygon collides. Why does this happen? And more importantly, how can I fix this?
I type 'scene.my.speed = 0.0' in the console.
Then I type '(e)=>{scene.my.speed = 2.5}' in the on-collide section of a polygon.
Then, I make a vehicle, and type 'scene.my.speed' in the motor speed section of the hinge, so that the speed of the vehicle is equal to the value of the variable 'scene.my.speed'.
So, the speed of the vehicle is 0.0 at the start, and should become 2.5 when the polygon collides. But this doesn't happen. Instead, when I type 'scene.my.speed' in the motor speed section, the motor speed becomes 0.0, and is no longer scene.my.speed, so it doesn't change to 2.5 when the polygon collides. Why does this happen? And more importantly, how can I fix this?
I don't suffer from insanity. I enjoy every minute of it.
-
Rrobba - [Best Sig 2010]
- Posts: 1480
- Joined: Mon Aug 31, 2009 6:01 pm
- Location: Gibraltar
Re: Script help! Please help, my scripts become values?
Put the code into { } brackets. they tell that your variable is a variable and not only a constant.
- Code: Select all
{scene.my.speed}
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Script help! Please help, my scripts become values?
KarateBrot wrote:Put the code into { } brackets. they tell that your variable is a variable and not only a constant.
- Code: Select all
{scene.my.speed}
Thanks!
I don't suffer from insanity. I enjoy every minute of it.
-
Rrobba - [Best Sig 2010]
- Posts: 1480
- Joined: Mon Aug 31, 2009 6:01 pm
- Location: Gibraltar
Re: Script help! Please help, my scripts become values?
No problem
You can also do this with variables so they update themselves without a need of onCollide or Lasers. For example
If you change scene.my.number scene.my.difference changes automatically according to scene.my.number. if scene.my.number is 10 scene.my.difference will be automatically -7
You can also do this with variables so they update themselves without a need of onCollide or Lasers. For example
- Code: Select all
scene.my.difference = { 3 - scene.my.number }
If you change scene.my.number scene.my.difference changes automatically according to scene.my.number. if scene.my.number is 10 scene.my.difference will be automatically -7
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests