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

#1 2012-08-24 09:14:38

sckrlov
New Scratcher
Registered: 2011-08-12
Posts: 1

reading an external text file

Is it possible to have your scratch project pull data from an external text file to be used in the game/scripts?

For example:

in a quiz type game, the script pulls a random question from 100 questions in a text file and displays it and possible answers

This way, if you change the text file it changes what questions will be displayed.

Or is this too advanced for scratch?

Offline

 

#2 2012-08-24 09:16:35

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: reading an external text file

You can import a list manually, but not automatically. However, you can add all the items into the list first then pick the data randomly.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#3 2012-08-24 09:17:05

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: reading an external text file

Scratch doesn't have this feature, but some mods do. Try Panther: http://pantherprogramming.weebly.com/


http://i50.tinypic.com/312u714.jpg

Offline

 

#4 2012-08-24 09:21:47

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: reading an external text file

Panther? It's a bit too advanced for new users.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#5 2012-08-24 09:30:40

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: reading an external text file

jontmy00 wrote:

Panther? It's a bit too advanced for new users.

If so, try Bingo.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#6 2012-08-24 11:11:31

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: reading an external text file

Well, what you can do is copy+paste each entry into a new space in a Scratch List, and then have it pick one at random that way.


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#7 2012-08-24 20:14:01

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: reading an external text file

Scratcher456 wrote:

Well, what you can do is copy+paste each entry into a new space in a Scratch List, and then have it pick one at random that way.

When you upload, it doesn't retain them. I think.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#8 2012-08-25 00:11:56

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

Re: reading an external text file

WARNING: I've been on scratch for a bit but I have not been on the forums so if I mess something up and look stupid, I'm sorry!  tongue
Ok, so, it isn't possible to do exactly what your wanting to do with scratch. It's not possible to do 100 different questions, but it is possible to do about 10 (without spending hours and hours). basically by using the broadcast like this, (I hope I'm doing this right)!

when gf clicked
broadcast (pick random (1) to (10))
Just have different sprites ready to reaceive numbers 1 through 10 and do different things for each one! 100 questions would take a REALLY long time but it isn't impossible!


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#9 2012-08-25 16:41:37

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: reading an external text file

tree-hugger wrote:

WARNING: I've been on scratch for a bit but I have not been on the forums so if I mess something up and look stupid, I'm sorry!  tongue
Ok, so, it isn't possible to do exactly what your wanting to do with scratch. It's not possible to do 100 different questions, but it is possible to do about 10 (without spending hours and hours). basically by using the broadcast like this, (I hope I'm doing this right)!

when gf clicked
broadcast (pick random (1) to (10))
Just have different sprites ready to reaceive numbers 1 through 10 and do different things for each one! 100 questions would take a REALLY long time but it isn't impossible!

Actually, it's easy if you use the lists feature.


http://i50.tinypic.com/312u714.jpg

Offline

 

#10 2012-08-25 22:16:41

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: reading an external text file

jontmy00 wrote:

Scratcher456 wrote:

Well, what you can do is copy+paste each entry into a new space in a Scratch List, and then have it pick one at random that way.

When you upload, it doesn't retain them. I think.

It will retain the lists and their contents, but if you edit the text file it won't change the lists, if that's what you mean. It won't change the lists even when it's on the original machine. A feature like that would be too easy to exploit for bad stuff.


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

Board footer