This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#3276 2011-05-17 22:18:23

knubee
New Scratcher
Registered: 2011-05-14
Posts: 12

Re: BYOB 3 - Discussion Thread

bharvey wrote:

In the tool package (tools.ypr or ToolSprite.ysp in the BYOB folder) there's a block SENTENCE->LIST that does what you want.

Perhaps I am looking at the wrong list blocks, but it is not obvious how to get the string input to convert to separate list items. In other words, if the input sentence is "My name is John", how do I transform this into a list of 4 items:

1 My
2 name
3 is
4 John

rather than a list of 1 item (with the 4 elements above as sub-items of that item)?

I can think of complicated ways to either get the list to be the way I want -- or to read the sublist in item 1. But is there a simple way to just use SENTENCE->LIST to convert the string into a 4-item list?

Offline

 

#3277 2011-05-18 03:28:17

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hi knubee,

I just again checked the sentence->list reportert block (it's in the green "Operators" tab), and it transforms an input of "My name is John" to an anonymous list of four items, one word each. You have to open the tools.ypr file in BYOB or import the ToolSprite.ysp file, switch to the green Operators tab, drag out the (round) reporter block named sentence->list [_] and type your sentence into the input field, and double click on the reporter block.

Please let us know if this doesn't work for you.
Thanks!


Jens Mönig

Offline

 

#3278 2011-05-18 10:03:56

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Ta da!  Here's the official BYOB 3.1 release:

Macintosh

Windows installer

Windows files only

just image and changes

Jens wrote:

A few remaining glitches have been fixed, some localization issues remain, especially with non-Western codepages. Check out Brian's cool animals game!

Thanks, everybody, for the tireless testing, and for all your encouragement.

Enjoy!

--Jens

If you have 3.0, you should probably download the complete 3.1 package, which includes new help files, projects, localization, and tools.

Onward to 4.0!


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3279 2011-05-18 10:08:17

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: BYOB 3 - Discussion Thread

The links are broken.  hmm


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#3280 2011-05-18 10:20:35

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

MathWizz wrote:

The links are broken.  hmm

BYOB site is down.  hmm

Offline

 

#3281 2011-05-18 11:14:11

knubee
New Scratcher
Registered: 2011-05-14
Posts: 12

Re: BYOB 3 - Discussion Thread

Jens wrote:

Hi knubee,

I just again checked the sentence->list reportert block (it's in the green "Operators" tab), and it transforms an input of "My name is John" to an anonymous list of four items, one word each. You have to open the tools.ypr file in BYOB or import the ToolSprite.ysp file, switch to the green Operators tab, drag out the (round) reporter block named sentence->list [_] and type your sentence into the input field, and double click on the reporter block.

Please let us know if this doesn't work for you.
Thanks!

Yes, text can be entered directly into the sentence->list block. However, I am trying to grab user input that is (temporarily) stored in the ANSWER block (variable). Thus, the natural thing to do is create <sentence->list [answer]>. So far, so good. The resulting combination of blocks reports the user input in the form of a list of four items.

However, I want to NAME that list so I can then operate on it. Is there a straight-forward way to do this? (If it can be avoided, I would rather not add that list as item 1 of a named list)

Offline

 

#3282 2011-05-18 11:47:08

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

knubee wrote:

Jens wrote:

Hi knubee,

I just again checked the sentence->list reportert block (it's in the green "Operators" tab), and it transforms an input of "My name is John" to an anonymous list of four items, one word each. You have to open the tools.ypr file in BYOB or import the ToolSprite.ysp file, switch to the green Operators tab, drag out the (round) reporter block named sentence->list [_] and type your sentence into the input field, and double click on the reporter block.

Please let us know if this doesn't work for you.
Thanks!

Yes, text can be entered directly into the sentence->list block. However, I am trying to grab user input that is (temporarily) stored in the ANSWER block (variable). Thus, the natural thing to do is create <sentence->list [answer]>. So far, so good. The resulting combination of blocks reports the user input in the form of a list of four items.

However, I want to NAME that list so I can then operate on it. Is there a straight-forward way to do this? (If it can be avoided, I would rather not add that list as item 1 of a named list)

Use a variable and set the variable to the (sentence (answer) -> list).  smile

Offline

 

#3283 2011-05-18 13:12:21

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

scimonster wrote:

MathWizz wrote:

The links are broken.  hmm

BYOB site is down.  hmm

It works for me.  If you guys are still having trouble, could you send me a screenshot or a more detailed report on what happens when you try it?


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3284 2011-05-18 13:16:01

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

scimonster wrote:

MathWizz wrote:

The links are broken.  hmm

BYOB site is down.  hmm

It works for me.  If you guys are still having trouble, could you send me a screenshot or a more detailed report on what happens when you try it?

Here's the code of the page error:

Code:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Problem loading page</title>
    <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
    <!-- If the location of the favicon is changed here, the FAVICON_ERRORPAGE_URL symbol in
         toolkit/components/places/src/nsFaviconService.h should be updated. -->
    <link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png" />

    <script type="application/javascript"><![CDATA[
      // Error url MUST be formatted like this:
      //   moz-neterror:page?e=error&u=url&d=desc
      //
      // or optionally, to specify an alternate CSS class to allow for
      // custom styling and favicon:
      //
      //   moz-neterror:page?e=error&u=url&s=classname&d=desc

      // Note that this file uses document.documentURI to get
      // the URL (with the format from above). This is because
      // document.location.href gets the current URI off the docshell,
      // which is the URL displayed in the location bar, i.e.
      // the URI that the user attempted to load.

      function getErrorCode()
      {
        var url = document.documentURI;
        var error = url.search(/e\=/);
        var duffUrl = url.search(/\&u\=/);
        return decodeURIComponent(url.slice(error + 2, duffUrl));
      }

      function getCSSClass()
      {
        var url = document.documentURI;
        var matches = url.match(/s\=([^&]+)\&/);
        // s is optional, if no match just return nothing
        if (!matches || matches.length < 2)
          return "";

        // parenthetical match is the second entry
        return decodeURIComponent(matches[1]);
      }

      function getDescription()
      {
        var url = document.documentURI;
        var desc = url.search(/d\=/);

        // desc == -1 if not found; if so, return an empty string
        // instead of what would turn out to be portions of the URI
        if (desc == -1)
          return "";

        return decodeURIComponent(url.slice(desc + 2));
      }

      function retryThis(buttonEl)
      {
        // Session history has the URL of the page that failed
        // to load, not the one of the error page. So, just call
        // reload(), which will also repost POST data correctly.
        try {
          location.reload();
        } catch (e) {
          // We probably tried to reload a URI that caused an exception to
          // occur;  e.g. a nonexistent file.
        }

        buttonEl.disabled = true;
      }

      function initPage()
      {
        var err = getErrorCode();
        
        // if it's an unknown error or there's no title or description
        // defined, get the generic message
        var errTitle = document.getElementById("et_" + err);
        var errDesc  = document.getElementById("ed_" + err);
        if (!errTitle || !errDesc)
        {
          errTitle = document.getElementById("et_generic");
          errDesc  = document.getElementById("ed_generic");
        }

        var title = document.getElementById("errorTitleText");
        if (title)
        {
          title.parentNode.replaceChild(errTitle, title);
          // change id to the replaced child's id so styling works
          errTitle.id = "errorTitleText";
        }

        var sd = document.getElementById("errorShortDescText");
        if (sd)
          sd.textContent = getDescription();

        var ld = document.getElementById("errorLongDesc");
        if (ld)
        {
          ld.parentNode.replaceChild(errDesc, ld);
          // change id to the replaced child's id so styling works
          errDesc.id = "errorLongDesc";
        }

        // remove undisplayed errors to avoid bug 39098
        var errContainer = document.getElementById("errorContainer");
        errContainer.parentNode.removeChild(errContainer);

        var className = getCSSClass();
        if (className && className != "expertBadCert") {
          // Associate a CSS class with the root of the page, if one was passed in,
          // to allow custom styling.
          // Not "expertBadCert" though, don't want to deal with the favicon
          document.documentElement.className = className;

          // Also, if they specified a CSS class, they must supply their own
          // favicon.  In order to trigger the browser to repaint though, we
          // need to remove/add the link element. 
          var favicon = document.getElementById("favicon");
          var faviconParent = favicon.parentNode;
          faviconParent.removeChild(favicon);
          favicon.setAttribute("href", "chrome://global/skin/icons/" + className + "_favicon.png");
          faviconParent.appendChild(favicon);
        }
        if (className == "expertBadCert") {
          showSecuritySection();
        }

        if (err == "remoteXUL") {
          // Remove the "Try again" button for remote XUL errors given that
          // it is useless.
          document.getElementById("errorTryAgain").style.display = "none";
        }

        if (err == "cspFrameAncestorBlocked") {
          // Remove the "Try again" button for CSP frame ancestors violation, since it's
          // almost certainly useless. (Bug 553180)
          document.getElementById("errorTryAgain").style.display = "none";
        }

        if (err == "nssBadCert") {
          // Remove the "Try again" button for security exceptions, since it's
          // almost certainly useless.
          document.getElementById("errorTryAgain").style.display = "none";
          document.getElementById("errorPageContainer").setAttribute("class", "certerror");
          addDomainErrorLink();
        }
        else {
          // Remove the override block for non-certificate errors.  CSS-hiding
          // isn't good enough here, because of bug 39098
          var secOverride = document.getElementById("securityOverrideDiv");
          secOverride.parentNode.removeChild(secOverride);
        }
      }
      
      function showSecuritySection() {
        // Swap link out, content in
        document.getElementById('securityOverrideContent').style.display = '';
        document.getElementById('securityOverrideLink').style.display = 'none';
      }
      
      /* In the case of SSL error pages about domain mismatch, see if
         we can hyperlink the user to the correct site.  We don't want
         to do this generically since it allows MitM attacks to redirect
         users to a site under attacker control, but in certain cases
         it is safe (and helpful!) to do so.  Bug 402210
      */
      function addDomainErrorLink() {
        // Rather than textContent, we need to treat description as HTML
        var sd = document.getElementById("errorShortDescText");
        if (sd) {
          var desc = getDescription();
          
          // sanitize description text - see bug 441169
          
          // First, find the index of the <a> tag we care about, being careful not to
          // use an over-greedy regex
          var re = /<a id="cert_domain_link" title="([^"]+)">/;
          var result = re.exec(desc);
          if(!result)
            return;
          
          // Remove sd's existing children
          sd.textContent = "";

          // Everything up to the link should be text content
          sd.appendChild(document.createTextNode(desc.slice(0, result.index)));
          
          // Now create the link itself
          var anchorEl = document.createElement("a");
          anchorEl.setAttribute("id", "cert_domain_link");
          anchorEl.setAttribute("title", result[1]);
          anchorEl.appendChild(document.createTextNode(result[1]));
          sd.appendChild(anchorEl);
          
          // Finally, append text for anything after the closing </a>
          sd.appendChild(document.createTextNode(desc.slice(desc.indexOf("</a>") + "</a>".length)));
        }

        var link = document.getElementById('cert_domain_link');
        if (!link)
          return;
        
        var okHost = link.getAttribute("title");
        var thisHost = document.location.hostname;
        var proto = document.location.protocol;

        // If okHost is a wildcard domain ("*.example.com") let's
        // use "www" instead.  "*.example.com" isn't going to
        // get anyone anywhere useful. bug 432491
        okHost = okHost.replace(/^\*\./, "www.");

        /* case #1: 
         * example.com uses an invalid security certificate.
         *
         * The certificate is only valid for www.example.com
         *
         * Make sure to include the "." ahead of thisHost so that
         * a MitM attack on paypal.com doesn't hyperlink to "notpaypal.com"
         *
         * We'd normally just use a RegExp here except that we lack a
         * library function to escape them properly (bug 248062), and
         * domain names are famous for having '.' characters in them,
         * which would allow spurious and possibly hostile matches.
         */
        if (endsWith(okHost, "." + thisHost))
          link.href = proto + okHost;

        /* case #2:
         * browser.garage.maemo.org uses an invalid security certificate.
         *
         * The certificate is only valid for garage.maemo.org
         */
        if (endsWith(thisHost, "." + okHost))
          link.href = proto + okHost;
      }
      
      function endsWith(haystack, needle) {
        return haystack.slice(-needle.length) == needle;
      }

    ]]></script>
  </head>

  <body dir="ltr">

    <!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
    

    <!-- PAGE CONTAINER (for styling purposes only) -->
    <div id="errorPageContainer">
    
      <!-- Error Title -->
      <div id="errorTitle">
        <h1 id="errorTitleText">Server not found</h1>
      </div>

      
      <!-- LONG CONTENT (the section most likely to require scrolling) -->
      <div id="errorLongContent">
      
        <!-- Short Description -->
        <div id="errorShortDesc">
          <p id="errorShortDescText">Firefox can't find the server at byob.berkekey.edu.</p>
        </div>

        <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
        <div id="errorLongDesc">

<ul>
  <li>Check the address for typing errors such as
    <strong>ww</strong>.example.com instead of
    <strong>www</strong>.example.com</li>
  <li>If you are unable to load any pages, check your computer's network
    connection.</li>
  <li>If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.</li>
</ul>
</div>

        <!-- Override section - For ssl errors only.  Removed on init for other
             error types.  -->
        
      </div>

      <!-- Retry Button -->
      <button id="errorTryAgain" onclick="retryThis(this);">Try Again</button>

    </div>

    <!--
    - Note: It is important to run the script this way, instead of using
    - an onload handler. This is because error pages are loaded as
    - LOAD_BACKGROUND, which means that onload handlers will not be executed.
    -->
    <script type="application/javascript">initPage();</script>

  </body>
</html>

Offline

 

#3285 2011-05-18 17:41:13

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

scimonster wrote:

Here's the code of the page error:

Huh?


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3286 2011-05-18 18:48:59

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Corrected version (same links as earlier message).

Jens wrote:

please throw away the yesterday's version and take this one instead, it packages the correct help screen for the IS A __ ? reporter block. Sorry for the confusion.

EDIT: Somehow I seem to have posted this message without updating the Windows file only version on the web site.  I've fixed that now, sorry!  (I plead jet lag.)

Last edited by bharvey (2011-05-18 23:49:35)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3287 2011-05-18 19:20:42

knubee
New Scratcher
Registered: 2011-05-14
Posts: 12

Re: BYOB 3 - Discussion Thread

scimonster wrote:

knubee wrote:

However, I want to NAME that list so I can then operate on it. Is there a straight-forward way to do this? (If it can be avoided, I would rather not add that list as item 1 of a named list)

Use a variable and set the variable to the (sentence (answer) -> list).  smile

Oh, yes, that gives me a named variable with the list as its value. But there is no block for "variable contains [thing]". Basically, here is what I was hoping to be able to do:

1. capture user input to "answer"
2. convert the sentence in "answer" to a named list
3. test the named list for presence of keywords

Is the only way to do this to assign the input list to a variable -- and then create my own "variable contains [thing]" predicate?

Offline

 

#3288 2011-05-18 19:41:36

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: BYOB 3 - Discussion Thread

3.1 is out. I wonder if there will be BYOB 3.14  tongue

Offline

 

#3289 2011-05-18 23:48:08

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

knubee wrote:

But there is no block for "variable contains [thing]".

If the value of a variable is a list, you can drag the orange variable blob for that variable onto the list dropdown menu of any of the list blocks, and the block will take that variable's value as the list to operate on.

P.S.  For that matter, you can just say

IF < (SENTENCE->LIST (ANSWER)) CONTAINS whatever > ...

without putting the list into a variable or anything.

Last edited by bharvey (2011-05-18 23:53:35)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3290 2011-05-19 01:45:34

knubee
New Scratcher
Registered: 2011-05-14
Posts: 12

Re: BYOB 3 - Discussion Thread

bharvey wrote:

[f the value of a variable is a list, you can drag the orange variable blob for that variable onto the list dropdown menu of any of the list blocks, and the block will take that variable's value as the list to operate on.

Ah! The ability to drag blocks onto  pull-down menus was the bit I was missing. With that, yes, I see a number of ways of doing what I want.

Thanks for all the help -- and all the good work on BYOB. It is really nice to be able to introduce a wider range of programming concepts and techniques with this version of Scratch!

Offline

 

#3291 2011-05-19 15:06:14

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: BYOB 3 - Discussion Thread

fanofcena wrote:

BYOB is always 1 step ahead of scratch  tongue

scratch 1.4 - byob 2.0
scratch 2.0 - Byob 3.0

with all the cool new features BYOB Will soon become a pros language for experimentisation

Wrong.
Scratch 1.3 - BYOB 1.0
Scratch 1.4 - BYOB 2.0, 3.0, and 3.1
On it's own ways - Snap 4.0+

Offline

 

#3292 2011-05-19 18:26:08

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

First post-official bugfix release 3.1.1:

Macintosh

Windows installer

Windows files only

just image and changes

Jens wrote:

This release fixes two bugs from 3.1:

- clones of clones were broken and once again work. Thanks, Scott, for the testing and the bug report.

- 3.1 produced garbled variable blobs under certain conditions

I didn't expect a new release so soon, OTOH never trust a first release  wink

--Jens


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3293 2011-05-21 15:06:42

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Here I am at the show and tell session at Scratch Day.  A lot of people signed up to show stuff so I don't know if they'll get to me.   smile   Saw Lucario.  Showed sprite inheritance at the Advanced Scratch session.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3294 2011-05-21 16:03:23

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Cool!  smile

Offline

 

#3295 2011-05-22 04:12:11

Taneb
Scratcher
Registered: 2009-07-07
Posts: 100+

Re: BYOB 3 - Discussion Thread

What I still want to see is the join reporter working for scripts. And also lists.

Offline

 

#3296 2011-05-22 08:04:18

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Taneb wrote:

What I still want to see is the join reporter working for scripts. And also lists.

There's an APPEND block in the tools library for lists.  As for scripts, editability is still a little ways in the future, maybe 4.0 or 4.1.

Last edited by bharvey (2011-05-22 12:15:04)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#3297 2011-05-25 22:45:45

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

[...] Saw Lucario. [...]

big_smile


http://i.imgur.com/WBkM2QQ.png

Offline

 

#3298 2011-05-27 13:15:42

14God
Scratcher
Registered: 2008-11-14
Posts: 100+

Re: BYOB 3 - Discussion Thread

Hi people, its been a while since I've posted on the forum because of school.


http://cs.berkeley.edu/~bh/sig4.png
Logic and reason have led me to atheism... but I'm stuck with the name  tongue

Offline

 

#3299 2011-05-28 22:22:55

floppy_gunk
Scratcher
Registered: 2008-11-14
Posts: 500+

Re: BYOB 3 - Discussion Thread

14God wrote:

Hi people, its been a while since I've posted on the forum because of school.

Same  tongue


http://img163.imageshack.us/img163/1917/2856lg.jpg Get it now!  smile

Offline

 

#3300 2011-06-01 09:33:00

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hot off the presses: a Greek translation by
Nektarios Moumoutzis.  Download it and add it to the locale folder.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

Board footer