Giter Club home page Giter Club logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
Nice :) looking great!

Original comment by [email protected] on 1 Jun 2012 at 5:24

from blockly.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
Issue 32 has been merged into this issue.

Original comment by [email protected] on 13 Jun 2012 at 3:21

from blockly.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 20, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.