Objects won't take my variables?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Objects won't take my variables?

Postby Epic_SkyPilot » Sat Jul 18, 2015 7:11 am

So I'm trying to make a spawn engine, only I have one problem. Most of my objects won't accept any scripting! I've just recently made an engine, and i'm using the same exact scripts for this one.

For instance, I have one laser that has "onLaserHit = e=>{ scene.my.rpm > 15 ? {} : { scene.my.imode = 4 }" so that basically means that while my engine is rotating slowly, a circle has it's collision to 4, or C. However, when I try to go to that circle and in collideSet type in scene.my.imode, it just deletes and in the console it says "collideSet was bound to bad type."

This is driving me absolutely crazy. It took me so long to make my first engine because of problems similar to this, only this time it's even worse. So often it seems like I just have a variable in the scene, and it's a 50/50 shot whether the geom will actually take it.

Please someone help me and explain what this problem is. And before I'm bombarded by the obvious suggestions, I'll just tell you: NO, it's not just the scripting wrong. I'm doing it the same exact way as in the other engine, which works 100% perfectly. And NO, I'm not typing the variable in wrong. I've tried at least a dozen times.

Thanks for the help guys.
Epic_SkyPilot
 
Posts: 12
Joined: Sun Sep 14, 2014 11:28 pm

Re: Objects won't take my variables?

Postby electronicboy » Sat Jul 18, 2015 11:36 pm

if thats an exact copy and paste of what is in the box, you're missing a } at the end
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Objects won't take my variables?

Postby Epic_SkyPilot » Sun Jul 19, 2015 2:28 am

Thank you for the reply electronicboy, but no that's not the problem. I just took pictures of my scripts and type them in, I don't copy/paste.
Epic_SkyPilot
 
Posts: 12
Joined: Sun Sep 14, 2014 11:28 pm

Re: Objects won't take my variables?

Postby homieeee » Sat Jul 25, 2015 2:54 am

"collideSet was bound to bad type." means you aren't using an integer when attempting to set the collideSet. Either the variable is being set to something else without you knowing or you need to make sure you are using integers and not floats. EX: "CollideSet = math.toint(scene.my.var)

You should avoid using global variables like "scene.my." since you might have used it for something else and forgot. If you have any other questions just ask.
User avatar
homieeee
 
Posts: 14
Joined: Thu Oct 09, 2014 2:13 am

Re: Objects won't take my variables?

Postby Xray » Sat Aug 01, 2015 2:17 am

Epic_SkyPilot - Did you get your question resolved yet? If not, could you post an example scene that shows the problem you are having? Sometimes (usually) it's a lot easier for us to figure out a problem when we have an example to test, rather than trying to go by a verbal explanation of it. :)
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Objects won't take my variables?

Postby T'wind_ » Sun Aug 02, 2015 2:03 pm

First initialize your variable in the console. Just type in the console scene.my.imode = 0; or another value.
The reason it just deletes is probably because scene.my.imode has no value while you type it.
User avatar
T'wind_
 
Posts: 86
Joined: Wed Jul 08, 2015 5:33 pm
Location: Western Europe

Re: Objects won't take my variables?

Postby FRA32 » Tue Aug 04, 2015 1:02 am

Teh reason you have the problem is because when having a fresh scene(time wasnt runnign yet, or no update methods were changing your scene.my variables) all the new variables hav eno value. If you try to set an objects collideset to something that isnt a value at all it spits out an error because it needs a value to specify the collideset. The best solution is to call up the console using f10 and then typing in
"scene.my.imode = 0"
this way you add a default value to it at the start so everything is working.
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests

cron