How do you create new functions?
Offline
SciTecCf wrote:
It has a syntax error.
Change the encoding in notepad to ANSI
Unlike normal patches if you are using the Add patch tool
(If you installed it! )
Offline
LS97 wrote:
blob8108 wrote:
LS97 wrote:
Oh come on, I'm on holiday...
...you mean you don't do this for fun?
Of course I do, otherwise I wouldn't have done it in the first place
But it goes without saying that I prefer a swim in the pool or a day at the beach...
...are you sure you belong here? (Just kidding, of course...)
Offline
lallaway12 wrote:
broadcast [ v]
That's actually a bug in the blocks plugin, I think. It's not in the list of bugs, though, for some reason...
Offline
The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.
Offline
Randomno wrote:
The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.
Well yeah, you can use the top left pane to navigate to the folder where you downloaded the CS file!
Offline
LS97 wrote:
Randomno wrote:
The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.
Well yeah, you can use the top left pane to navigate to the folder where you downloaded the CS file!
Like I said, the .cs file isn't a download.
Offline
Randomno wrote:
LS97 wrote:
Randomno wrote:
The .cs isn't a download so I am confused. I tried filing in the code with the workspace, but it didn't work. All I get in the file list is the files in my Scratch folder.
Well yeah, you can use the top left pane to navigate to the folder where you downloaded the CS file!
Like I said, the .cs file isn't a download.
Try saving the page...?
Offline
when gf clicked stop all sounds say ( [sqrt v] of (var)) for ( [size v] of (var) ) secsWell, saving the page worked. It doesn't say you have to do that, though.
Offline
Randomno wrote:
when gf clicked stop all sounds say ( [sqrt v] of (var)) for ( [size v] of (var) ) secsWell, saving the page worked. It doesn't say you have to do that, though.
I think it depends on the browser. Chrome automatically downloads it for me.
Offline
Bumping an awesome and useful topic
Offline
Excellent idea!
Offline
Thank you!
Offline
Very nice. I used it for the first time today.
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.
Offline
blob8108 wrote:
lallaway12 wrote:
broadcast [ v]That's actually a bug in the blocks plugin, I think. It's not in the list of bugs, though, for some reason...
Offline
scimonster wrote:
Very nice. I used it for the first time today.
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.
I think it has to do with your Operating system. I used Windows default CRLF...
Offline
LS97 wrote:
scimonster wrote:
Very nice. I used it for the first time today.
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.I think it has to do with your Operating system. I used Windows default CRLF...
I'm also using Windows. Perhaps your default is different then mine? Was it you who uses the AZERTY keyboard?
Offline
I found a bug...
when I receive [HTLoad v] delete (all v) of [HTArgs v] delete (all v) of [HTCommand v] delete (all v) of [HTVars v] delete (all v) of [Label v] delete (all v) of [My Code v] set [i v] to [0] repeat (length of [Code v] ) change [i v] by (1) set [j v] to [1] repeat until <<(letter (j) of (item (i) of [Code v] )) = [<]> or <(j) > (length of (item (i) of [Code v] ))>> change [j v] by (1) end if <<<(letter (j) of (item (i) of [Code v] )) = [<]> and <(letter ((j) + (1)) of (item (i) of [Code v] )) = [H]>> and <<(letter ((j) + (2)) of (item (i) of [Code v] )) = [T]> and <(letter ((j) + (3)) of (item (i) of [Code v] )) = [S]>>> if <<<(letter ((j) + (4)) of (item (i) of [Code v] )) = [c]> and <(letter ((j) + (5)) of (item (i) of [Code v] )) = [r]>> and <<(letter ((j) + (6)) of (item (i) of [Code v] )) = [i]> and <(letter ((j) + (7)) of (item (i) of [Code v] )) = [p]>>> if <<<(letter ((j) + (8)) of (item (i) of [Code v] )) = [t]> and <(letter ((j) + (9)) of (item (i) of [Code v] )) = [:]>> and <not <<(letter ((j) + (10)) of (item (i) of [Code v] )) = [m]> and <(letter ((j) + (11)) of (item (i) of [Code v] )) = [a]>>>> if <not <<(letter ((j) + (12)) of (item (i) of [Code v] )) = [t]> and <(letter ((j) + (13)) of (item (i) of [Code v] )) = [h]>>> add (item (i) of [Code v] ) to [My Code v] end end end end end set [i v] to [1] hide repeat until <(i) > (length of [My Code v] )> set [j v] to [0] repeat until <(letter (j) of (item (i) of [My Code v] )) = [:]> change [j v] by (1) end add [] to [HTCommand v] change [j v] by (1) repeat until <<(letter (j) of (item (i) of [My Code v] )) = [;]> or <<(letter (j) of (item (i) of [My Code v] )) = [=]> or <(letter (j) of (item (i) of [My Code v] )) = [>]>>> replace item (last v) of [HTCommand v] with (join (item (last v) of [HTCommand v] ) (letter (j) of (item (i) of [My Code v] ))) change [j v] by (1) end if <not <(letter (j) of (item (i) of [My Code v] )) = [>]>> if <(letter (j) of (item (i) of [My Code v] )) = [=]> change [j v] by (1) add [] to [Label v] repeat until <<(letter (j) of (item (i) of [My Code v] )) = [;]> or <(letter (j) of (item (i) of [My Code v] )) = [>]>> replace item (last v) of [Label v] with (join (item (last v) of [Label v] ) (letter (j) of (item (i) of [My Code v] ))) change [j v] by (1) end else add [] to [Label v] end change [j v] by (1) add [] to [HTArgs v] set [temp1 v] to [0] repeat until <(j) > ((length of (item (i) of [My Code v] )) - (1))> if <(letter (j) of (item (i) of [My Code v] )) = [;]> if <(temp1) = [0]> add [HT{end}] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] end add [] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] else if <(letter (j) of (item (i) of [My Code v] )) = [%]> if <(temp1) = [0]> if <(item (last v) of [HTArgs v] ) = []> replace item (last v) of [HTArgs v] with [HT{var}] else add [HT{var}] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] end add [] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] set [temp1 v] to [1] else if <(item (last v) of [HTArgs v] ) = []> replace item (last v) of [HTArgs v] with [HT{endVar}] else add [HT{endVar}] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] end add [] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] set [temp1 v] to [0] end else if <<< [boolOps v] contains (letter (j) of (item (i) of [My Code v] ))> or < [logicOps v] contains (letter (j) of (item (i) of [My Code v] ))>> or << [Paren v] contains (letter (j) of (item (i) of [My Code v] ))> or <<(letter (j) of (item (i) of [My Code v] )) = [!]> or <(letter (j) of (item (i) of [My Code v] )) = ["]>>>> if <(item (last v) of [HTArgs v] ) = []> replace item (last v) of [HTArgs v] with (letter (j) of (item (i) of [My Code v] )) else add (letter (j) of (item (i) of [My Code v] )) to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] end add [] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] else replace item (last v) of [HTArgs v] with (join (item (last v) of [HTArgs v] ) (letter (j) of (item (i) of [My Code v] ))) end end end change [j v] by (1) end if <<(item (last v) of [HTArgs v] ) > []> or <(item (last v) of [HTCommand v] ) = []>> if <(item (last v) of [HTArgs v] ) = []> replace item (last v) of [HTArgs v] with [HT{end}] else add [HT{end}] to [HTArgs v] add [] to [HTCommand v] add [] to [Label v] end end else add [] to [Label v] add [] to [HTArgs v] end change [i v] by (1) end delete (all v) of [HTRunStack v] delete (all v) of [HTRunStack_2 v] delete (all v) of [HTVars v] delete (all v) of [HTVarValues v] delete (all v) of [HTLiveObject:Name v] delete (all v) of [HTLiveObject:Type v] delete (all v) of [HTLiveObject:Args v] delete (all v) of [HTLiveObject:OldArgs v] set [i v] to [0] set [HTErrorLine v] to [0] set [isBoolean v] to [0] repeat until <(i) > (length of [HTCommand v] )> change [i v] by (1) if <(item (i) of [HTCommand v] ) = [onLoad]> repeat until <(item (i) of [HTCommand v] ) = [end_onLoad]> change [i v] by (1) end else broadcast (join [HTEval:] (item (i) of [HTCommand v] )) and wait end end
Offline
blob8108 wrote:
samtwheels wrote:
You should make one that imports scratchblocks code into scratch!
Again, I'm working on exactly that in Python. It's quite complicated; a bit like writing a parser/compiler. The hardest part is dealing with booleans, because the less than/greater than symbol looks like the beginning/end of a boolean block:
Code:
if <(2)>(3)>I've managed to deal with this by learning how proper parsers work, though.
The way the forum plugin does it is by replacing
) > ( with ) > (, ) < ( with ) < (, ] > [ with ] > [, ] > ( with ] &lgt; (, and so on thit all the possible combinations of ] or ) followed by < or > followed by [ or (
Offline
scimonster wrote:
LS97 wrote:
scimonster wrote:
Very nice. I used it for the first time today.
The only problem i had with it was that it added some sort of weird line break, which got interpreted as two when i pasted it into an HTML TEXTAREA.I think it has to do with your Operating system. I used Windows default CRLF...
I'm also using Windows. Perhaps your default is different then mine? Was it you who uses the AZERTY keyboard?
Yeah, that's me, but the keyboard has absolutely no effect on line breaks. Are you using Firefox? Maybe it uses different standards of breaking lines...
@Mathwizz: LOL, I doubt anybody will need to paste all that code on the forums... besides, is the bug in my plugin or in the parser?
Offline
when gf clicked go to x: (0) y: (-90) set [xv v] to [0] set [yv v] to [0] forever set [bleh v] to [0] if <key [left arrow v] pressed?> change [xv v] by (-0.7) end if <key [right arrow v] pressed?> change [xv v] by (0.7) end set [xv v] to ((xv) * (0.9)) change x by (xv) if <touching color [#000008]?> change y by (1) change [bleh v] by (1) if <touching color [#000008]?> change y by (1) change [bleh v] by (1) if <touching color [#000008]?> change y by (1) change [bleh v] by (1) if <touching color [#000008]?> change y by (1) change [bleh v] by (1) if <touching color [#000008]?> change y by (1) change [bleh v] by (1) if <touching color [#000008]?> change x by ((xv) * (-1)) set [xv v] to [0] change y by (-5) if <key [up arrow v] pressed?> change x by (5) set [c n v] to [-5] if <touching color [#000008]?> set [xv v] to [-10] set [yv v] to [12] else change x by (-10) set [c n v] to [5] if <touching color [#000008]?> set [xv v] to [10] set [yv v] to [12] end end change x by (c n) else change [xv v] by ((0) - ((xv) / (bleh))) end else end end end end end end set [yv v] to ((yv) * (0.9)) change y by (yv) if <touching color [#000008]?> change y by ((yv) * (-1)) set [yv v] to [0] end change y by (-1) if <key [up arrow v] pressed?> if <touching color [#000008]?> set [yv v] to [12] end end change y by (1) if <(yv) < [4]> change y by (-1) if <not <touching color [#000008]?>> change [yv v] by (-1) end change y by (1) end endTesting this. (BTW perfect platformer script above XD)
Offline
Wow, this is really impressive LS97! Quite a useful plugin to have - kudos to you for making it. I hope the Scratch Team adds something like this to Scratch 2.0! Here's a brief test with one of my projects I made to practice vocabulary:
when gf clicked delete (all v) of [Log v] delete (all v) of [wordsleft v] add [To use this program, you will type in a vocabulary word, given the definition.] to [Log v] add [Spelling does count!] to [Log v] add [You will need to successfully need to identify each word TWO times minimum in order to remove it from the list of words to do.] to [Log v] add [If you get a word wrong, if you previously had to complete it four times, than you would afterwards have to do it 5 times.] to [Log v] add [This helps you study the words you need most help with.] to [Log v] add [Press enter to continue.] to [Log v] ask [] and wait add [Loading...] to [Log v] repeat (2) set [i v] to [1] repeat (length of [english v] ) add (i) to [wordsleft v] change [i v] by (1) end end set [i v] to (pick random (1) to (length of [wordsleft v] )) repeat until <(length of [wordsleft v] ) = [0]> add (join (join [What word means "] (item (item (i) of [wordsleft v] ) of [spanish v] )) [?"]) to [Log v] ask [] and wait if <(item (item (i) of [wordsleft v] ) of [english v] ) = (answer)> add (join (join (join (join [Good job! "] (item (item (i) of [wordsleft v] ) of [english v] )) [" means "]) (item (item (i) of [wordsleft v] ) of [spanish v] )) [." Press enter to continue.]) to [Log v] ask [] and wait delete (i) of [wordsleft v] else add (join (join (join (join [Sorry, the word "] (item (item (i) of [wordsleft v] ) of [english v] )) [" means "]) (item (item (i) of [wordsleft v] ) of [spanish v] )) [." Press enter to continue.]) to [Log v] ask [] and wait add (item (i) of [wordsleft v] ) to [wordsleft v] end set [i v] to (pick random (1) to (length of [wordsleft v] )) end add [You have completed the program.] to [Log v]I can't see any problems (except for some graphical issues with the plugin itself). One thing I noticed is that all of the blocks are spaced out with a line in between each other - which although a bit of a hassle to remove, it still gets the job done.
Offline
Thanks for your opinions and tests, guys!
It seems to me that the last two scripts were converted perfectly by the plugin. The blank ask block in Lucario's script left me perplexed, but I figure it's also done in the original script (which makes sense, since it looks nicer).
This spacing issue has already been reported by scimonster. What browsers are you guys using? In any case remember blank lines don't actually affect the renderer, so blocks get parsed anyway.
Having such feature in Scratch 2.0 (as well as vice versa -- copying the text of a scratchblocks into Scratch, which I would happily create a plugin for too if it weren't for its current futility for reasons stated at asterisk*) would really be nice. You guys, being mods, don't happen to have any news/influence on this matter?
*Asterisk. I would have created a plugin to parse scratchblocks code and spawn a script, but I found the costs outweighed the benefits. This is because the user that wants the scratchblocks code must either view the wiki source or quote the forum user to get raw code, as selecting the text of the blocks and copying that instead does not work.
However, I thought of a mechanism that would allow such copying supported by all browsers. Shouldn't it be possible to hide brackets and other symbols used in scratchblocks code as invisible text in the rendered version? That way it wouldn't affect viewing, but would be copied when selected.
Anyway, that was a way too long footnote.
Offline
You're welcome Another test:
A binary to image converter me and my friend made
when gf clicked delete (all v) of [#'s v] clear set [brightness v] effect to (0) go to x: (96) y: (104) stamp repeat (9) change x by (4) stamp end repeat (9) change y by (-4) stamp end repeat (9) change x by (-4) stamp end repeat (9) change y by (4) stamp end ask [Input #] and wait set [Input # v] to (answer) set [teh number v] to [2] if <((answer) mod (2)) = [1]> add [1] to [#'s v] else add [0] to [#'s v] end repeat (63) if <((round (((answer) / (teh number)) - (0.5))) mod (2)) = [1]> add [1] to [#'s v] else add [0] to [#'s v] end set [teh number v] to ((teh number) * (2)) end go to x: (100) y: (100) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end change y by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] repeat (7) change x by (-4) if <(item (1 v) of [#'s v] ) = [1]> set [brightness v] effect to (100) stamp else set [brightness v] effect to (-100) end delete (1 v) of [#'s v] end go to x: (96) y: (104) set [brightness v] effect to (0)
Offline