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

#2976 2012-06-24 17:04:55

tpaley
Scratcher
Registered: 2011-05-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

chanmanpartyman wrote:

fetchydog567 wrote:

U know what I like about BYOB! Look!
http://i45.tinypic.com/2db5ugm.gif
Opps, heres the pic.
http://i49.tinypic.com/2wg7ihf.gif

That won't work if the input is negative. Try 0-x.

just do:  step * -1

Last edited by tpaley (2012-06-24 17:07:52)


http://i49.tinypic.com/2z82h3d.gif

Offline

 

#2977 2012-06-26 08:28:38

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

Re: ITopic: Welcome to your local block library!

tpaley wrote:

Here's a cond block made in BYOB (remember to change the booleans the same amount as the actions!):

Example of usage:

http://i46.tinypic.com/11jtekw.gif


Block code:

http://i47.tinypic.com/2hs87j5.gif

So yeah. Those who do scheme or lisp or stuff like that will know what cond is. Bacically, it's like a whole lot of if/else statements but it's a lot cleaner to look at.

It's like a switch/case block.

Offline

 

#2978 2012-06-28 02:20:31

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: ITopic: Welcome to your local block library!

tpaley wrote:

Here's the set draggable block. (Another version)

Example:

http://i48.tinypic.com/2uic6m1.gif

if version:

http://i45.tinypic.com/2u3vdvs.gif

cond version (using the cond block I posted 2 posts ago):

http://i46.tinypic.com/5xpgy1.gif

It would have been much easier if you had done

set (the (attribute of [draggable? v]) block) to <(t/f) = [true]> //hehe scratchblocks made it a variable

Offline

 

#2979 2012-06-29 17:39:09

PopTarties
Scratcher
Registered: 2012-05-29
Posts: 19

Re: ITopic: Welcome to your local block library!

Make the source code for byob blocks and panther blocks so you can put thim in scratch!
block ideas:

render [cube v] at x:[10] y:[10] with size:[20]


http://scratch.mit.edu/static/icons/buddy/1391630_med.png?t=2012-07-23+14%3A18%3A37

Offline

 

#2980 2012-07-02 15:50:49

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Would it work to use Panther, and mysql to make a user register and login. I want to eventually make a chatbot, that can grow in intelligence. Along with this, I want users to be able to login so the bot will recognize users, and remember things like their name, and other information given by the user. Is there a custom block that would make this possible, and how would it work?


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#2981 2012-07-02 17:05:12

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

you don't need any custom blocks, they're already in panther. the (contents of url []) block uses httpGet: in which you could also use to write using php scripts. so you could say (contents of url [http://www.chatbot.com/write_information.php?key=yourKey&value=yourValue]). Then the php script could receive the two arguments, key and value, and write that into the database. Then you could also write an access script in php which would be like (contents of url [http://www.chatbot.com/get_information.php?key=name]). This could return the value of the key if the key exists, or if it doesn't exist some default value.
Do you know what i'm saying?
you could also have (contents of url [http://www.chatbox.com/newUser=userName&password=password]).
of course the strings would be replaced.

Offline

 

#2982 2012-07-02 20:08:58

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: ITopic: Welcome to your local block library!

dreamod wrote:

you don't need any custom blocks, they're already in panther. the (contents of url []) block uses httpGet: in which you could also use to write using php scripts. so you could say (contents of url [http://www.chatbot.com/write_information.php?key=yourKey&value=yourValue]). Then the php script could receive the two arguments, key and value, and write that into the database. Then you could also write an access script in php which would be like (contents of url [http://www.chatbot.com/get_information.php?key=name]). This could return the value of the key if the key exists, or if it doesn't exist some default value.
Do you know what i'm saying?
you could also have (contents of url [http://www.chatbox.com/newUser=userName&password=password]).
of course the strings would be replaced.

Huh? Wouldn't it just be easier to make a custom block?  tongue


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#2983 2012-07-03 06:37:36

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

One block isn't going to do that, you're going to have to do some scripting. Most login forms and post spaces in forums use POST and Panther only natively handles GET. If you want to make a chatbot you'll have to work out how to get Panther to POST data. You'll probably need a good understanding of HTML too.

Just a note, if you make a chatbot that goes round the Scratch forums, its likely to be spotted by myself of one of the Scratch team and marked as a potential spammer, since that's what most chatbots that actually go onto forums do  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2984 2012-07-03 10:09:43

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

One block isn't going to do that, you're going to have to do some scripting. Most login forms and post spaces in forums use POST and Panther only natively handles GET. If you want to make a chatbot you'll have to work out how to get Panther to POST data. You'll probably need a good understanding of HTML too.

Just a note, if you make a chatbot that goes round the Scratch forums, its likely to be spotted by myself of one of the Scratch team and marked as a potential spammer, since that's what most chatbots that actually go onto forums do  tongue

I think I made some POSTing Squeak code for the Block Library website a while ago.  Perhaps I should just rearrange that a bit and post it (no pun intended) as a Panther block?

Last edited by Greenatic (2012-07-03 10:10:38)

Offline

 

#2985 2012-07-03 10:20:18

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

sparks wrote:

One block isn't going to do that, you're going to have to do some scripting. Most login forms and post spaces in forums use POST and Panther only natively handles GET. If you want to make a chatbot you'll have to work out how to get Panther to POST data. You'll probably need a good understanding of HTML too.

Just a note, if you make a chatbot that goes round the Scratch forums, its likely to be spotted by myself of one of the Scratch team and marked as a potential spammer, since that's what most chatbots that actually go onto forums do  tongue

I think I made some POSTing Squeak code for the Block Library website a while ago.  Perhaps I should just rearrange that a bit and post it (no pun intended) as a Panther block?

I could give him the code.

Offline

 

#2986 2012-07-03 11:35:25

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Wait. I'm not making a chat bot for the forums. I want it to link with mysql so that it can learn from other people. Also, then people could login to their account, and the bot will remember things about them.


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#2987 2012-07-03 11:57:00

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

elfin8er wrote:

Wait. I'm not making a chat bot for the forums. I want it to link with mysql so that it can learn from other people. Also, then people could login to their account, and the bot will remember things about them.

I'm having a bit of trouble with the code for some reason, I'll keep working on it and try to find the problem.

Offline

 

#2988 2012-07-03 15:08:32

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

hey do you think the code below could be used to POST projects to a mod website (aka mine) I know how to get the website to receive but could this send the contents of the project:

Code:

upload: url user: user password: password
    | t1 t2 t3 t4 t6 args |
    self stopAll.
    self world ifNotNil: [self world activeHand newKeyboardFocus: nil].
    self canonicalizeSoundsBits: nil saveOriginal: false.
    self canonicalizeImagesQuality: nil saveOriginal: false.
    t1 _ scriptsPane target.
    t2 _ scriptsPane tabPane currentTab.
    t3 _ viewerPane currentCategory.
    scriptsPane target: nil.
    workPane updateSpritesList.
    t4 _ workPane position.
    workPane delete; position: 0 @ 0.
    self updatePenPositions.
    ScriptableScratchMorph buildBlockSpecDictionary.
    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: 
                    [t7 blocksBin
                        allMorphsDo: [:t8 | (t8 isKindOf: BlockMorph)
                                ifTrue: [t8 stop]].
                    t7 convertStacksToTuples]].

    t6 _ WriteStream on: (ByteArray new: 100000000).
    t6 nextPutAll: 'ScratchV02' asByteArray.
    self storeProjectInfoOn: t6.
    ObjStream new storeObj: workPane on: t6.

    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: [t7 convertTuplesToStacks]].
    self addMorph: (workPane position: t4).
    t1 ifNil: [t1 _ workPane].
    t1 viewBlocksAndScripts.
    scriptsPane tabPane currentTab: t2.
    viewerPane currentCategory: t3.
    self updatePenPositions.

    args _ Dictionary new.
    args at: 'project' put: {projectName}.
    args at: 'data' put: (Array with: t6 contents asString).
    args at: 'user' put: {user}.
    args at: 'password' put: {password}.
    HTTPSocket httpPostDocument: url args: args

If so, anyone know how to script the dialog box, if I can't from the scratch one?

Thanks  smile

Last edited by P110 (2012-07-03 15:09:56)


Me live on 2.0 now  sad

Offline

 

#2989 2012-07-04 08:28:13

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: ITopic: Welcome to your local block library!

dreamod wrote:

elfin8er wrote:

Wait. I'm not making a chat bot for the forums. I want it to link with mysql so that it can learn from other people. Also, then people could login to their account, and the bot will remember things about them.

I'm having a bit of trouble with the code for some reason, I'll keep working on it and try to find the problem.

Awesome. Thanks!  smile


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#2990 2012-07-04 09:34:52

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

P110 wrote:

hey do you think the code below could be used to POST projects to a mod website (aka mine) I know how to get the website to receive but could this send the contents of the project:

Code:

upload: url user: user password: password
    | t1 t2 t3 t4 t6 args |
    self stopAll.
    self world ifNotNil: [self world activeHand newKeyboardFocus: nil].
    self canonicalizeSoundsBits: nil saveOriginal: false.
    self canonicalizeImagesQuality: nil saveOriginal: false.
    t1 _ scriptsPane target.
    t2 _ scriptsPane tabPane currentTab.
    t3 _ viewerPane currentCategory.
    scriptsPane target: nil.
    workPane updateSpritesList.
    t4 _ workPane position.
    workPane delete; position: 0 @ 0.
    self updatePenPositions.
    ScriptableScratchMorph buildBlockSpecDictionary.
    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: 
                    [t7 blocksBin
                        allMorphsDo: [:t8 | (t8 isKindOf: BlockMorph)
                                ifTrue: [t8 stop]].
                    t7 convertStacksToTuples]].

    t6 _ WriteStream on: (ByteArray new: 100000000).
    t6 nextPutAll: 'ScratchV02' asByteArray.
    self storeProjectInfoOn: t6.
    ObjStream new storeObj: workPane on: t6.

    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: [t7 convertTuplesToStacks]].
    self addMorph: (workPane position: t4).
    t1 ifNil: [t1 _ workPane].
    t1 viewBlocksAndScripts.
    scriptsPane tabPane currentTab: t2.
    viewerPane currentCategory: t3.
    self updatePenPositions.

    args _ Dictionary new.
    args at: 'project' put: {projectName}.
    args at: 'data' put: (Array with: t6 contents asString).
    args at: 'user' put: {user}.
    args at: 'password' put: {password}.
    HTTPSocket httpPostDocument: url args: args

If so, anyone know how to script the dialog box, if I can't from the scratch one?

Thanks  smile

wow, that's nice. The dialog would be a piece of cake. I'll let you use the one for my block importer slightly modified.

Code:

'From MIT Squeak 0.9.4 (June 1, 2003) [No updates present.] on 4 July 2012 at 9:30:09 am'!
DialogBoxMorph subclass: #UploadDialogBoxMorph
    instanceVariableNames: 'userNameMorph target blockFile commentMorph passwordMorph '
    classVariableNames: 'URL '
    poolDictionaries: ''
    category: 'Scratch-UI-Dialogs'!


!UploadDialogBoxMorph methodsFor: 'accessing' stamp: 'dreamod 7/4/2012 09:29'!
getUserResponse

    "Wait for the user to type in and accept a string, then report that string. Answer the empty string if the user cancels the operation."

    "Details: This is invoked synchronously from the caller. In order to keep processing inputs and updating the screen while waiting for the user to respond, this method has its own version of the World's event loop."

    | w |
    self openInWorld.
    self centerOnScreen.
    w _ self world.
    w activeHand newKeyboardFocus: userNameMorph.
    done _ false.
    [done] whileFalse: [w doOneCycle].  "wait for user to press a button"
    response = #cancelled ifTrue: [^ self].
    target upload: URL user: userNameMorph contents asString password: passwordMorph contents asString.
    self delete.
    w doOneCycle.  "erase myself from the screen"

! !

!UploadDialogBoxMorph methodsFor: 'accessing' stamp: 'dreamod 7/4/2012 09:29'!
target
^ target
! !

!UploadDialogBoxMorph methodsFor: 'accessing' stamp: 'dreamod 7/4/2012 09:29'!
target: t1
^ target! !


!UploadDialogBoxMorph methodsFor: 'initialization' stamp: 'dreamod 7/4/2012 09:25'!
initialize
    super initialize.
    mainColumn addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent).
    mainColumn addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent);
     addMorph: (passwordMorph _ StringFieldMorph new client: self;
                 borderWidth: 2;
                 color: (Color
                        r: 211 / 255
                        g: 214 / 255
                        b: 216 / 255));
     addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent).
    passwordMorph font: (ScratchFrameMorph getFont: #StringDialogTypeIn);
     width: 250.
    passwordMorph passwordMode: true.
    mainColumn addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent);
     addMorph: (userNameMorph _ StringFieldMorph new client: self;
                 borderWidth: 2;
                 color: (Color
                        r: 211 / 255
                        g: 214 / 255
                        b: 216 / 255));
     addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent).
    userNameMorph font: (ScratchFrameMorph getFont: #StringDialogTypeIn);
     width: 250.
    tabFields add: userNameMorph.
    tabFields add: passwordMorph.
    self message: 'Enter username and password'.
    self title: 'Upload Project to: ' , URL asString.
    self withButtonsForYes: false no: false okay: true cancel: true! !
!UTF8 methodsFor: 'converting'!
asString
    | t2 |
    t2 _ ''.
    self do: [:t1 | t2 _ t2 , t1 asString].
    ^ t2! !

Call it from ScratchFrameMorph like this:

Code:

UploadDialogBoxMorph new target: self; getUserResponse

The dialog will then call the method you made to the instance of ScratchFrameMorph defined once you're done filling in the form.

Offline

 

#2991 2012-07-04 10:00:56

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

elfin8er wrote:

dreamod wrote:

elfin8er wrote:

Wait. I'm not making a chat bot for the forums. I want it to link with mysql so that it can learn from other people. Also, then people could login to their account, and the bot will remember things about them.

I'm having a bit of trouble with the code for some reason, I'll keep working on it and try to find the problem.

Awesome. Thanks!  smile

Here's the working block.
spec

Code:

post data $String$ to url $String$

code

Code:

| t3 |
    t5 _ Compiler
                evaluate: '^ #(' , t1 , ')'
                for: self
                logged: false.
    t3 _ #() asOrderedCollection.
    t5 do: [:t4 | t3 add: (WeakKeyAssociation new value: {t4 last};
             key: t4 first)].
    ^ (HTTPSocket httpPostDocument: t2 args: t3) content

This code is VERY powerful because it uses the Squeak Compiler to evaluate a string as an array. But if you use it properly no damage should come.
This is how to use it:

post data [(key=value) (name='your Name') (password=secret)] to url [http:/www.yourdomain.com
(or any other url)
if you're going to have spaces you must type string quotes 'string with spaces'. otherwise you can just type stringWithoutSpaces. This will convert to a #symbol which is a subclass of String.

Offline

 

#2992 2012-07-04 10:05:40

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

I made a mistake: add t5 in to the first line before the last |

Offline

 

#2993 2012-07-04 10:28:15

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

dreamod wrote:

I made a mistake: add t5 in to the first line before the last |

So now it's this.   smile

Code:

| t3 t5 |
    t5 _ Compiler
                evaluate: '^ #(' , t1 , ')'
                for: self
                logged: false.
    t3 _ #() asOrderedCollection.
    t5 do: [:t4 | t3 add: (WeakKeyAssociation new value: {t4 last};
             key: t4 first)].
    ^ (HTTPSocket httpPostDocument: t2 args: t3) content

It seems like overkill to use the Compiler, but it should work.   tongue

Offline

 

#2994 2012-07-04 10:36:11

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

dreamod wrote:

I made a mistake: add t5 in to the first line before the last |

So now it's this.   smile

Code:

| t3 t5 |
    t5 _ Compiler
                evaluate: '^ #(' , t1 , ')'
                for: self
                logged: false.
    t3 _ #() asOrderedCollection.
    t5 do: [:t4 | t3 add: (WeakKeyAssociation new value: {t4 last};
             key: t4 first)].
    ^ (HTTPSocket httpPostDocument: t2 args: t3) content

It seems like overkill to use the Compiler, but it should work.   tongue

I didn't want to write a completely new array parser.
It's pretty safe though. unless you type a "dangerous" code within in curly brackets {}, because than that's evaluated and the value is put in the array. Then again, that can also be done through a custom block, so there's really no difference.

Offline

 

#2995 2012-07-04 12:52:48

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: ITopic: Welcome to your local block library!

Did anybody do my panther block requests?  (a while back)

Last edited by LiquidMetal (2012-07-04 12:53:03)

Offline

 

#2996 2012-07-04 19:56:40

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

LiquidMetal wrote:

Did anybody do my panther block requests?  (a while back)

Repeat your request and I will make it.

Offline

 

#2997 2012-07-05 14:34:53

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

dreamod wrote:

P110 wrote:

hey do you think the code below could be used to POST projects to a mod website (aka mine) I know how to get the website to receive but could this send the contents of the project:

Code:

upload: url user: user password: password
    | t1 t2 t3 t4 t6 args |
    self stopAll.
    self world ifNotNil: [self world activeHand newKeyboardFocus: nil].
    self canonicalizeSoundsBits: nil saveOriginal: false.
    self canonicalizeImagesQuality: nil saveOriginal: false.
    t1 _ scriptsPane target.
    t2 _ scriptsPane tabPane currentTab.
    t3 _ viewerPane currentCategory.
    scriptsPane target: nil.
    workPane updateSpritesList.
    t4 _ workPane position.
    workPane delete; position: 0 @ 0.
    self updatePenPositions.
    ScriptableScratchMorph buildBlockSpecDictionary.
    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: 
                    [t7 blocksBin
                        allMorphsDo: [:t8 | (t8 isKindOf: BlockMorph)
                                ifTrue: [t8 stop]].
                    t7 convertStacksToTuples]].

    t6 _ WriteStream on: (ByteArray new: 100000000).
    t6 nextPutAll: 'ScratchV02' asByteArray.
    self storeProjectInfoOn: t6.
    ObjStream new storeObj: workPane on: t6.

    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: [t7 convertTuplesToStacks]].
    self addMorph: (workPane position: t4).
    t1 ifNil: [t1 _ workPane].
    t1 viewBlocksAndScripts.
    scriptsPane tabPane currentTab: t2.
    viewerPane currentCategory: t3.
    self updatePenPositions.

    args _ Dictionary new.
    args at: 'project' put: {projectName}.
    args at: 'data' put: (Array with: t6 contents asString).
    args at: 'user' put: {user}.
    args at: 'password' put: {password}.
    HTTPSocket httpPostDocument: url args: args

If so, anyone know how to script the dialog box, if I can't from the scratch one?

Thanks  smile

wow, that's nice. The dialog would be a piece of cake. I'll let you use the one for my block importer slightly modified.

Code:

'From MIT Squeak 0.9.4 (June 1, 2003) [No updates present.] on 4 July 2012 at 9:30:09 am'!
DialogBoxMorph subclass: #UploadDialogBoxMorph
    instanceVariableNames: 'userNameMorph target blockFile commentMorph passwordMorph '
    classVariableNames: 'URL '
    poolDictionaries: ''
    category: 'Scratch-UI-Dialogs'!


!UploadDialogBoxMorph methodsFor: 'accessing' stamp: 'dreamod 7/4/2012 09:29'!
getUserResponse

    "Wait for the user to type in and accept a string, then report that string. Answer the empty string if the user cancels the operation."

    "Details: This is invoked synchronously from the caller. In order to keep processing inputs and updating the screen while waiting for the user to respond, this method has its own version of the World's event loop."

    | w |
    self openInWorld.
    self centerOnScreen.
    w _ self world.
    w activeHand newKeyboardFocus: userNameMorph.
    done _ false.
    [done] whileFalse: [w doOneCycle].  "wait for user to press a button"
    response = #cancelled ifTrue: [^ self].
    target upload: URL user: userNameMorph contents asString password: passwordMorph contents asString.
    self delete.
    w doOneCycle.  "erase myself from the screen"

