need help [scripter please]...solved
15 posts • Page 1 of 1
need help [scripter please]...solved
hi there
i have a question: there are two circles , they collide, delete each other and create a new circle.this one has a oncollide script
circle onCollide=
i want to have the added circle oncollide to change something (not colorhsva was just to fill the gap) BUT not the oncollide srcipt of the collided circle (yes it will be deleted but its a learning question
) , what happens everytime. i think its because the function is for (e) as it is for the old circle ,too ? what do i have to write instead?
thanks
i have a question: there are two circles , they collide, delete each other and create a new circle.this one has a oncollide script
circle onCollide=
- Code: Select all
(e)=>{
e.other.controlleracc == 10 ? {
e.this.density = 0;
e.other.density = 0;
scene.addcircle({
pos = e.pos;
radius = 0.02;
oncollide = (e)=>{e.this.colorhsva = [1, 1, 1, 1]}
})
} : {false}
}
i want to have the added circle oncollide to change something (not colorhsva was just to fill the gap) BUT not the oncollide srcipt of the collided circle (yes it will be deleted but its a learning question
thanks
Last edited by hiltropper on Wed Feb 02, 2011 6:57 pm, edited 4 times in total.
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: help please
I don't know what you are trying to do, but I think you may need to delete the "false" thing. What I mean is,
Notice how in the last part of the IF statement, there is nothing. You have {false}. That may be your problem.
And also, instead of "e.this.blah", I always just use "blah". It is more reliable and more concise. That is, by being shorter, there is less to mess up.
And I always put braces around ALL parts of the IF statement.
Let me know if this helps.
- Code: Select all
{e.other.controllAcc == 10} ? {[blahblah]} : {}
Notice how in the last part of the IF statement, there is nothing. You have {false}. That may be your problem.
And also, instead of "e.this.blah", I always just use "blah". It is more reliable and more concise. That is, by being shorter, there is less to mess up.
And I always put braces around ALL parts of the IF statement.
Let me know if this helps.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-

Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: help please
no thanks but that is not the problem false just makes nothing happen it works any other time when i dont want a flase action
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: help please
Well, maybe spawn the circle BEFORE deleting the other two circles??????
I don't understand your problem.
I don't understand your problem.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-

Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: help please
my problem is the circle which spawns another one oncollide (which also has an oncollide action) , turns its oncollide script into the oncollide script of the new spawned circle .i guessed that it happens because i set (e) two times, dont know thats what i wanted to know 
for the oncollide script above it means :
turns into
; a new circle spawns which has the same code
i want only the new circle to have this script , it should not influence the parent object.
for the oncollide script above it means :
- Code: Select all
(e)=>{
e.other.controlleracc == 10 ? {
e.this.density = 0;
e.other.density = 0;
scene.addcircle({
pos = e.pos;
radius = 0.02;
oncollide = (e)=>{e.this.colorhsva = [1, 1, 1, 1]}
})
} : {false}
}
turns into
- Code: Select all
(e)=>{e.this.colorhsva = [1, 1, 1, 1]}
; a new circle spawns which has the same code
i want only the new circle to have this script , it should not influence the parent object.
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: help please
I see no problems with that. The scripted circle kills itself before spawning the other circle. I don't get it.
Are you saying that, when you type it in, it automatically reverts to the colorHSVA thing?
All I can say is, add the braces, remove the false, and correctly capitalize colorHSVA.
See if this doesn't work.
Are you saying that, when you type it in, it automatically reverts to the colorHSVA thing?
All I can say is, add the braces, remove the false, and correctly capitalize colorHSVA.
See if this doesn't work.
- Code: Select all
(e)=>{
{e.other.controlleracc == 10} ? {
density = 0;
e.other.density = 0;
scene.addcircle({
pos = e.pos;
radius = 0.02;
oncollide = (e)=>{colorHSVA = [1, 1, 1, 1]}
})
} : { }
}
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-

Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: help please
its a question about basics - my scene works without problems as you mention ,BUT if the circles wont be deleted ,they would change their scripts what they should NOT do . i just want to know how to improve something...
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: need help [scripter please]
Wait- you want the original circles to delete their own script when they collide?
If so, try this:
If so, try this:
- Code: Select all
onCollide = (e)<={}
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-

Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: need help [scripter please]
ill say it as clear as possible: my problem is
i have a BOX
the BOX has oncollide option A:
it spawns a CIRCLE oncollide A
this circle has a oncollide option B ,why not
->there is something wrong with the codes ,BECAUSE:
after the BOX collides and A happens
(so CIRCLE spawned with its option B)
the BOX suddenly changes their option A into B
so both ,BOX(used to have A) and CIRCLE have the option B
-----scripts in posts above----
there should be an easy possibility to solve this problem !
or?
i have a BOX
the BOX has oncollide option A:
it spawns a CIRCLE oncollide A
this circle has a oncollide option B ,why not
->there is something wrong with the codes ,BECAUSE:
after the BOX collides and A happens
(so CIRCLE spawned with its option B)
the BOX suddenly changes their option A into B
so both ,BOX(used to have A) and CIRCLE have the option B
-----scripts in posts above----
there should be an easy possibility to solve this problem !
or?
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: need help [scripter please]...not solved jet
Ahh, now I understand. But, I still don't get why this is happening.
Maybe try spawning the circle on a different collision layer????
Maybe try spawning the circle on a different collision layer????
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-

Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: need help [scripter please]...not solved jet
Don't listen them 
just use := instead of = in scene.addCircle
just use := instead of = in scene.addCircle
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: need help [scripter please]...not solved jet
Kilinich wrote:Don't listen them
just use := instead of = in scene.addCircle
:facepalm:
WWHHHHYYYYYYYYY did I not see that before?
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-

Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: need help [scripter please]...not solved jet
thanks guys
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: need help [scripter please]...not solved jet
hiltropper wrote::thumbup: works . when I started scripting I used to write ":=" in any case.
thanks guys
You shouldn't always use := , it necessary only for creating new variables.
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: need help [scripter please]...solved
yes i meant that , in any case when creating variables , but i forgot about it for whatever reason.
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
15 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests



