Closed GoogleCodeExporter closed 8 years ago
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 neil.fra...@gmail.com
on 1 Jun 2012 at 5:24
Nice :) looking great!
Original comment by liminast...@gmail.com
on 1 Jun 2012 at 5:24
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
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 neil.fra...@gmail.com
on 2 Jun 2012 at 6:43
Calling procedures is complete. Procedures with parameters is still to be
done. Enjoy!
Original comment by neil.fra...@gmail.com
on 3 Jun 2012 at 6:20
Issue 32 has been merged into this issue.
Original comment by neil.fra...@gmail.com
on 13 Jun 2012 at 3:21
Procedures now have parameters! r361
Original comment by neil.fra...@gmail.com
on 20 Jul 2012 at 6:23
Original issue reported on code.google.com by
liminast...@gmail.com
on 1 Jun 2012 at 5:15