Scriptmenue doesn't apply Script..

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

Scriptmenue doesn't apply Script..

Postby Ling-Ling » Mon Feb 22, 2010 11:07 pm

HI @,
my problem is, if i write a Script like onCollide:(e)=>{Scene.my.open} in a object that i want to change collision group, if object A collides with object B(onCollide:(e)=>{Scene.my.open = 65}; [65 = A, G] (e.g. if i want to do a door(A), which opens with a magnetic object(G), the scriptmenue doesn't apply my text, the curious thing is, that sometimes it applies, but when I want to save my script it will be reset -.-'
The next thing i can't understand is that for some scripts it applies even if i save the scene o0 xD
I already tried to extract the .phz file and edit the script in the .phn file with text editor, but Algodoo still don't applies it if i want to >.<''
I also tried to delete my config in hope that it will maybe change something, but still the same problem...
I don't know what to do, sometimes it works sometimes not... mostly not ...

(P.s.: Does it makes any difference if i write ":=" instead of only "=")

Sorry for poor english xD, and that the question is maybe a bit noobie, but i just started scripting with Algodoo, and that's the only thing that's not working... up to now ^^

Many thank in advance ;-)
User avatar
Ling-Ling
 
Posts: 5
Joined: Mon Feb 22, 2010 10:38 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby KarateBrot » Tue Feb 23, 2010 1:13 am

Are you sure you always press enter after you wrote your script? If you do not it will not be saved.

And yes, it makes a difference if you type := instead of =
= is the assign sign and := is the declare sign. If you want to change the value of a variable you use = but if you want to create a variable that didn't exist before you type in :=
In your example you want to change the value of scene.my.open so you use =. If you open the console and want to create a new variable, you type in :=
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby Chronos » Tue Feb 23, 2010 4:22 am

Actually, I never typed := in the console to create a new variable. I always just used =. := is used for assigning perimeters to spawned objects.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: Scriptmenue doesn't apply Script..

Postby KarateBrot » Tue Feb 23, 2010 4:37 am

Chronos wrote:Actually, I never typed := in the console to create a new variable. I always just used =.

Yes, algodoo can differenciate between assigning and declaring so you only have to type in = normally. But sometimes it doesn't detect it. So if you only declare variables with = they sometimes won't get declared. You won't recognize it if you don't check all registered custom variables or until some users downloaded your scene and complain about the not working scripting (which nevertheless works on your own PC). :D
That's why := is bomb proof for declaring variables and = isn't always the best choice.


Chronos wrote::= is used for assigning perimeters to spawned objects.

It's := because when you spawn a new object the object's variables also get freshly created, I guess. So algodoo can differenciate between the old's object variables and the ones which get created for the new object
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby Ling-Ling » Tue Feb 23, 2010 1:02 pm

Yes, i really pressed ENTER to save my script :lol: , then it works, but when i save my scene, and reload it, the script in the collideSet of the door disappears. All the other Scripts were saved, just not the ones where the variables should transfer to.

A: onCollide:(e)=>{scene.my.open = 65}
B: collideSet: {scene.my.open}

--> the "{scene.my.open}" of object B won't apply when i save and reload the scene, it will be reset to " 1 "
User avatar
Ling-Ling
 
Posts: 5
Joined: Mon Feb 22, 2010 10:38 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby KarateBrot » Tue Feb 23, 2010 1:09 pm

Ok let's try something different.

► Open the console with F11

► Type in: scene.my.

► Press Tab

And then tell me what will be displayed. Normally all your scene.my. variables will be displayed. If nothing happens tell me about it, too.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby Ling-Ling » Tue Feb 23, 2010 1:26 pm

this will be displayed:

blink
button
door
jump
length
open
text

- So actually yes - All my variables i created, some of them just to look if it would work if i make a new one xD ... senseless ... yeah but you see the Scene.my.open variable is also in it :crazy:

EDIT: lol ? i just tried now to type in {scene.my.open} again, and i works ? o__0 even if i save the scene? but... how ? i mean i did the same as before, i've done just nothing ? :crazy:
User avatar
Ling-Ling
 
Posts: 5
Joined: Mon Feb 22, 2010 10:38 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby KarateBrot » Tue Feb 23, 2010 1:43 pm

Hmm I don't know. A bug maybe?
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby Chronos » Tue Feb 23, 2010 1:52 pm

It's probably that bug where some fields of the script menu don't save the variables.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: Scriptmenue doesn't apply Script..

Postby Ling-Ling » Tue Feb 23, 2010 1:54 pm

Hm yes i hope so... i think i will let you know, if the same problem appears again ^^

so thank you again

Danke KarateBrot :D , hast übrigens tolle Szenen ;)
User avatar
Ling-Ling
 
Posts: 5
Joined: Mon Feb 22, 2010 10:38 pm
Location: Germany

Re: Scriptmenue doesn't apply Script..

Postby KarateBrot » Tue Feb 23, 2010 2:14 pm

Oha dankedanke :D
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 3 guests