I have no idea how to code in Squeak.
Offline
calebxy wrote:
I have no idea how to code in Squeak.
We're here to help
Offline
showMenu: t1 | t2 t3 t4 t5 t6 t7 | t2 _ self listNamed: t1 ifNone: [^ '']. t3 _ self lineCountOfList: t2. t4 _ 1. t5 _ CustomMenu new. t3 timesRepeat: [t6 _ self getLine: t4 ofList: t2. t5 add: t6 asString action: t6. t4 _ t4 + 1]. t5 localize. t7 _ t5 startUp. ^ t7
This takes the name of a list as an argument and displays a menu containing the items in the list. However, the menu never displays and it just reports nil. Can anybody fix it?
Last edited by TheSuccessor (2010-09-01 11:40:59)
Offline
Billybob-Mario wrote:
TheSuccessor wrote:
Code:
spriteExists: t1 World submorphsDo: [:t2 | t2 isKindOf: ScratchSpriteMorph ifTrue: [t2 objName = t1 ifTrue: [^ true]]]. ^ falseI think this would work but as I haven't tried it I don't know.
Thank you. I'll test the code.
It didn't work. I changed it to
spriteExists: t1 | t87 | t87 _ self ownerThatIsA: ScratchFrameMorph. t87 submorphsDo: [:t2 | (t2 isKindOf: ScratchSpriteMorph) ifTrue: [(t2 objName = t1) ifTrue: [^ true]]]. ^ false
and it still didn't work. It always says false. I think that this is closer. Can you help?
Last edited by Billybob-Mario (2010-09-01 14:47:23)
Offline
TheSuccessor wrote:
Code:
spriteExists: t1 World submorphsDo: [:t2 | t2 isKindOf: ScratchSpriteMorph ifTrue: [t2 objName = t1 ifTrue: [^ true]]]. ^ falseI think this would work but as I haven't tried it I don't know.
I would try
spriteExists: n ((ScriptableScratchMorph, ScriptableScratchMorph allSubClasses) collect: [:c | c allInstances]) do: [:m | m objName = n ifTrue: [^ true]]. ^ false
Last edited by nXIII (2010-09-01 16:26:03)
Offline
nXIII wrote:
TheSuccessor wrote:
Code:
spriteExists: t1 World submorphsDo: [:t2 | t2 isKindOf: ScratchSpriteMorph ifTrue: [t2 objName = t1 ifTrue: [^ true]]]. ^ falseI think this would work but as I haven't tried it I don't know.
I would try
Code:
spriteExists: n ((ScriptableScratchMorph, ScriptableScratchMorph allSubclasses) collect: [:c | c allInstances]) do: [:m | m objName = n ifTrue: [^ true]]. ^ false
It says Error
Last edited by Billybob-Mario (2010-09-01 17:19:21)
Offline
TheSuccessor wrote:
Code:
spriteExists: t1 World submorphsDo: [:t2 | t2 isKindOf: ScratchSpriteMorph ifTrue: [t2 objName = t1 ifTrue: [^ true]]]. ^ falseI think this would work but as I haven't tried it I don't know.
Whats the block spec?
<when green flag clicked>
<go to[ my profile
<forever>
<play sound[ come to my profile!
<change{ users who went to my profile }by(1
<end>
Offline
kinker wrote:
TheSuccessor wrote:
Code:
spriteExists: t1 World submorphsDo: [:t2 | t2 isKindOf: ScratchSpriteMorph ifTrue: [t2 objName = t1 ifTrue: [^ true]]]. ^ falseI think this would work but as I haven't tried it I don't know.
Whats the block spec?
<when green flag clicked>
<go to[ my profile
<forever>
<play sound[ come to my profile!
<change{ users who went to my profile }by(1
<end>
That really doesn't matter; I used
('sprite %s exists?' #b #spriteExists: 'Sprite1')
Offline
Billybob-Mario wrote:
nXIII wrote:
TheSuccessor wrote:
Code:
spriteExists: t1 World submorphsDo: [:t2 | t2 isKindOf: ScratchSpriteMorph ifTrue: [t2 objName = t1 ifTrue: [^ true]]]. ^ falseI think this would work but as I haven't tried it I don't know.
I would try
Code:
spriteExists: n ((ScriptableScratchMorph, ScriptableScratchMorph allSubclasses) collect: [:c | c allInstances]) do: [:m | m objName = n ifTrue: [^ true]]. ^ falseIt says Error
I got it to work with
spriteExists: n ScratchSpriteMorph allInstancesDo: [:m | m objName = n ifTrue: [^ true]]. ^ false
Thank you for the help. How would I make a block that adds a costume to a sprite from a costume block that reports a costume?
Last edited by Billybob-Mario (2010-09-01 20:34:47)
Offline
Billybob-Mario wrote:
Billybob-Mario wrote:
nXIII wrote:
I would tryCode:
spriteExists: n ((ScriptableScratchMorph, ScriptableScratchMorph allSubclasses) collect: [:c | c allInstances]) do: [:m | m objName = n ifTrue: [^ true]]. ^ falseIt says Error
I got it to work with
Code:
spriteExists: n ScratchSpriteMorph allInstancesDo: [:m | m objName = n ifTrue: [^ true]]. ^ falseThank you for the help. How would I make a block that adds a costume to a sprite from a costume block that reports a costume?
You deleted the thing I purposely added. You got it wrong:
spriteExists: n (({ScriptableScratchMorph}, ScriptableScratchMorph allSubclasses) collect: [:c | c allInstances]) do: [:m | m objName = n ifTrue: [^ true]]. ^ false
Offline
nXIII wrote:
Billybob-Mario wrote:
Billybob-Mario wrote:
It says ErrorI got it to work with
Code:
spriteExists: n ScratchSpriteMorph allInstancesDo: [:m | m objName = n ifTrue: [^ true]]. ^ falseThank you for the help. How would I make a block that adds a costume to a sprite from a costume block that reports a costume?
You deleted the thing I purposely added. You got it wrong:
Code:
spriteExists: n (({ScriptableScratchMorph}, ScriptableScratchMorph allSubclasses) collect: [:c | c allInstances]) do: [:m | m objName = n ifTrue: [^ true]]. ^ false
The code before worked perfect, but your code is in the way, tricking scratchers to use the wrong code.
Offline
Now I'm trying to make a block that takes a reporter block for an image and makes that into a costume and adds it to the sprite. Can anyone help?
Offline
nXIII wrote:
Just modifying the preview, it doesn't care what the return value is.
Warning: costumes are not Forms.
That's why I got so many errors with mine...
Offline
Billybob-Mario wrote:
Now I'm trying to make a block that takes a reporter block for an image and makes that into a costume and adds it to the sprite. Can anyone help?
that's actually a really good idea - i looked over that post not thinking it important, but now that i get what you're trying to do it's very interesting. tat could be something to work on for Bingo 1.2.1...
Offline
LS97 wrote:
Billybob-Mario wrote:
Now I'm trying to make a block that takes a reporter block for an image and makes that into a costume and adds it to the sprite. Can anyone help?
that's actually a really good idea - i looked over that post not thinking it important, but now that i get what you're trying to do it's very interesting. tat could be something to work on for Bingo 1.2.1...
I already have the costume reporters, now I'm trying to make an [add [ '' ] to costumes] block. [ '' ] is the costume slot representation.
Offline
sensor yellowButtonPressed or blueButtonPressed doesn't work for me
Offline
nXIII wrote:
Why not just make reporters which report costumes?
I already have. BYOB made that easy. Now I need to have it add these to costumes. I'll post a secret 1.1 beta to help explain. http://dl.dropbox.com/u/6509165/Slash%2 … Beta.image Look at blocks such as 'self'.
Last edited by Billybob-Mario (2010-09-03 19:24:59)
Offline
Billybob-Mario wrote:
nXIII wrote:
Why not just make reporters which report costumes?
I already have. BYOB made that easy. Now I need to have it add these to costumes. I'll post a secret 1.1 beta to help explain. http://dl.dropbox.com/u/6509165/Slash%2 … Beta.image Look at blocks such as 'self'.
No, I'm saying, you don't NEED a new block shape, just use old-fashioned reporters.
Offline
nXIII wrote:
Billybob-Mario wrote:
nXIII wrote:
Why not just make reporters which report costumes?
I already have. BYOB made that easy. Now I need to have it add these to costumes. I'll post a secret 1.1 beta to help explain. http://dl.dropbox.com/u/6509165/Slash%2 … Beta.image Look at blocks such as 'self'.
No, I'm saying, you don't NEED a new block shape, just use old-fashioned reporters.
I want to make it easier to not have errors. What I need now is a block for:
[add (costume) to costumes]
where (costume) is the costume slot.
Offline
Billybob-Mario wrote:
nXIII wrote:
Why not just make reporters which report costumes?
I already have. BYOB made that easy. Now I need to have it add these to costumes. I'll post a secret 1.1 beta to help explain. http://dl.dropbox.com/u/6509165/Slash%2 … Beta.image Look at blocks such as 'self'.
i had a look at Slash 1.1 Beta and it's got loads of blocks copied from Bingo. too bad mostof those you added dont work
but please code the cursor one yourself.
Offline
Billybob-Mario wrote:
nXIII wrote:
Why not just make reporters which report costumes?
I already have. BYOB made that easy. Now I need to have it add these to costumes. I'll post a secret 1.1 beta to help explain. http://dl.dropbox.com/u/6509165/Slash%2 … Beta.image Look at blocks such as 'self'.
Very secret now, isn't it...
Offline
TheSuccessor wrote:
Billybob-Mario wrote:
nXIII wrote:
Why not just make reporters which report costumes?
I already have. BYOB made that easy. Now I need to have it add these to costumes. I'll post a secret 1.1 beta to help explain. http://dl.dropbox.com/u/6509165/Slash%2 … Beta.image Look at blocks such as 'self'.
Very secret now, isn't it...
I was just thinking that...
Offline