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
from blockly.
Nice :) looking great!
Original comment by [email protected]
on 1 Jun 2012 at 5:24
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
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
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?
from blockly.
Issue 32 has been merged into this issue.
Original comment by [email protected]
on 13 Jun 2012 at 3:21
from blockly.
Procedures now have parameters! r361
Original comment by [email protected]
on 20 Jul 2012 at 6:23
- Changed state: Fixed
from blockly.
Related Issues (20)
- maze demo: blockly character is not on maze/ goal is not on maze/ no coding tools for maze HOT 2
- user reqeust: demo sandbox for solving/creating math problems HOT 4
- Testing mail settings. HOT 1
- Generated Python code scopes variables incorrectly HOT 6
- Add text read (prompt/input) block HOT 3
- Open Blocks menu on mouse hover HOT 1
- Getting item 0 in list translated into list[-1] HOT 3
- Need copy, undo and redo support HOT 3
- Upper and lower case HOT 2
- Lack of type conversion HOT 2
- Comparison Operators HOT 2
- Not working in IE9 HOT 14
- google-blockly user question: how to name parameter(s) in a function? HOT 2
- Fails in chromium when accessed via file:// HOT 1
- how to run the demos? HOT 1
- Touch events on mobile Safari on iPad (likely also on Android tablets) HOT 4
- Use local storage to save and restore current work when user leave or refresh current page HOT 4
- Creating a variable named "length" breaks the XML tab HOT 2
- Equip List with Stack's ability. HOT 4
- Opera not supported HOT 1
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.