sparks wrote:
sounds good Zorket You're already top scratch block contributor!
here's a challange for you, can you make any of these?
[clear line (n) or file [s]]
[write [s] to line (n) in file [s]]
?
What do you want them in, Panther?
Offline
Sparks wrote:
[clear line (n) or file [s]]
[write [s] to line (n) in file [s]]
clear line $Number$ of file $String$ Type - Code: | t3 t4 t5 t6 | t3_ self numFileLines: (t2) . t3 = '' ifTrue: [ ^ 0]. t4_ 0. t5_ {} as: OrderedCollection. t3 timesRepeat: [ t4_ t4 + 1. t6_ self readLine: (t4) ofFile: (t2). t5 add: t6. ]. self clearFile: (t2). t4_ 0. t3_ t5 size. t3 timesRepeat: [ t4_ t4 + 1. t4 = t1 ifTrue: [ t6_ ''. ] ifFalse: [ t6_ t5 at: t4. ]. self writeText: (t6) toFile: (t2) ]. --------------------- Replace line $Number$ of file $String$ with $String$ Type - Code: | t30 t4 t5 t6 | t30_ self numFileLines: (t2) . t30 = '' ifTrue: [ ^ 0]. t4_ 0. t5_ {} as: OrderedCollection. t30 timesRepeat: [ t4_ t4 + 1. t6_ self readLine: (t4) ofFile: (t2). t5 add: t6. ]. self clearFile: (t2). t4_ 0. t30_ t5 size. t30 timesRepeat: [ t4_ t4 + 1. t4 = t1 ifTrue: [ t6_ t3. ] ifFalse: [ t6_ t5 at: t4. ]. self writeText: (t6) toFile: (t2) ]. --------------------- Name: Place of $String$ in $List$ Type: -r Code: |t3 t4 t5 t6| t3_ 0. t4_ 0. t5_ self lineCountOfList: (t2). t6_ ''. t5 timesRepeat: [ t3_ t3 + 1. t4_ self getLine: (t3) ofList: (t2). t4 = t1 ifTrue: [ t6_ t3. ]. ]. t6 = '' ifTrue: [ ^ 0. ] ifFalse:[ ^t6. ]. ------------------- Name: Complile $List$ with $String$ as breaker Type: -r Code: |t3 t4 t5 t6| t3_ self lineCountOfList: (t1). t4_ '' . t6_ 0. t3 timesRepeat:[ t6_ t6 + 1. t5_ self getLine: (t6) ofList: (t1) . t5_ self concatenate: (t5) with: (t2). t4_ self concatenate: (t4) with: (t5). ]. ^t4 ------------------ Name: Decompile $String$ to $List$ with $String$ as breaker Type: - Code: |t4 t5 t6 t7 t8 t9| t4_ self stringLength: (t1). t5_ self letter: (t4) of: (t1). t5 = t3 ifTrue: [ t9_ t1.] ifFalse: [ t9_ self concatenate: (t1) with: (t3)]. t4_0. t5_0. t6_ ''. t8_ self stringLength: (t9) . t8 timesRepeat:[ t4_ t4 + 1. t5_ self letter: (t4) of: (t9). t5 = t3 ifTrue:[ self append: (t6) toList: (t2). t6_ ''. ] ifFalse:[ t6_ self concatenate: (t6) with: (t5). ]. ]. ---------------------- Name: $String$ in dialog confirmed? Type: -r Code: ^ DialogBoxMorph ask: t1 ------------------ Name: ask in dialog $String$ Type: -r Code: ScratchPrompterMorph lastAnswer: (StringDialog ask: t1). ^ self answer ----------------------- Name: (Binary to hexamadecimal colour) Binary: $String$ to colour Type: -r Code: |length n1 n2 n3 n4 n5 n6 num x1 c1 input| input_ t1. input_ input asString. n1_ 0000. n2_ 0000. n3_ 0000. n4_ 0000. n5_ 0000. n6_ 0000. length_ self stringLength: (input). length > 23 ifTrue: [ n1_ self letters: (21) through: (24) of: (input). n1_ n1 asNumber. ]. length > 19 ifTrue: [ n2_ self letters: (17) through: (20) of: (input). n2_ n2 asNumber. ]. length > 15 ifTrue: [ n3_ self letters: (13) through: (16) of: (input). n3_ n3 asNumber. ]. length > 11 ifTrue: [ n4_ self letters: (9) through: (12) of: (input). n4_ n4 asNumber. ]. length > 7 ifTrue: [ n5_ self letters: (5) through: (8) of: (input). n5_ n5 asNumber. ]. length > 3 ifTrue: [ n6_ self letters: (1) through: (4) of: (input). n6_ n6 asNumber. ]. c1_ n1. c1 = 0000 ifTrue: [ x1_ 0. ]. c1 = 0001 ifTrue: [ x1_ 1. ]. c1 = 0010 ifTrue: [ x1_ 2. ]. c1 = 0011 ifTrue: [ x1_ 3. ]. c1 = 0100 ifTrue: [ x1_ 4. ]. c1 = 0101 ifTrue: [ x1_ 5. ]. c1 = 0110 ifTrue: [ x1_ 6. ]. c1 = 0111 ifTrue: [ x1_ 7. ]. c1 = 1000 ifTrue: [ x1_ 8. ]. c1 = 1001 ifTrue: [ x1_ 9. ]. c1 = 1010 ifTrue: [ x1_ 'A'. ]. c1 = 1011 ifTrue: [ x1_ 'B'. ]. c1 = 1100 ifTrue: [ x1_ 'C'. ]. c1 = 1101 ifTrue: [ x1_ 'D'. ]. c1 = 1110 ifTrue: [ x1_ 'E'. ]. c1 = 1111 ifTrue: [ x1_ 'F'. ]. n1_ x1. c1_ n2. c1 = 0000 ifTrue: [ x1_ 0. ]. c1 = 0001 ifTrue: [ x1_ 1. ]. c1 = 0010 ifTrue: [ x1_ 2. ]. c1 = 0011 ifTrue: [ x1_ 3. ]. c1 = 0100 ifTrue: [ x1_ 4. ]. c1 = 0101 ifTrue: [ x1_ 5. ]. c1 = 0110 ifTrue: [ x1_ 6. ]. c1 = 0111 ifTrue: [ x1_ 7. ]. c1 = 1000 ifTrue: [ x1_ 8. ]. c1 = 1001 ifTrue: [ x1_ 9. ]. c1 = 1010 ifTrue: [ x1_ 'A'. ]. c1 = 1011 ifTrue: [ x1_ 'B'. ]. c1 = 1100 ifTrue: [ x1_ 'C'. ]. c1 = 1101 ifTrue: [ x1_ 'D'. ]. c1 = 1110 ifTrue: [ x1_ 'E'. ]. c1 = 1111 ifTrue: [ x1_ 'F'. ]. n2_ x1. c1_ n3. c1 = 0000 ifTrue: [ x1_ 0. ]. c1 = 0001 ifTrue: [ x1_ 1. ]. c1 = 0010 ifTrue: [ x1_ 2. ]. c1 = 0011 ifTrue: [ x1_ 3. ]. c1 = 0100 ifTrue: [ x1_ 4. ]. c1 = 0101 ifTrue: [ x1_ 5. ]. c1 = 0110 ifTrue: [ x1_ 6. ]. c1 = 0111 ifTrue: [ x1_ 7. ]. c1 = 1000 ifTrue: [ x1_ 8. ]. c1 = 1001 ifTrue: [ x1_ 9. ]. c1 = 1010 ifTrue: [ x1_ 'A'. ]. c1 = 1011 ifTrue: [ x1_ 'B'. ]. c1 = 1100 ifTrue: [ x1_ 'C'. ]. c1 = 1101 ifTrue: [ x1_ 'D'. ]. c1 = 1110 ifTrue: [ x1_ 'E'. ]. c1 = 1111 ifTrue: [ x1_ 'F'. ]. n3_ x1. c1_ n4. c1 = 0000 ifTrue: [ x1_ 0. ]. c1 = 0001 ifTrue: [ x1_ 1. ]. c1 = 0010 ifTrue: [ x1_ 2. ]. c1 = 0011 ifTrue: [ x1_ 3. ]. c1 = 0100 ifTrue: [ x1_ 4. ]. c1 = 0101 ifTrue: [ x1_ 5. ]. c1 = 0110 ifTrue: [ x1_ 6. ]. c1 = 0111 ifTrue: [ x1_ 7. ]. c1 = 1000 ifTrue: [ x1_ 8. ]. c1 = 1001 ifTrue: [ x1_ 9. ]. c1 = 1010 ifTrue: [ x1_ 'A'. ]. c1 = 1011 ifTrue: [ x1_ 'B'. ]. c1 = 1100 ifTrue: [ x1_ 'C'. ]. c1 = 1101 ifTrue: [ x1_ 'D'. ]. c1 = 1110 ifTrue: [ x1_ 'E'. ]. c1 = 1111 ifTrue: [ x1_ 'F'. ]. n4_ x1. c1_ n5. c1 = 0000 ifTrue: [ x1_ 0. ]. c1 = 0001 ifTrue: [ x1_ 1. ]. c1 = 0010 ifTrue: [ x1_ 2. ]. c1 = 0011 ifTrue: [ x1_ 3. ]. c1 = 0100 ifTrue: [ x1_ 4. ]. c1 = 0101 ifTrue: [ x1_ 5. ]. c1 = 0110 ifTrue: [ x1_ 6. ]. c1 = 0111 ifTrue: [ x1_ 7. ]. c1 = 1000 ifTrue: [ x1_ 8. ]. c1 = 1001 ifTrue: [ x1_ 9. ]. c1 = 1010 ifTrue: [ x1_ 'A'. ]. c1 = 1011 ifTrue: [ x1_ 'B'. ]. c1 = 1100 ifTrue: [ x1_ 'C'. ]. c1 = 1101 ifTrue: [ x1_ 'D'. ]. c1 = 1110 ifTrue: [ x1_ 'E'. ]. c1 = 1111 ifTrue: [ x1_ 'F'. ]. n5_ x1. c1_ n6. c1 = 0000 ifTrue: [ x1_ 0. ]. c1 = 0001 ifTrue: [ x1_ 1. ]. c1 = 0010 ifTrue: [ x1_ 2. ]. c1 = 0011 ifTrue: [ x1_ 3. ]. c1 = 0100 ifTrue: [ x1_ 4. ]. c1 = 0101 ifTrue: [ x1_ 5. ]. c1 = 0110 ifTrue: [ x1_ 6. ]. c1 = 0111 ifTrue: [ x1_ 7. ]. c1 = 1000 ifTrue: [ x1_ 8. ]. c1 = 1001 ifTrue: [ x1_ 9. ]. c1 = 1010 ifTrue: [ x1_ 'A'. ]. c1 = 1011 ifTrue: [ x1_ 'B'. ]. c1 = 1100 ifTrue: [ x1_ 'C'. ]. c1 = 1101 ifTrue: [ x1_ 'D'. ]. c1 = 1110 ifTrue: [ x1_ 'E'. ]. c1 = 1111 ifTrue: [ x1_ 'F'. ]. n6_ x1. num_ '#'. num_ self concatenate: (num) with: (n1). num_ self concatenate: (num) with: (n2). num_ self concatenate: (num) with: (n3). num_ self concatenate: (num) with: (n4). num_ self concatenate: (num) with: (n5). num_ self concatenate: (num) with: (n6). ^ num ------------------- File $String$ exists? Type b Code |contents exists other writing temp var dest| dest_ t1. writing_ 'I exist'. contents_ self readFile: (dest). self writeText: (writing) toFile: (dest). other_ self readFile: (dest). temp_ self stringLength: (writing). var_ self stringLength: (other). temp_ var - temp. temp_ temp + 1. temp_ self letters: (temp) through: (var) of: (other). temp = writing ifTrue: [ exists_ true. self clearFile: (dest). self writeText: (contents) toFile: (dest). ] ifFalse: [ exists_ false. ]. ^ exists ------------ make file $String$ Type: - Code: | f contents exists other writing temp var dest| (self askForFileIO = true) ifFalse: [ ^ self ]. f_ t1. dest_ t1. writing_ 'I exist'. contents_ self readFile: (dest). self writeText: (writing) toFile: (dest). other_ self readFile: (dest). temp_ self stringLength: (writing). var_ self stringLength: (other). temp_ var - temp. temp_ temp + 1. temp_ self letters: (temp) through: (var) of: (other). temp = writing ifTrue: [ exists_ true. self clearFile: (dest). contents = '' ifFalse: [ self writeText: (contents) toFile: (dest). ]. ] ifFalse: [ exists_ false. ]. exists = false ifTrue: [ FileStream newFileNamed: f . ]. ------------------- make file $String$ in location $String$ Type - Code | f contents exists other writing temp var dest others| (self askForFileIO = true) ifFalse: [ ^ self ]. f_ t1. dest_ t1. writing_ 'I exist'. contents_ self readFile: (dest). self writeText: (writing) toFile: (dest). other_ self readFile: (dest). temp_ self stringLength: (writing). var_ self stringLength: (other). temp_ var - temp. temp_ temp + 1. temp_ self letters: (temp) through: (var) of: (other). temp = writing ifTrue: [ exists_ true. self clearFile: (dest). contents = '' ifFalse: [ self writeText: (contents) toFile: (dest). ]. ] ifFalse: [ exists_ false. ]. exists = false ifTrue: [ others_ self stringLength: (t2). others_ self letter: (others) of: (t2). others = '\' ifFalse: [ f_ self concatenate: ('/') with: (f). ]. f_ self concatenate: (t2) with: (f). FileStream newFileNamed: f . ]. ------------------- in mesh? Type b Code | t1 t2 | (t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame]. (t2 _ t1 workPane scratchServer) ifNil: [^ false]. t2 = false ifTrue: [ ^ false ] ifFalse: [ ^ true ]. ------------ joined mesh? type b code | t1 t2 total| (t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame]. (t2 _ t1 workPane scratchServer) ifNil: [^ false]. total_ 0. t2 = false ifTrue: [ t2_ false. ] ifFalse: [ t2_ true. total_ total + 1. ]. t1_ self isHostingMesh. t1 = false ifTrue: [ total_ total + 1. ]. total = 2 ifTrue: [ ^ true ] ifFalse: [ ^ false ]. ------------------ get $String$ from mesh type r code |inmesh t2 t3| (t3 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t3 _ (self ownerThatIsA: OffscreenWorldMorph) frame]. (t2 _ t3 workPane scratchServer) ifNil: [t2_ false.]. t2 = false ifTrue: [ inmesh_ false. ] ifFalse: [ inmesh_ true. ]. inmesh = true ifTrue: [ ^ self sensor: (t1). ] ifFalse: [ ^ 0. ]. ---------- Place of $String$ in $List$ Type r Code |t3 t4 t5 t6| t3_ 0. t4_ 0. t5_ self lineCountOfList: (t2). t6_ ''. t5 timesRepeat: [ t3_ t3 + 1. t4_ self getLine: (t3) ofList: (t2). t4 = t1 ifTrue: [ t6 = '' ifFalse: [ t6_ self concatenate: (t6) with: ('/'). ]. t6_ self concatenate: (t6) with: (t3). ]. ]. t6 = '' ifTrue: [ ^'0'. ] ifFalse:[ ^t6. ]. --------------- IP $String$ is hosting mesh? Type b Code | var1 sFrame server inmesh time timers | self leaveMesh. time_ self timer. var1_ self stringLength: (t1). var1 > 10 ifTrue: [ self joinMesh: (t1). (sFrame _ self ownerThatIsA: ScratchFrameMorph) ifNil: [sFrame _ (self ownerThatIsA: OffscreenWorldMorph) frame]. (server _ sFrame workPane scratchServer) ifNil: [inmesh_ false.]. inmesh_ server. var1_ false. inmesh = false ifFalse: [ var1_ true. ]. self leaveMesh. timers_ self timer. time_ timers - time. time < 0.5 ifTrue: [ ^ var1. ] ifFalse: [ ^ false. ]. ] ifFalse: [ ^ false. ]. ------------ in presentation mode? type b code ^ (self ownerThatIsA: OffscreenWorldMorph) notNil ---------- im clicked? type b code |clicked other stage| clicked_ 0. stage _ self ownerThatIsA: ScratchStageMorph. other_ self containsPoint: stage adjustedCursorPoint. other = true ifTrue: [ clicked_ clicked + 1. ]. other_ self mousePressed. other = true ifTrue: [ clicked_ clicked + 1. ]. clicked = 2 ifTrue: [ ^ true. ] ifFalse: [ ^ false. ].
All Panther blocks!
Last edited by johnnydean1 (2010-11-17 17:10:08)
Offline
^ Made those posts smaller to save space!
BTW
Am I top submitter?
Last edited by johnnydean1 (2010-11-17 17:13:12)
Offline
thanks What are your thoughts on the new block library stats post? It makes adding blocks a bit harder, but I think it will encourage people to share more blocks
Last edited by sparks (2010-11-17 17:18:10)
Offline
sparks wrote:
thanks What are your thoughts on the new block library stats post? It makes adding blocks a bit harder, but I think it will encourage people to share more blocks
I agree with you, can I suggest a external website for this maybe using images, altered by PHP, to show stats on this thread?
Offline
Am I top submitter?
Offline
currently not, Zorket for scratch, SSBBM for BYOB and me for Panther, though I have not changed the stats to add your new blocks yet. You can see all the stats here: http://scratch.mit.edu/forums/viewtopic … 17#p599817
Offline
I request an operator C block that fits into strings that says 'the script' and reports every block in it.
p.s. Be patient, the army is starting to build (at the workshop cool custom blocks in scratch)
Offline
zorket wrote:
I request an operator C block that fits into strings that says 'the script' and reports every block in it.
p.s. Be patient, the army is starting to build (at the workshop cool custom blocks in scratch)
I think this is already avaliable in BYOB, but sadly would take quite a modification of Panther or Scratch to work in them. I do know that nXIII is currently working on closures and first class blocks for Panther 1.1 though.
Offline
Hardmath123 wrote:
Code:
('Spawn Variable' #- #addGlobalVariable)Code:
no code neededMakes a new variable.
You didn't add this, or the other blocks I shared after that!
Offline
Hardmath123 wrote:
Code:
('%b' #r #booleanstring:) ('%s' #b #booleanstring:)Code:
booleanstring: t1 ^ t1my first script with variables.
Converts booleans to strings and vice-versa.
Or this.
Offline
Sorry I missed those Hardmath23, I will add the variable maker and the boolean to reporter block, but I'm afraid your string to boolean isn't going to work with that code. To make that block you'd need the code
booleanstring: t1
^ t1 = 'true'
as by definition, booleans can only report true or false.
Offline
Starting to pop the corn.
Blocks:
(center position)
('center position' #- #center)
__
center
self referencePosition: 0 @ 0
__
tested does: Puts the sprite at the center of the stage.
Offline
sparks wrote:
http://www.weebly.com/uploads/4/0/7/6/4 … 986755.jpg
Blocks
total blocks: [34]
http://i53.tinypic.com/29wri81.jpg Motion [0]
http://i51.tinypic.com/2yvj4w5.jpg Control [10]
http://i54.tinypic.com/1555368.jpg Looks [1]
http://i55.tinypic.com/rc3i41.jpg Sensing [4]
http://i54.tinypic.com/9j0lcg.jpg Sound [2]
http://i56.tinypic.com/261km15.jpg Operators [3]
http://i52.tinypic.com/2mi16w3.jpg Pen [0]
http://i51.tinypic.com/21j38ra.jpg Variables [4]
http://i51.tinypic.com/20ql8ck.jpg Files [9]
http://i52.tinypic.com/dza328.jpg Colors [1]
Contributors
total BYOB block contributors: [6]
Sparks [6] [3]
BillyEdward [1]
Billybob-Mario [1]
PlayWithFire [1]
nXIII [2]
bbeb [1]
johnnydean1 [15] [2]
Top Panther Block Contributor: johnnydean1 [17]
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
^home
Total Panther not BYOB
Offline
WOW! For a few days there was silence. Now, there's tons of new posts. Great new 'page' ideas, sparks!
Here's some graphics you can use if you want.
Yes! Top BYOB contributor!
Block Request
block name: [run [ but if <> pause] (see this)
requested for: any (preferred for BYOB or Scratch)
Offline
.
Scratch blocks added: [2]
[create new variable Shared by Hardmath123
(< >) Shared by Hardmath123
Panther blocks added: [17]
<[string] in dialog confirmed?> Shared by johnnydean1
[ask in dialog [string]] Shared by johnnydean1
<in presentation mode?> Shared by johnnydean1
<i'm clicked?> Shared by johnnydean1
(place of [string] in [list]) Shared by johnnydean1
(compile [list] with [string] as breaker) Shared by johnnydean1
[decompile [string] to [list] with [string] as breaker] Shared by johnnydean1
[clear line (10) in file [string]] Shared by johnnydean1
[replace line (10) of file [string] with [string]] Shared by johnnydean1
<file [string] exists?> Shared by johnnydean1
[make file [string]] Shared by johnnydean1
[make file [string] at location [string]] Shared by johnnydean1
<IP [string] is hosting mesh?> Shared by johnnydean1
<in mesh?> Shared by johnnydean1
<joined mesh?> Shared by johnnydean1
(get [string] from mesh) Shared by johnnydean1
(binary [string] to color) Shared by johnnydean1
BYOB blocks added: [0]
Other Updates:
♦ New top contributor for Panther blocks: johnnydean1[15] [2]
________________________________________________________________________________
^home
^updates archive
Last edited by sparks (2010-11-19 05:26:49)
Offline
Thanks very much, SSBBM, I can't believe how long the new pages and features took me, especially after jd1 sent me 17 amazing blocks at once but I think it was totally worth adding them, they look alright and I hope they will encourage people to keep sharing and helping
The three new changes are obviously the new "block library update" posts that let people see what's new, and that their block has been added, then the stats page lets you view user's contributions in detail, whilst the requests section ought to encourage people to create blocks that people will find useful, so I'm glad you like them
Thanks for the graphics, I'll be happy to use them on the homepost! Keep up your excellent contributions!
I'll add your block request now.
Offline
sparks wrote:
________________________________________________________________________________
Shared by johnnydean1
Box 1:[/b]ask in dialog $String$
[u]Box 2:
-
Box 3:
ScratchPrompterMorph lastAnswer: (StringDialog ask: t1).
^ self answerWhat this block does:
opens a dialog with a text box. Sets the answer variable to your answer. (yes, this block already exists in Panther )
No its a reporter as in ( and )
Offline
Previous block library updates:
[14 Dec 10] Blocks: [31] Other updates: [4]
[08 Dec 10] Blocks: [17] Other updates: [3]
[24 Nov 10] Blocks: [4] Other updates: [7]
[18 Nov 10] Blocks: [4] Other updates: [3]
[17 Nov 10] Blocks: [19] Other updates: [1]
_________________________________________________________________________________
^home
Last edited by sparks (2011-01-05 12:03:13)
Offline
sparks wrote:
That's how I read it, but what does it report?
I've spent about 4 hours on this topic today, I'm clocking out now, more work to come tomorrow
It reports the answer, so its the same as the Panther one, but it reports the answer and doesn't set the answer block to it!
Offline