! !

!UploadDialogBoxMorph methodsFor: 'accessing' stamp: 'dreamod 7/4/2012 09:29'!
target
^ target
! !

!UploadDialogBoxMorph methodsFor: 'accessing' stamp: 'dreamod 7/4/2012 09:29'!
target: t1
^ target! !


!UploadDialogBoxMorph methodsFor: 'initialization' stamp: 'dreamod 7/4/2012 09:25'!
initialize
    super initialize.
    mainColumn addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent).
    mainColumn addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent);
     addMorph: (passwordMorph _ StringFieldMorph new client: self;
                 borderWidth: 2;
                 color: (Color
                        r: 211 / 255
                        g: 214 / 255
                        b: 216 / 255));
     addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent).
    passwordMorph font: (ScratchFrameMorph getFont: #StringDialogTypeIn);
     width: 250.
    passwordMorph passwordMode: true.
    mainColumn addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent);
     addMorph: (userNameMorph _ StringFieldMorph new client: self;
                 borderWidth: 2;
                 color: (Color
                        r: 211 / 255
                        g: 214 / 255
                        b: 216 / 255));
     addMorph: (Morph new extent: 5 @ 6;
         color: Color transparent).
    userNameMorph font: (ScratchFrameMorph getFont: #StringDialogTypeIn);
     width: 250.
    tabFields add: userNameMorph.
    tabFields add: passwordMorph.
    self message: 'Enter username and password'.
    self title: 'Upload Project to: ' , URL asString.
    self withButtonsForYes: false no: false okay: true cancel: true! !
!UTF8 methodsFor: 'converting'!
asString
    | t2 |
    t2 _ ''.
    self do: [:t1 | t2 _ t2 , t1 asString].
    ^ t2! !

Call it from ScratchFrameMorph like this:

Code:

UploadDialogBoxMorph new target: self; getUserResponse

The dialog will then call the method you made to the instance of ScratchFrameMorph defined once you're done filling in the form.

Wait, is that the actual dialog box code? Thanks!  big_smile

So, if I add that all to scratchFrameMorph it should all work?

Last edited by P110 (2012-07-05 14:37:22)


Me live on 2.0 now  sad

Offline

 

#2998 2012-07-05 17:27:16

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

just file it in.
Then use the last code to upload.
add your first code to ScratchFrameMorph.

Offline

 

#2999 2012-07-06 03:28:43

Randomno
Scratcher
Registered: 2012-06-04
Posts: 39

Re: ITopic: Welcome to your local block library!

Hi. I'm attempting to make a Panther block named 'number of letter $String$ in the alphabet'. The code is:

Code:

t1 = a ifTrue: [^ '1].
t1 = b ifTrue: [^ '2'].
t1 = c ifTrue: [^ '3'].
t1 = d ifTrue: [^ '4'].
t1 = e ifTrue: [^ '5'].
t1 = f ifTrue: [^ '6'].
t1 = g ifTrue: [^ '7'].
t1 = h ifTrue: [^ '8'].
t1 = i ifTrue: [^ '9'].
t1 = j ifTrue: [^ '10'].
t1 = k ifTrue: [^ '11'].
t1 = l ifTrue: [^ 12l'].
t1 = m ifTrue: [^ '13'].
t1 = n ifTrue: [^ '14'].
t1 = o ifTrue: [^ '15'].
t1 = p ifTrue: [^ '16'].
t1 = q ifTrue: [^ '17'].
t1 = r ifTrue: [^ '18'].
t1 = s ifTrue: [^ '19'].
t1 = t ifTrue: [^ '20'].
t1 = u ifTrue: [^ '21'].
t1 = v ifTrue: [^ '22'].
t1 = w ifTrue: [^ '23'].
t1 = x ifTrue: [^ '24'].
t1 = y ifTrue: [^ '25'].
t1 = z ifTrue: [^ '26'].
^ self error

Any idea how to fix it?

UPDATE: Yes, I'm a Scratcher now!

Last edited by Randomno (2012-07-06 03:30:47)


http://img209.imageshack.us/img209/5524/randomno.png
I do stuff with stuff. I also stuff stuff.

Offline

 

#3000 2012-07-06 09:00:09

danwoodski
Scratcher
Registered: 2009-12-23
Posts: 100+

Re: ITopic: Welcome to your local block library!

Randomno wrote:

Hi. I'm attempting to make a Panther block named 'number of letter $String$ in the alphabet'. The code is:

Code:

t1 = a ifTrue: [^ '1].
t1 = b ifTrue: [^ '2'].
t1 = c ifTrue: [^ '3'].
t1 = d ifTrue: [^ '4'].
t1 = e ifTrue: [^ '5'].
t1 = f ifTrue: [^ '6'].
t1 = g ifTrue: [^ '7'].
t1 = h ifTrue: [^ '8'].
t1 = i ifTrue: [^ '9'].
t1 = j ifTrue: [^ '10'].
t1 = k ifTrue: [^ '11'].
t1 = l ifTrue: [^ 12l'].
t1 = m ifTrue: [^ '13'].
t1 = n ifTrue: [^ '14'].
t1 = o ifTrue: [^ '15'].
t1 = p ifTrue: [^ '16'].
t1 = q ifTrue: [^ '17'].
t1 = r ifTrue: [^ '18'].
t1 = s ifTrue: [^ '19'].
t1 = t ifTrue: [^ '20'].
t1 = u ifTrue: [^ '21'].
t1 = v ifTrue: [^ '22'].
t1 = w ifTrue: [^ '23'].
t1 = x ifTrue: [^ '24'].
t1 = y ifTrue: [^ '25'].
t1 = z ifTrue: [^ '26'].
^ self error

Any idea how to fix it?

Try fixing a and l-the quotes are messed up...


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://dl.dropbox.com/u/12506914/Pics/p2e-2.png&amp;link2=http://dl.dropbox.com/u/12506914/Pics/ms.png&amp;link3=http://dl.dropbox.com/u/12506914/Pics/block%20lib.png
Starting to move on to other languages, but I'll still be around from time to time  smile

Offline

 

Board footer