How do you make a phunet add its own variables into a scene?
5 posts • Page 1 of 1
How do you make a phunet add its own variables into a scene?
Here's my gearbox>http://www.algodoo.com/algobox/details.php?id=94667
The problem is, when I have saved it as a phunlet and insert it in another scene, it won't work. So, I will have to put in variables "scene.my.gearr, secene.my.gear1-9" all over again for it to work. It is very impractical... and stupid.
I am a super newbie on thyming. Can you help me out here? Any scripts that will add variables every time I use the phunlet? Plus, can you give me a good link where I can learn everything about thyming?
BTW, how's my gearbox? Descent? Bad? Keul?
Thanks a ton, and have a nice day!
The problem is, when I have saved it as a phunlet and insert it in another scene, it won't work. So, I will have to put in variables "scene.my.gearr, secene.my.gear1-9" all over again for it to work. It is very impractical... and stupid.
I am a super newbie on thyming. Can you help me out here? Any scripts that will add variables every time I use the phunlet? Plus, can you give me a good link where I can learn everything about thyming?
BTW, how's my gearbox? Descent? Bad? Keul?
Thanks a ton, and have a nice day!
-
Alex_Mercer - Posts: 6
- Joined: Thu Oct 30, 2014 9:18 pm
- Location: Syriam, Myanmar
Re: How do you make a phunet add its own variables into a scene?
All you can really do is add a if onto something in there, with a blank variable or something. pretty much something along the lines of
if scene.my.geartestv != 1 then
scene.my.geartestv :=1
<init other variables
endif
^ Not thyme code ofc, Not touched thyme in while, but in theory that should work
if scene.my.geartestv != 1 then
scene.my.geartestv :=1
<init other variables
endif
^ Not thyme code ofc, Not touched thyme in while, but in theory that should work
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: How do you make a phunet add its own variables into a scene?
There is a better way - onSpawn events in object's script menu.
So put some geom on scene, send to back, add onSpawn=(e)=>{scene.my.test = 0}
So put some geom on scene, send to back, add onSpawn=(e)=>{scene.my.test = 0}
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: How do you make a phunet add its own variables into a scene?
Kilinich wrote:There is a better way - onSpawn events in object's script menu.
So but some geom on scene, send to back, add onSpawn=(e)=>{scene.my.test = 0}
Thanks a lot man, now my gearbox is working like a charm!
@electronicboy: That was a little complicated for me; didn't really get what you meant... Thanks a lot for your effort, tho!
-
Alex_Mercer - Posts: 6
- Joined: Thu Oct 30, 2014 9:18 pm
- Location: Syriam, Myanmar
Re: How do you make a phunet add its own variables into a scene?
Alex_Mercer wrote:Kilinich wrote:There is a better way - onSpawn events in object's script menu.
So but some geom on scene, send to back, add onSpawn=(e)=>{scene.my.test = 0}
Thanks a lot man, now my gearbox is working like a charm!
@electronicboy: That was a little complicated for me; didn't really get what you meant... Thanks a lot for your effort, tho!
More elegant way is to check if it runs only on scene start (not on undo):
onSpawn=(e)=>{sim.time == 0 ? {scene.my.test = 0} : {}}
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
5 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests