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

#1 2010-10-16 11:00:45

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Can I please have [make global variable ||] code!

I have requested this before and got no answer. So can anyone give me the code!


You can now reach me on Twitter @johnnydean1_

Offline

 

#2 2010-10-16 14:38:21

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Can I please have [make global variable ||] code!

johnnydean1 wrote:

I have requested this before and got no answer. So can anyone give me the code!

It's really easy! just look through the code of addGlobalVariable and adapt it to take in an argument like addGlobVar: varName! if you don't know what i'm talking about, you're not advanced enough in squeak for making a mod. but since i know you, try that... (hint: just replace the diaog code bit with result <-- varName get it?)

Offline

 

#3 2010-10-16 15:38:27

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Can I please have [make global variable ||] code!

Yes I just couldnt find that meathod!


You can now reach me on Twitter @johnnydean1_

Offline

 

#4 2010-10-16 16:04:15

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Can I please have [make global variable ||] code!

Thank you, using that meathod I have made a
make ( global/local ) var [  ]


You can now reach me on Twitter @johnnydean1_

Offline

 

#5 2010-10-16 16:37:33

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Can I please have [make global variable ||] code!

this can be closed and here is my code:

make: t1 var: t2
    | t3 t5 t6 |
    t3 _ t2.
    t5 _ self ownerThatIsA: ScratchFrameMorph.
    t1 = 'global'
        ifTrue:
            [t3 _ t3 asUTF8.
            t5 workPane addVariable: t3]
        ifFalse:
            [t6 _ self.
            t6 addVariable: t3]


You can now reach me on Twitter @johnnydean1_

Offline

 

Board footer