Importing key bindings and variables with phunlets

Suggest changes and improvements to Algodoo.

Importing key bindings and variables with phunlets

Postby ShnitzelKiller » Mon Sep 14, 2009 7:06 am

I've made a laser tank which turns its cutting laser on and off with a key, but importing it as a phunlet doesn't include the necessary thyme to make it work properly. So I propose that all variables from the phunlet are imported into the scene you have, as well as the scripts applied to any objects. Not out of the question, I hope?

So long as variable names don't collide. And in fact, if they do, you could perhaps auto-assign them with an extra 001 at the end or something.
Image
User avatar
ShnitzelKiller
 
Posts: 49
Joined: Sun Sep 06, 2009 9:42 pm

Re: Importing key bindings and variables with phunlets

Postby Mystery » Tue Sep 15, 2009 12:39 pm

This is actually very easy to do.
To make something phunlet safe You need to create the variable with oncollide
Code: Select all
Scene.my.test := 10

The := means a new variable.
The := is also used with spawing objects in the sense the objects didn't have certain internal variables thus the := is necessary.
Using the := when not creating variable will simply clutter up the console with error messages.

Enjoy your phunlet safeing experiences. :D
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Importing key bindings and variables with phunlets

Postby ShnitzelKiller » Thu Sep 17, 2009 5:01 am

Mystery wrote:This is actually very easy to do.
To make something phunlet safe You need to create the variable with oncollide
Code: Select all
Scene.my.test := 10

The := means a new variable.
The := is also used with spawing objects in the sense the objects didn't have certain internal variables thus the := is necessary.
Using the := when not creating variable will simply clutter up the console with error messages.

Enjoy your phunlet safeing experiences. :D


That should be changed... to have to have some constant collider just to set a variable in a phunlet imported?

EDIT: AARGH! The script fields don't get saved!

Well, particularly the "cutter" field in the laser options, when I save the phunlet, it's not there on the next load. Even if I set the variable in the console in that scene under scene.my.
Image
User avatar
ShnitzelKiller
 
Posts: 49
Joined: Sun Sep 06, 2009 9:42 pm


Return to Suggestions

Who is online

Users browsing this forum: No registered users and 9 guests

cron