Comments (7)
You aren't missing it, Blockly is missing it. Functions should be callable by
the end of the day, and parameters should be ready by end of Monday.
Original comment by [email protected]
on 1 Jun 2012 at 5:24
- Changed state: Started
- Added labels: ****
- Removed labels: ****
from blockly.
Nice :) looking great!
Original comment by [email protected]
on 1 Jun 2012 at 5:24
- Added labels: ****
- Removed labels: ****
from blockly.
Neil,
By parameters, are you referring to the LOCAL_VARIABLE support? I started using
this to build a visual tool for writing code for Second Life. Was able to
implement the state machine support, a few of the zero parameter events, and a
bunch of the available commands, and ran head first in to a wall when I was
trying to create events with parameters because I didn't see anywhere in the
code that LOCAL_VARIABLE is actually being used to do anything at the moment.
If you are unfamiliar (and for your reference), here's some sample LSL code
that shows my issue:
default {
state_entry() {
llSay(0, "Hello world!");
state newState;
}
}
state newState {
touch_start(integer num_detected) {
llSay(0, "There are " + num_detected + " people touching me.");
}
}
Believe it or not, in the first 3 hours of messing with your library, I was
able to get all of this to work (and with no formal docs... WELL DONE!) with
only one exception, and that is the adding of num_detected in the second llSay
using the "create text with" block and "get variable" block.
Here's my code for "touch_start":
Blockly.Language.event_touch_start = {
category: 'Event',
helpUrl: 'http://wiki.secondlife.com/wiki/Touch_start',
init: function() {
this.setColour(COLOR_EVENT);
this.addTitle('on touch start');
this.addInput('store # of touches', '', Blockly.LOCAL_VARIABLE)
.setText('num_detected');
this.addInput('do', '', Blockly.NEXT_STATEMENT);
this.setTooltip('This fires when a touch is first detected.');
this.setPreviousStatement(true);
this.setNextStatement(true);
}
};
Blockly.LSL.event_touch_start = function() {
var numDetected = Blockly.LSL.variableDB_.getName(this.getVariableInput(0), Blockly.Variables.NAME_TYPE);
var branch = Blockly.LSL.statementToCode_(this, 1);
return 'touch_start(integer ' + numDetected + ') {\n' + branch + '}\n';
};
Variables are currently configured in my init and finish sections and seem to
work fine for globals, but the LOCAL_VARIABLE stuff doesn't seem to add
variables in a way that variables_get can find them.
Additionally, I was also unable to figure out how to get the "rename variable"
item in the dropdown to work when added with an addInput of LOCAL_VARIABLE (but
figured out how to do it with an addTitle dropdown), and was wondering if the
proper way to add variable data type declarations was with a input/output block
similar to how you have the math_trig block configured?
I'm really excited to see where this goes, and hope I can continue using it to
build my visual LSL editor! Keep up the good work! :)
Marc
Original comment by marc.melvin
on 2 Jun 2012 at 5:31
- Added labels: ****
- Removed labels: ****
from blockly.
Hi Marc,
Just a quick note, will revisit this tomorrow once I get some sleep.
LOCAL_VARIABLE is currently used in the 'count' and 'for each' loops. The name
is actually a lie, all variables are currently globals. Also, since all
variables are globals, technically you won't even need parameters since
anything you set before the call will be there in the function.
Procedure calls are almost ready.
Original comment by [email protected]
on 2 Jun 2012 at 6:43
- Added labels: ****
- Removed labels: ****
from blockly.
Calling procedures is complete. Procedures with parameters is still to be
done. Enjoy!
Original comment by [email protected]
on 3 Jun 2012 at 6:20
- Changed title: No function parameters?
- Added labels: ****
- Removed labels: ****
from blockly.
Issue 32 has been merged into this issue.
Original comment by [email protected]
on 13 Jun 2012 at 3:21
- Added labels: ****
- Removed labels: ****
from blockly.
Procedures now have parameters! r361
Original comment by [email protected]
on 20 Jul 2012 at 6:23
- Changed state: Fixed
- Added labels: ****
- Removed labels: ****
from blockly.
Related Issues (20)
- JSON Export Import HOT 1
- Need plain "Return" w/o IF HOT 1
- When using blockly maze and puzzle etc the drop down arrows on the blocks don't operate on an iPad. HOT 1
- Number of app's lang-manu HOT 2
- turtle trail does not show on Android Nexus 10
- Blockly.Xml.workspaceToDom doesn´t work on Safari HOT 2
- context menu on tablets HOT 1
- Non Printing Text Characters
- [deleted issue]
- [deleted issue]
- Color dropdowns not listening for touch events HOT 1
- Trashcan Lid animation uses CPU when idle HOT 1
- Uncollapsing duplicated block "Connection already in database" error HOT 2
- Code blocks can become misaligned when moving a set of blocks with a "break out of loop" attached to it out of a loop
- Mouse wheel scrolling fails to scroll blockly scroll bars up or down HOT 1
- Blocky GUI is pushed from view when a long text string is entered into a block
- If block breaks when click on the star. HOT 1
- Blockly games not running correctly on chrome! HOT 4
- Headless blockly doesn't work for function/procedure calls with parameters HOT 1
- How to create types to restrict connections between few custom blocks?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blockly.