add values to an objekt
10 posts • Page 1 of 1
add values to an objekt
I tryed to add a new value to an objekt.
I typed "X = 1" in the lowermost box of the script menu.
The new value appeared, and the script was able to use the value.
But if I reload the scene, X = 1 disappeared.
Then I tryed to type "X := 1". Exactly the same problem.
I remember a post, which was about the same problem, but I wasn't able to find it. If you know where that post is, pls link to it.
I typed "X = 1" in the lowermost box of the script menu.
The new value appeared, and the script was able to use the value.
But if I reload the scene, X = 1 disappeared.
Then I tryed to type "X := 1". Exactly the same problem.
I remember a post, which was about the same problem, but I wasn't able to find it. If you know where that post is, pls link to it.
-

Username? - Posts: 65
- Joined: Sun Sep 20, 2009 8:06 pm
Re: add values to an objekt
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
- Posts: 85
- Joined: Mon Dec 20, 2010 12:02 pm
- Location: Germany
Re: add values to an objekt
@hilt, if you read the post, he wants to store a variable on a geometry. NOT in the scene.my section
From my experience, best advice would be create a collider that has 1 small collision with the object as sometimes these new custom variables are saved, and sometimes there not.
if you are using an object such as a laser, my method would be similar to this
If you need an example, i will create one tomorrow when im not supposed to be asleep...
From my experience, best advice would be create a collider that has 1 small collision with the object as sometimes these new custom variables are saved, and sometimes there not.
if you are using an object such as a laser, my method would be similar to this
- Code: Select all
e.geom/other.X := 1,
E.laser/this.oncollide/onlaserhit = <default info in thyme exe section or custom code for collider>
If you need an example, i will create one tomorrow when im not supposed to be asleep...
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: add values to an objekt
The same problem, that I can't save it, but now I can use the script to add the values.
Thanks!
Thanks!
-

Username? - Posts: 65
- Joined: Sun Sep 20, 2009 8:06 pm
Re: add values to an objekt
Uh...WHAT DOES ADDING A VALUE TO AN OBJECT EVEN DO?!
Is it different from scene.my.?
Is it different from scene.my.?
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: add values to an objekt
When I add a value, save the scene, close algodoo, and reload the scene, the value seems to be away.
Or is the value just not listed in the scrip menü like the IDs?
Or is the value just not listed in the scrip menü like the IDs?
-

Username? - Posts: 65
- Joined: Sun Sep 20, 2009 8:06 pm
Re: add values to an objekt
Username? wrote:When I add a value, save the scene, close algodoo, and reload the scene, the value seems to be away.
Or is the value just not listed in the scrip menü like the IDs?
Custom variables not saving with scene so they can be only run-time.
Workaround is to use "free" variables like controllerAcc, textureMatrix (if there is no texture on geom) etc.
or create scene.my. 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: add values to an objekt
as you might have found out, that collider must run the script everytime the scene is reloaded.
if you want, I will look into improving the collider-script later as i already know the method i will use to do it...
or as kilinich says, you could use unused variables such as controllerAcc or scene.my to save the variables.
if you want, I will look into improving the collider-script later as i already know the method i will use to do it...
or as kilinich says, you could use unused variables such as controllerAcc or scene.my to save the variables.
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: add values to an objekt
bad news, my method failed...
the plan was to check if a custom geom.var equaled 1234, and i was hoping that algodoo would see it as false when the scene was loaded, and would run the false IF script which would create all custom variables and would make the IF script true
the only backup method i can think of is time based,
That will create the variables you need if the sim-running time is less that 2 and run the script if the sim-running time is over 2, That code would be for the object doing the "thinking".
the plan was to check if a custom geom.var equaled 1234, and i was hoping that algodoo would see it as false when the scene was loaded, and would run the false IF script which would create all custom variables and would make the IF script true
the only backup method i can think of is time based,
- Code: Select all
sim.time < 2 ? {<thyme to create variables>} : {code to run}
That will create the variables you need if the sim-running time is less that 2 and run the script if the sim-running time is over 2, That code would be for the object doing the "thinking".
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
10 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests



